Ejemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public function getPage()
 {
     if (!isset($this->page)) {
         $this->page = $this->pageMapper->find($this->pageId);
     }
     return $this->page;
 }
Ejemplo n.º 2
0
 /**
  * {@inheritDoc}
  */
 public function findAuthorshipsOfUser($userId, $siteId, $order = null, $paginated = false, $page = 1, $perPage = 10)
 {
     $result = $this->authorshipMapper->findAuthorshipsOfUser($userId, $siteId, $order, $paginated);
     if ($paginated) {
         $result->setCurrentPageNumber($page);
         $result->setItemCountPerPage($perPage);
     } else {
         $result = iterator_to_array($result);
     }
     if ($result) {
         $pageIds = array();
         foreach ($result as $auth) {
             $pageIds[] = $auth->getPageId();
         }
         $pages = $this->pageMapper->findAll(array(sprintf('%s IN (%s)', DbViewPages::PAGEID, implode(',', $pageIds))));
         $pageByIds = array();
         foreach ($pages as $page) {
             $pageByIds[$page->getId()] = $page;
         }
         foreach ($result as $auth) {
             $auth->setPage($pageByIds[$auth->getPageId()]);
         }
     }
     return $result;
 }
Ejemplo n.º 3
0
 /**
  * {@inheritDoc}
  */
 public function getRank()
 {
     if (!isset($this->rank)) {
         $this->rank = $this->pageMapper->findPageRank($this->getId());
     }
     return $this->rank;
 }
Ejemplo n.º 4
0
 /**
  * {@inheritDoc}
  */
 public function findVotesOfUser($userId, $siteId, $order = null, $paginated = false, $page = -1, $perPage = -1)
 {
     $result = $this->mapper->findVotesOfUser($userId, $siteId, $order, $paginated);
     if ($paginated && $result && $page >= 0 && $perPage > 0) {
         $result->setCurrentPageNumber($page);
         $result->setItemCountPerPage($perPage);
     } else {
         $result = iterator_to_array($result);
     }
     if ($result) {
         $pageIds = array();
         foreach ($result as $vote) {
             $pageIds[] = $vote->getPageId();
         }
         if (count($pageIds) > 0) {
             $pages = $this->pageMapper->findAll(array(sprintf('%s IN (%s)', DbViewPages::PAGEID, implode(',', $pageIds))));
             $pageByIds = array();
             foreach ($pages as $page) {
                 $pageByIds[$page->getId()] = $page;
             }
             foreach ($result as $vote) {
                 $vote->setPage($pageByIds[$vote->getPageId()]);
             }
         }
     }
     return $result;
 }
Ejemplo n.º 5
0
 /**
  * {@inheritDoc}
  */
 public function getAggregatedValues($siteId, $aggregates, \DateTime $createdAfter, \DateTime $createdBefore)
 {
     return $this->mapper->getAggregatedValues($siteId, $aggregates, $createdAfter, $createdBefore);
 }