[DDC-1777] Fix bug in BasicEntityPersister#exists() when no primary key is set.
This commit is contained in:
parent
c1fd0c479a
commit
6523f7f59e
2 changed files with 23 additions and 0 deletions
|
@ -1524,6 +1524,10 @@ class BasicEntityPersister
|
||||||
{
|
{
|
||||||
$criteria = $this->_class->getIdentifierValues($entity);
|
$criteria = $this->_class->getIdentifierValues($entity);
|
||||||
|
|
||||||
|
if ( ! $criteria) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if ($extraConditions) {
|
if ($extraConditions) {
|
||||||
$criteria = array_merge($criteria, $extraConditions);
|
$criteria = array_merge($criteria, $extraConditions);
|
||||||
}
|
}
|
||||||
|
|
|
@ -448,4 +448,23 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||||
$manager = $this->_em->find('Doctrine\Tests\Models\Company\CompanyManager', $manager->getId());
|
$manager = $this->_em->find('Doctrine\Tests\Models\Company\CompanyManager', $manager->getId());
|
||||||
$this->assertEquals(1, count($manager->getFriends()));
|
$this->assertEquals(1, count($manager->getFriends()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group DDC-1777
|
||||||
|
*/
|
||||||
|
public function testExistsSubclass()
|
||||||
|
{
|
||||||
|
$manager = new CompanyManager();
|
||||||
|
$manager->setName('gblanco');
|
||||||
|
$manager->setSalary(1234);
|
||||||
|
$manager->setTitle('Awesome!');
|
||||||
|
$manager->setDepartment('IT');
|
||||||
|
|
||||||
|
$this->assertFalse($this->_em->getUnitOfWork()->getEntityPersister(get_class($manager))->exists($manager));
|
||||||
|
|
||||||
|
$this->_em->persist($manager);
|
||||||
|
$this->_em->flush();
|
||||||
|
|
||||||
|
$this->assertTrue($this->_em->getUnitOfWork()->getEntityPersister(get_class($manager))->exists($manager));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue