__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() {
|
public function disconnectWorksheets() {
|
||||||
|
$worksheet = NULL;
|
||||||
foreach($this->_workSheetCollection as $k => &$worksheet) {
|
foreach($this->_workSheetCollection as $k => &$worksheet) {
|
||||||
$worksheet->disconnectCells();
|
$worksheet->disconnectCells();
|
||||||
$this->_workSheetCollection[$k] = null;
|
$this->_workSheetCollection[$k] = null;
|
||||||
|
@ -141,6 +142,14 @@ class PHPExcel
|
||||||
$this->_workSheetCollection = array();
|
$this->_workSheetCollection = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Code to execute when this worksheet is unset()
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function __destruct() {
|
||||||
|
$this->disconnectWorksheets();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get properties
|
* Get properties
|
||||||
*
|
*
|
||||||
|
|
|
@ -379,13 +379,23 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
public function disconnectCells()
|
public function disconnectCells()
|
||||||
{
|
{
|
||||||
$this->_cellCollection->unsetWorksheetCells();
|
$this->_cellCollection->unsetWorksheetCells();
|
||||||
$this->_cellCollection = null;
|
$this->_cellCollection = NULL;
|
||||||
|
|
||||||
// detach ourself from the workbook, so that it can then delete this worksheet successfully
|
// detach ourself from the workbook, so that it can then delete this worksheet successfully
|
||||||
$this->_parent = null;
|
$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
|
* Return the cache controller for the cell collection
|
||||||
*
|
*
|
||||||
* @return PHPExcel_CachedObjectStorage_xxx
|
* @return PHPExcel_CachedObjectStorage_xxx
|
||||||
|
|
Loading…
Reference in New Issue