/** * @return mixed|array */ public function slice() { $records = clone $this->records; $limit = $this->configHelper->getLimit(); $offset = $this->configHelper->getOffset(); return $records->setMaxResults($limit)->setFirstResult($offset)->execute()->fetchAll(); }
/** * @return null|\stdClass */ public function slice() { $records = clone $this->records; $limit = $this->configHelper->getLimit(); $offset = $this->configHelper->getOffset(); return $records->limit($limit)->offset($offset)->get(); }
/** * This method should limit and offset your records and return. */ public function slice() { // Here you will get the database object passed to Strana. // Clone it. $records = clone $this->records; // Get the limit number from Strana config $limit = $this->configHelper->getLimit(); // Get the offset number from Strana config $offset = $this->configHelper->getOffset(); // Return your sliced records return $records->findAll(['limit' => $limit, 'offset' => $offset]); }
/** * @return array */ public function slice() { $limit = $this->configHelper->getLimit(); $offset = $this->configHelper->getOffset(); return array_slice($this->records, $offset, $limit); }