Exemplo n.º 1
0
 public function test_can_add_join_column()
 {
     $this->relation->addJoinColumn('children');
     $this->relation->build();
     $assoc = $this->getAssocValue($this->field, 'joinColumns')[1];
     $this->assertEquals('children_id', $assoc['name']);
     $this->assertEquals('id', $assoc['referencedColumnName']);
     $this->assertFalse($assoc['nullable']);
 }
Exemplo n.º 2
0
 protected function setUp()
 {
     $this->builder = new ClassMetadataBuilder(new ClassMetadataInfo(FluentEntity::class));
     // OneToMany needs to have the parent to be mapped
     $relation = new ManyToOne($this->builder, new DefaultNamingStrategy(), 'parent', FluentEntity::class);
     $relation->build();
     $this->relation = new OneToMany($this->builder, new DefaultNamingStrategy(), $this->field, FluentEntity::class);
     $this->relation->mappedBy('parent');
 }