/** * {@inheritDoc} */ public function getUser() { if (!isset($this->user)) { $this->user = $this->userMapper->find($this->userId); } return $this->user; }
/** * {@inheritDoc} */ public function findVotesOnPage($pageId, $order = null, $paginated = false, $page = -1, $perPage = -1) { $result = $this->mapper->findVotesOnPage($pageId, $order, $paginated); if ($paginated && $result && $page >= 0 && $perPage > 0) { $result->setCurrentPageNumber($page); $result->setItemCountPerPage($perPage); } else { $result = iterator_to_array($result); } if ($result) { $userIds = array(); foreach ($result as $vote) { $userIds[] = $vote->getUserId(); } if (count($userIds) > 0) { $users = $this->userMapper->findAll(array(sprintf('%s IN (%s)', DbViewUsers::USERID, implode(',', $userIds)))); $userByIds = array(); foreach ($users as $user) { $userByIds[$user->getId()] = $user; } foreach ($result as $vote) { $vote->setUser($userByIds[$vote->getUserId()]); } } } return $result; }
/** * {@inheritdoc} */ public function findUsersOfSite($siteId, $order = null, $paginated = false) { return $this->userMapper->findUsersOfSite($siteId, $order, $paginated); }