/**
  * @return \Psc\Doctrine\Object
  */
 public function validate($data)
 {
     $idRule = new IdValidatorRule();
     $id = $idRule->validate($data);
     // schmeisst empty data exception wenn necessary
     $object = $this->em->getRepository($this->entityName)->findOneBy(array($this->idName => $id));
     if ($object instanceof $this->entityName) {
         return $object;
     }
     throw new \Psc\Exception('Entity konnte nicht gefunden werden');
 }
Beispiel #2
0
 public function validateId($id)
 {
     $rule = new IdValidatorRule();
     return $rule->validate($id);
 }