/**
  * {@inheritDoc}
  */
 public function setVF($name, $value)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setVF', array($name, $value));
     return parent::setVF($name, $value);
 }
 /**
  * 
  * @param array $data
  * @param bool|null $returnPartial
  * @param stdClass|null $extra
  * @return mixed
  */
 public function defaultCreate($data, $returnPartial = false, $extra = null)
 {
     //throw new Exception($data['lessonDate']);
     $this->validateSubjectRound($data);
     $entity = new ContactLesson($this->getEntityManager());
     $subjectRound = $this->getEntityManager()->getRepository('Core\\Entity\\SubjectRound')->find($data['subjectRound']);
     unset($data['subjectRound']);
     $entity->setSubjectRound($subjectRound);
     $studentGroup = $this->getEntityManager()->getRepository('Core\\Entity\\StudentGroup')->find($data['studentGroup']);
     try {
         if (is_string($data['lessonDate']) && !is_object($data['lessonDate'])) {
             $data['lessonDate'] = new DateTime($data['lessonDate']);
         }
         //TA2-16.04.2016-2
         $data['name'] = $studentGroup->getName() . '-' . $data['lessonDate']->format('d.m.Y') . '-' . $data['sequenceNr'];
     } catch (Exception $ex) {
         throw new Exception($ex->getMessage());
     }
     $entityValidated = $this->validateEntity($entity, $data);
     return $this->singleResult($entityValidated, $returnPartial, $extra);
 }
 /**
  * @covers Core\Entity\ContactLesson::addTeacher
  * @covers Core\Entity\ContactLesson::removeTeacher
  */
 public function testAddRemoveTeacher()
 {
     $cl = new ContactLesson();
     $this->assertEquals(0, $cl->getTeacher()->count());
     $mockTeacher = $this->getMockBuilder('Core\\Entity\\Teacher')->getMock();
     $teachers = new \Doctrine\Common\Collections\ArrayCollection();
     $teachers->add($mockTeacher);
     $cl->addTeacher($teachers);
     $this->assertEquals(1, $cl->getTeacher()->count());
     $this->assertEquals($mockTeacher, $cl->getTeacher()->first());
     $cl->removeTeacher($teachers);
     $this->assertEquals(0, $cl->getTeacher()->count());
 }