Beispiel #1
0
 /**
  * {@inheritDoc}
  */
 public function getIdentifierValue($model, $manager = null)
 {
     if (!is_object($model)) {
         throw new \InvalidArgumentException(sprintf('You must given an object model, you given type "%s".', gettype($model)));
     }
     if ($model instanceof $this->name) {
         throw new \RuntimeException(sprintf('Model class "%s" must to be an instance of "%s"', get_class($model), $this->name));
     }
     $field = null !== $manager ? $this->getIdentifierReference($manager)->referenceField : $this->identifierField;
     $method = 'get' . ucfirst($field);
     if (!method_exists($model, $method)) {
         throw new \RuntimeException(sprintf('You model "%s" must be implement method "%s".', get_class($model), $method));
     }
     return parent::getIdentifierValue($model, $manager);
 }