/** * @covers Core\Entity\Module::setVocation * @covers Core\Entity\Module::getVocation */ public function testSetGetVocation() { $mockVocation = $this->getMockBuilder('Core\\Entity\\Vocation')->getMock(); $this->module->setVocation($mockVocation); $this->assertEquals($mockVocation, $this->module->getVocation()); }
/** * {@inheritDoc} */ public function setVocation(\Core\Entity\Vocation $vocation) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setVocation', array($vocation)); return parent::setVocation($vocation); }
/** * * @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); }