/** * * * @param UsrList $list * @param type $usr_id * @return UsrList */ public function findByListAndUsrId(UsrList $list, $usr_id) { $dql = 'SELECT o FROM Phraseanet:UsrListOwner o JOIN o.list l WHERE l.id = :list_id AND o.user = :usr_id'; $params = ['usr_id' => $usr_id, 'list_id' => $list->getId()]; $query = $this->_em->createQuery($dql); $query->setParameters($params); try { $owner = $query->getSingleResult(); } catch (NoResultException $e) { throw new NotFoundHttpException('Owner is not found', null, $e); } return $owner; }
private function formatUserList(UsrList $list) { $entries = []; foreach ($list->getEntries() as $entry) { $entries[] = ['Id' => $entry->getId(), 'User' => $this->formatUser($entry->getUser())]; } return ['type' => 'LIST', 'list_id' => $list->getId(), 'name' => $list->getName(), 'length' => count($entries), 'entries' => $entries]; }
/** * {@inheritDoc} */ public function getId() { if ($this->__isInitialized__ === false) { return (int) parent::getId(); } $this->__initializer__ && $this->__initializer__->__invoke($this, 'getId', array()); return parent::getId(); }