I would like to add a function, reset() but am hesitant of modifying a parent class because there is a grandparent (i.e., core.Iterator) and so it may require a longer sojourn into the realm of the most abstract classes. Unless there already is a way of reseting a DAOResultsFactory, my plan though is to add a null reset function to iterator
- Code: Select all
core.Iterator.inc.php
function reset() { return;}
And then overload reset() in the DAOResultFactory, using code derived from the DAOResultFactory constructor.
- Code: Select all
db.DAOResultFactory.inc.php
function reset(){
if (!$this->records || $this->records->EOF) {
if ($records) $records->Close();
$this->records = null;
$this->wasEmpty = true;
$this->page = 1;
$this->isFirst = true;
$this->isLast = true;
$this->count = 0;
$this->pageCount = 1;
} else {
$this->wasEmpty = false;
$this->page = $this->records->AbsolutePage();
$this->isFirst = $this->records->atFirstPage();
$this->isLast = $this->records->atLastPage();
$this->count = $this->records->MaxRecordCount();
$this->pageCount = $this->records->LastPageNo()
}
}
Can anyone advise on this? Perhaps there is a much easier way of doing this with the existing code base?
