__destroy methods for Excel and Worksheet objects
This commit is contained in:
parent
4e8dea7883
commit
245a1dc832
|
@ -133,6 +133,7 @@ class PHPExcel
|
|||
*
|
||||
*/
|
||||
public function disconnectWorksheets() {
|
||||
$worksheet = NULL;
|
||||
foreach($this->_workSheetCollection as $k => &$worksheet) {
|
||||
$worksheet->disconnectCells();
|
||||
$this->_workSheetCollection[$k] = null;
|
||||
|
@ -141,6 +142,14 @@ class PHPExcel
|
|||
$this->_workSheetCollection = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Code to execute when this worksheet is unset()
|
||||
*
|
||||
*/
|
||||
function __destruct() {
|
||||
$this->disconnectWorksheets();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get properties
|
||||
*
|
||||
|
|
|
@ -379,12 +379,22 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||
public function disconnectCells()
|
||||
{
|
||||
$this->_cellCollection->unsetWorksheetCells();
|
||||
$this->_cellCollection = null;
|
||||
$this->_cellCollection = NULL;
|
||||
|
||||
// detach ourself from the workbook, so that it can then delete this worksheet successfully
|
||||
$this->_parent = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Code to execute when this worksheet is unset()
|
||||
*
|
||||
*/
|
||||
function __destruct() {
|
||||
if ($this->_cellCollection !== NULL) {
|
||||
$this->disconnectCells();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the cache controller for the cell collection
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue