add max_item and page in api route search and stories

This commit is contained in:
aina-esokia
2018-09-11 17:49:24 +04:00
parent 2dd069f173
commit e9beafef85
4 changed files with 37 additions and 8 deletions

View File

@@ -1677,17 +1677,20 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
}
/**
* @param int $offset
* @param null|int $max_items
*
* @return set_selection|record_adapter[]
* @throws Exception
* @throws \Doctrine\DBAL\DBALException
*/
public function getChildren()
public function getChildren($offset = 0, $max_items = null)
{
if (!$this->isStory()) {
throw new Exception('This record is not a grouping');
}
$selections = $this->getDatabox()->getRecordRepository()->findChildren([$this->getRecordId()]);
$selections = $this->getDatabox()->getRecordRepository()->findChildren([$this->getRecordId()], null, $offset, $max_items);
return reset($selections);
}