Ejemplo n.º 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);
 }
Ejemplo n.º 2
0
 public function testParameterOrderIsCorrect()
 {
     $this->expectQuery('SELECT pk, fk FROM hasOne WHERE (a=?) AND pk IN(?, ?)', [2, 5, 6], []);
     $entity = $this->entityManager->get('HasOneRelationEntity');
     $finder = $entity->find();
     $finder->where($entity->expression()->eq('a', $finder->parameter(2)))->get(5, 6);
 }