/** * {@inheritDoc} */ public function hydrate(array $data, \Doctrine\ORM\EntityManager $em = NULL) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'hydrate', array($data, $em)); return parent::hydrate($data, $em); }
/** * * @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); }