| @@ 52-73 (lines=22) @@ | ||
| 49 | $this->_em->clear(); |
|
| 50 | } |
|
| 51 | ||
| 52 | public function testOrphanRemovalIsPurelyOrnemental() |
|
| 53 | { |
|
| 54 | $person = $this->_em->getReference(Person::class, $this->personId); |
|
| 55 | ||
| 56 | $this->_em->remove($person); |
|
| 57 | $this->_em->flush(); |
|
| 58 | $this->_em->clear(); |
|
| 59 | ||
| 60 | $query = $this->_em->createQuery( |
|
| 61 | 'SELECT u FROM Doctrine\Tests\Models\OrnementalOrphanRemoval\Person u' |
|
| 62 | ); |
|
| 63 | $result = $query->getResult(); |
|
| 64 | ||
| 65 | $this->assertEquals(0, count($result), 'Person should be removed by EntityManager'); |
|
| 66 | ||
| 67 | $query = $this->_em->createQuery( |
|
| 68 | 'SELECT p FROM Doctrine\Tests\Models\OrnementalOrphanRemoval\PhoneNumber p' |
|
| 69 | ); |
|
| 70 | $result = $query->getResult(); |
|
| 71 | ||
| 72 | $this->assertEquals(2, count($result), 'Orphan removal should not kick in'); |
|
| 73 | } |
|
| 74 | ||
| 75 | protected function _getEntityManager( |
|
| 76 | Connection $connection = null, |
|
| @@ 43-60 (lines=18) @@ | ||
| 40 | $this->_em->clear(); |
|
| 41 | } |
|
| 42 | ||
| 43 | public function testOrphanRemoval() |
|
| 44 | { |
|
| 45 | $userProxy = $this->_em->getReference(CmsUser::class, $this->userId); |
|
| 46 | ||
| 47 | $this->_em->remove($userProxy); |
|
| 48 | $this->_em->flush(); |
|
| 49 | $this->_em->clear(); |
|
| 50 | ||
| 51 | $query = $this->_em->createQuery('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u'); |
|
| 52 | $result = $query->getResult(); |
|
| 53 | ||
| 54 | $this->assertEquals(0, count($result), 'CmsUser should be removed by EntityManager'); |
|
| 55 | ||
| 56 | $query = $this->_em->createQuery('SELECT p FROM Doctrine\Tests\Models\CMS\CmsPhonenumber p'); |
|
| 57 | $result = $query->getResult(); |
|
| 58 | ||
| 59 | $this->assertEquals(0, count($result), 'CmsPhonenumber should be removed by orphanRemoval'); |
|
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * @group DDC-3382 |
|