public function getCount() { if (isset($this->_data['count'])) { return $this->_data['count']; } if (isset($this->_stream)) { $this->set('count', $this->_stream->getCount()); } }
/** * * @param array $filters * @param array $options * @return array of array|PersistentAbstract */ public function findAll($filters = array(), $options = array()) { $result = new StreamResultModel(); $params = $filters + $options + array('mapper' => $this); if (!isset($params['paging']['count'])) { if (!is_array($params['paging'])) { $params['paging'] = array(); } $params['paging']['count'] = static::DEFAULT_ITEMS_PER_PAGE; } if (!isset($params['paging']['page'])) { $params['paging']['page'] = 1; } $result->setIterator(new GenericProtoIterator($params)); return $result; }
/** * @param \App_ListFilter $filters * @return \Application\Model\Stream\StreamResultModel */ public function findAllIterator(\App_ListFilter $filters) { $iterator = new AuditLogIterator(array('filterList' => $filters, 'paging' => array('count' => -1))); $result = new StreamResultModel(); $result->setIterator($iterator); return $result; }
protected function _findAll($filters, $options) { $data = array(); if (isset($filters['filterList']) && $filters['filterList'] instanceof \App_ListFilter) { $data['filterList'] = $filters['filterList']; } else { $data['filterList'] = new \App_ListFilter(); } $filterList = $data['filterList']; $filterList->addExtraData('organizationId', self::$organizationId); if (isset($options['maxFirstPages'])) { $data['maxFirstPages'] = $options['maxFirstPages']; unset($options['maxFirstPages']); } $data['paging'] = $options; if (!isset($data['paging']['count'])) { $data['paging']['count'] = static::DEFAULT_ITEMS_PER_PAGE; } $data['mapper'] = $this; $iter = new PybeIterator($data); $result = new StreamResultModel(); $result->setIterator($iter); return $result; }
/** * */ public function findAll($filters = array(), $options = array()) { $data = array(); if (isset($filters['filterList']) && $filters['filterList'] instanceof \App_ListFilter) { $data['filterList'] = $filters['filterList']; } else { $data['filterList'] = new \App_ListFilter(); } $filterList = $data['filterList']; $filterList->addExtraData('organizationId', self::$organizationId); if (isset($options['maxFirstPages'])) { $data['maxFirstPages'] = $options['maxFirstPages']; unset($options['maxFirstPages']); } $data['paging'] = $options; if (!isset($data['paging']['count'])) { $data['paging']['count'] = static::DEFAULT_ITEMS_PER_PAGE; } if ($filterList->getGrouping() == null || $filterList->getGroup() && !$filterList->getHighlighting()) { $iter = new SimIterator($data); $result = new StreamResultModel(); $result->setIterator($iter); return $result; } $dataList = $this->_findAllEricsson($data); if (isset($dataList['items'])) { $items = $dataList['items']; foreach ($items as $id => $data) { $items[$id] = new SimModel($data); } $result = new Model\ListResultModel(); $result->setItems($items); if ($dataList['count'] !== null) { $result->setCount($dataList['count']); } return $result; } else { $result = new Model\GroupListModel(); foreach ($dataList as $group) { if (isset($group['label'])) { $groupModel = new Model\GroupResultModel(); $groupModel->setLabel($group['label']); $groupModel->setCount(isset($group['count']) ? $group['count'] : 0); $items = array(); if (!empty($group['items'])) { $items = $group['items']; foreach ($items as $id => $data) { $items[$id] = new SimModel($data); } } $groupModel->setItems($items); $result->addGroup($groupModel); } } return $result; } }
/** * @param array $filters * @param array $options * @return \Application\Model\ListResultModel */ protected function _findAll(array $filters = array(), array $options = array()) { $params = array('mapper' => get_class($this)); if (isset($filters['filterList'])) { $params['filterList'] = $filters['filterList']; } $iterator = new MongoIterator($params + $options); $result = new StreamResultModel(); $result->setIterator($iterator); return $result; }