| @@ 20-46 (lines=27) @@ | ||
| 17 | */ |
|
| 18 | class OneToManyCompositeIdForeignKeyTest extends OrmFunctionalTestCase |
|
| 19 | { |
|
| 20 | public function setUp() |
|
| 21 | { |
|
| 22 | $this->useModelSet('vct_onetomany_compositeid_foreignkey'); |
|
| 23 | ||
| 24 | parent::setUp(); |
|
| 25 | ||
| 26 | $auxiliary = new Entity\AuxiliaryEntity(); |
|
| 27 | $auxiliary->id4 = 'abc'; |
|
| 28 | ||
| 29 | $inversed = new Entity\InversedOneToManyCompositeIdForeignKeyEntity(); |
|
| 30 | $inversed->id1 = 'def'; |
|
| 31 | $inversed->foreignEntity = $auxiliary; |
|
| 32 | $inversed->someProperty = 'some value to be loaded'; |
|
| 33 | ||
| 34 | $owning = new Entity\OwningManyToOneCompositeIdForeignKeyEntity(); |
|
| 35 | $owning->id2 = 'ghi'; |
|
| 36 | ||
| 37 | $inversed->associatedEntities->add($owning); |
|
| 38 | $owning->associatedEntity = $inversed; |
|
| 39 | ||
| 40 | $this->_em->persist($auxiliary); |
|
| 41 | $this->_em->persist($inversed); |
|
| 42 | $this->_em->persist($owning); |
|
| 43 | ||
| 44 | $this->_em->flush(); |
|
| 45 | $this->_em->clear(); |
|
| 46 | } |
|
| 47 | ||
| 48 | public static function tearDownAfterClass() |
|
| 49 | { |
|
| @@ 20-45 (lines=26) @@ | ||
| 17 | */ |
|
| 18 | class OneToOneCompositeIdForeignKeyTest extends OrmFunctionalTestCase |
|
| 19 | { |
|
| 20 | public function setUp() |
|
| 21 | { |
|
| 22 | $this->useModelSet('vct_onetoone_compositeid_foreignkey'); |
|
| 23 | parent::setUp(); |
|
| 24 | ||
| 25 | $auxiliary = new Entity\AuxiliaryEntity(); |
|
| 26 | $auxiliary->id4 = 'abc'; |
|
| 27 | ||
| 28 | $inversed = new Entity\InversedOneToOneCompositeIdForeignKeyEntity(); |
|
| 29 | $inversed->id1 = 'def'; |
|
| 30 | $inversed->foreignEntity = $auxiliary; |
|
| 31 | $inversed->someProperty = 'some value to be loaded'; |
|
| 32 | ||
| 33 | $owning = new Entity\OwningOneToOneCompositeIdForeignKeyEntity(); |
|
| 34 | $owning->id2 = 'ghi'; |
|
| 35 | ||
| 36 | $inversed->associatedEntity = $owning; |
|
| 37 | $owning->associatedEntity = $inversed; |
|
| 38 | ||
| 39 | $this->_em->persist($auxiliary); |
|
| 40 | $this->_em->persist($inversed); |
|
| 41 | $this->_em->persist($owning); |
|
| 42 | ||
| 43 | $this->_em->flush(); |
|
| 44 | $this->_em->clear(); |
|
| 45 | } |
|
| 46 | ||
| 47 | public static function tearDownAfterClass() |
|
| 48 | { |
|
| @@ 26-53 (lines=28) @@ | ||
| 23 | ] |
|
| 24 | ]; |
|
| 25 | ||
| 26 | protected function setUp() |
|
| 27 | { |
|
| 28 | $this->useModelSet('ornemental_orphan_removal'); |
|
| 29 | ||
| 30 | parent::setUp(); |
|
| 31 | ||
| 32 | $person = new Person; |
|
| 33 | $person->id = 'ca41a293-799f-4d68-bf79-626c3ad223ec'; |
|
| 34 | ||
| 35 | $phone1 = new PhoneNumber; |
|
| 36 | $phone1->id = 'f4132478-c492-4dfe-aab5-a5b79ae129e7'; |
|
| 37 | $phone1->phonenumber = '123456'; |
|
| 38 | ||
| 39 | $phone2 = new PhoneNumber; |
|
| 40 | $phone2->id = '7faa4cd3-a155-4fbf-bc42-aa4269a4454d'; |
|
| 41 | $phone2->phonenumber = '234567'; |
|
| 42 | ||
| 43 | $phone1->person = $person; |
|
| 44 | $phone2->person = $person; |
|
| 45 | ||
| 46 | $this->_em->persist($phone1); |
|
| 47 | $this->_em->persist($phone2); |
|
| 48 | $this->_em->persist($person); |
|
| 49 | $this->_em->flush(); |
|
| 50 | ||
| 51 | $this->personId = $person->id; |
|
| 52 | $this->_em->clear(); |
|
| 53 | } |
|
| 54 | ||
| 55 | public function testOrphanRemovalIsPurelyOrnemental() |
|
| 56 | { |
|