mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Fixed HasManyComplexTableField/ManyManyComplexTableField issue with source items which broke from changes in r66080. Thanks hamish!
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@68628 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
e37fa6b790
commit
f93b782e94
@ -68,33 +68,24 @@ class HasManyComplexTableField extends ComplexTableField {
|
||||
}
|
||||
|
||||
function sourceItems() {
|
||||
if($this->sourceItems)
|
||||
return $this->sourceItems;
|
||||
if($this->sourceItems) return $this->sourceItems;
|
||||
|
||||
$limitClause = '';
|
||||
if(isset($_REQUEST[ 'ctf' ][ $this->Name() ][ 'start' ]) && is_numeric($_REQUEST[ 'ctf' ][ $this->Name() ][ 'start' ]))
|
||||
if(isset($_REQUEST['ctf'][$this->Name()]['start']) && is_numeric($_REQUEST['ctf'][$this->Name()]['start'])) {
|
||||
$limitClause = $_REQUEST[ 'ctf' ][ $this->Name() ][ 'start' ] . ", $this->pageSize";
|
||||
else
|
||||
} else {
|
||||
$limitClause = "0, $this->pageSize";
|
||||
}
|
||||
|
||||
$dataQuery = $this->getQuery($limitClause);
|
||||
$records = $dataQuery->execute();
|
||||
$items = new DataObjectSet();
|
||||
foreach($records as $record) {
|
||||
if(! get_class($record))
|
||||
$record = new DataObject($record);
|
||||
$items->push($record);
|
||||
}
|
||||
|
||||
$dataQuery = $this->getQuery();
|
||||
$records = $dataQuery->execute();
|
||||
$unpagedItems = new DataObjectSet();
|
||||
foreach($records as $record) {
|
||||
if(! get_class($record))
|
||||
$record = new DataObject($record);
|
||||
$unpagedItems->push($record);
|
||||
}
|
||||
$this->unpagedSourceItems = $unpagedItems;
|
||||
$sourceClass = $this->sourceClass;
|
||||
$dataobject = new $sourceClass();
|
||||
$items = $dataobject->buildDataObjectSet($records, 'DataObjectSet');
|
||||
|
||||
$this->unpagedSourceItems = $dataobject->buildDataObjectSet($records, 'DataObjectSet');
|
||||
|
||||
$this->totalCount = ($this->unpagedSourceItems) ? $this->unpagedSourceItems->TotalItems() : null;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user