コード例 #1
0
 public function test_can_only_override_many_to____relations()
 {
     $this->setExpectedException(InvalidArgumentException::class, 'Only ManyToMany and ManyToOne relations can be overridden');
     $this->builder->addOwningOneToOne('oneToOne', StubEntity::class);
     $override = $this->override('oneToOne', function () {
     });
     $override->build();
 }
コード例 #2
0
 public function build(ClassMetadataBuilder $builder)
 {
     if ($this->association->getAssociationType() == OneToOneAssociation::TYPE_OWNING) {
         $builder->addOwningOneToOne($this->association->getComputedTargetPropertyName(), $this->association->getTargetEntity()->getName(), $this->association->getComputedInversedByPropertyName());
     } else {
         $builder->addInverseOneToOne($this->association->getComputedTargetPropertyName(), $this->association->getTargetEntity()->getName(), $this->association->getComputedInversedByPropertyName());
     }
 }