Example #1
0
 public function __construct(Entity $entity, $property)
 {
     $class = $entity->getClassName();
     if (!property_exists($class, $property)) {
         throw new \InvalidArgumentException("{$class}::{$property} is not a property");
     }
     $this->property = $property;
 }
Example #2
0
 public function __construct(Entity $entity, $method)
 {
     $class = $entity->getClassName();
     if (!is_callable([$class, $method])) {
         throw new \InvalidArgumentException("{$class}::{$method} is not callable");
     }
     $this->method = $method;
 }
 /**
  * @param Entity $entity
  */
 private function readTableName(Entity $entity)
 {
     $className = $entity->getClassName();
     try {
         $classAnnotations = $this->annotationReader->readClass($className);
         $entity->setTable($classAnnotations->get('Table'));
     } catch (\OutOfBoundsException $e) {
         throw new EntityDefinitionException("Missing Table annotation of {$className}", 0, $e);
     }
 }