/** * {@inheritDoc} */ public function load(ObjectManager $manager) { $admin = new Professor(); $admin->setEmail('*****@*****.**'); $admin->setPlainPassword('password'); $admin->addRole('ROLE_ADMIN'); $admin->setFirstName('Admin'); $admin->setLastName('1'); $admin->setEnabled(true); $manager->persist($admin); $manager->flush(); }
public function findProfessorLastNotValidatedCourses(Professor $professor, $limit = 5) { return $this->createQueryBuilder('c')->join('c.professor', 'p')->where('c.validated = false')->andWhere('p.id = :professor_id')->orderBy('c.createdAt', 'DESC')->setMaxResults($limit)->setParameter(':professor_id', $professor->getId())->getQuery()->getResult(); }