/** * @param LecturerInterface $lecturer * @param null $limit * @param null $offset * @return mixed */ public function getChapterByLecturer(LecturerInterface $lecturer, $limit = null, $offset = null) { $qb = $this->createQueryBuilder('ch')->where('ch.author = :author_id')->setParameter('author_id', $lecturer->getId(), TYPE::INTEGER); if (is_int($limit)) { $qb->setMaxResults($limit); } if (is_int($offset)) { $qb->setFirstResult($offset); } return $qb->getQuery()->getResult(); }
/** * @param LecturerInterface $lecturer * @param $hash * @return mixed */ public function getByLecturerAndHash(LecturerInterface $lecturer, $hash) { $qb = $this->createQueryBuilder('t')->where('t.author = :author_id')->andWhere('t.hashTag = :hash')->setParameter('hash', $hash, TYPE::STRING)->setParameter('author_id', $lecturer->getId(), TYPE::INTEGER); return $qb->getQuery()->getOneOrNullResult(); }