Пример #1
0
 /**
  * @param Comment $comment
  * @param         $property
  * @param Entity  $entity
  */
 private function processRelation(Comment $comment, $property, Entity $entity)
 {
     /** @var \ORMiny\Annotations\Relation $relationAnnotation */
     $relationAnnotation = current($comment->getAnnotationType(RelationAnnotation::class));
     $relation = Relation::create($entity, $this->manager->get($relationAnnotation->target), $relationAnnotation, $this->createSetter($entity, $property, $relationAnnotation), $this->createGetter($entity, $property, $relationAnnotation));
     $entity->addRelation($relationAnnotation->name, $relationAnnotation->foreignKey, $relation);
 }
Пример #2
0
 /**
  * @param Comment $comment
  * @param AnnotationMetadata $metadata
  */
 private function collectTargetMetadata(Comment $comment, AnnotationMetadata $metadata)
 {
     //@Target
     $targetClassName = Target::class;
     if ($comment->hasAnnotationType($targetClassName)) {
         $metadata->target = array_reduce($comment->getAnnotationType($targetClassName), function ($value, Target $target) {
             return $value | $target->target;
         });
     }
 }
Пример #3
0
 /**
  * @expectedException \OutOfBoundsException
  */
 public function testClassAnnotationInterfaceException()
 {
     $comment = new Comment('');
     $comment->getAnnotationType('someclass');
 }