/** * {@inheritDoc} */ public function setVF($name, $value) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setVF', array($name, $value)); return parent::setVF($name, $value); }
/** * @covers Core\Entity\Module::setUpdatedAt * @covers Core\Entity\Module::getUpdatedAt */ public function testSetGetUpdatedAt() { $dt = new DateTime(); $this->module->setUpdatedAt($dt); $this->assertEquals($dt, $this->module->getUpdatedAt()); }
/** * @covers Core\Entity\Module::addGradingType * @covers Core\Entity\Module::removeGradingType */ public function testAddRemoveGradingType() { $ml = new Module(); $this->assertEquals(0, $ml->getGradingType()->count()); $mockGradingType = $this->getMockBuilder('Core\\Entity\\GradingType')->getMock(); $gradingtypes = new \Doctrine\Common\Collections\ArrayCollection(); $gradingtypes->add($mockGradingType); $ml->addGradingType($gradingtypes); $this->assertEquals(1, $ml->getGradingType()->count()); $this->assertEquals($mockGradingType, $ml->getGradingType()->first()); $ml->removeGradingType($gradingtypes); $this->assertEquals(0, $ml->getGradingType()->count()); }
/** * * @param type $data * @param type $returnPartial * @param type $extra * @return GradingType * @throws Exception */ public function defaultCreate($data, $returnPartial = false, $extra = null) { $this->validateVocation($data); $entity = new Module($this->getEntityManager()); $vocation = $this->getEntityManager()->getRepository('Core\\Entity\\Vocation')->find($data['vocation']); $entity->setVocation($vocation); unset($data['vocation']); $entity->hydrate($data, $this->getEntityManager()); $entityValidated = $this->validateEntity($entity, $data); //manytomany validate manually if (!count($entity->getGradingType())) { throw new Exception(Json::encode('MISSING_GRADING_TYPES', true)); } return $this->singleResult($entityValidated, $returnPartial, $extra); }