public function getStudentVocationByStudentId(Student $student) { $dql = "SELECT \n partial studentInGroups.{\n id,\n status\n },\n partial student.{\n id\n },\n partial studentGroup.{\n id\n },\n partial vocation.{\n id\n }\n FROM Core\\Entity\\StudentInGroups studentInGroups\n JOIN studentInGroups.student student\n JOIN studentInGroups.studentGroup studentGroup\n JOIN studentGroup.vocation vocation\n WHERE studentInGroups.status=1 AND student.id=:studentId "; $q = $this->getEntityManager()->createQuery($dql); $q->setParameter('studentId', $student->getId(), Type::INTEGER); //$q->setHydrationMode(Query::HYDRATE_ARRAY); return $q->execute(null, Query::HYDRATE_OBJECT); }
/** * Creates lisUser and associates to given Student * * @param \Core\Entity\Student $student * @param array|null $data * * @return \Core\Entity\LisUser */ protected function CreateStudentUser(\Core\Entity\Student $student, $data = null) { $d = $data; if (!$d) { //if $data was not given $d = ['personalCode' => $student->getPersonalCode(), 'password' => uniqid(), 'email' => uniqid() . '@asd.ee']; } $lisUser = $this->em->getRepository('Core\\Entity\\LisUser')->Create($d); $student->setLisUser($lisUser); //associate $this->em->persist($student); $this->em->flush($student); return $lisUser; }
/** * @covers Core\Entity\Student::setUpdatedAt * @covers Core\Entity\Student::getUpdatedAt */ public function testSetGetUpdatedAt() { $dt = new DateTime(); $this->student->setUpdatedAt($dt); $this->assertEquals($dt, $this->student->getUpdatedAt()); }
/** * @covers Core\Entity\Student::refreshTimeStamps */ public function testRefreshTimeStamps() { $student = new Student($this->mockEntityManager); $student->refreshTimeStamps(); $createdAt = $student->getCreatedAt(); $this->assertNotNull($createdAt); $this->assertNull($student->getUpdatedAt()); $student->refreshTimeStamps(); $updatedAt = $student->getUpdatedAt(); $this->assertNotNull($updatedAt); $this->assertEquals($createdAt, $student->getCreatedAt()); }
/** * {@inheritDoc} */ public function setVF($name, $value) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setVF', array($name, $value)); return parent::setVF($name, $value); }