/** * Get author options * * @return array */ public function getOptions() { $authors = array(); foreach ($this->repository->findBy(array(), array('last_name' => 'asc', 'first_name' => 'asc')) as $author) { $authors[$author->getId()] = $author->getFullName(); } return $authors; }
/** * @expects Exception */ public function testSave() { $user = new User('uname'); $topic = new Topic(1, 1, 'name'); $this->em->persist($user); $this->em->persist($topic); $this->em->flush(); $userTopic = new UserTopic($user, $topic); $this->em->persist($userTopic); $this->em->flush(); $this->em->clear(); $userTopics = $this->repository->findBy(array('user' => $user->getId())); $this->assertEquals(1, sizeof($userTopics)); $this->assertEquals($topic->getName(), $userTopics[0]->getTopic()->getName()); }
/** * Find package by a set of criteria * * @param array $criteria * @param array $orderBy * @param int $limit * @param int $offset * @return array */ public function findBy(array $criteria, array $orderBy = array(), $limit = 25, $offset = 0) { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); }