Avoid error when entityName isn't a string
This commit is contained in:
parent
77a338e0fd
commit
4a87f00fab
@ -3442,6 +3442,10 @@ class UnitOfWork implements PropertyChangedListener
|
||||
*/
|
||||
private function clearIdentityMapForEntityName($entityName)
|
||||
{
|
||||
if (is_object($entityName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (! isset($this->identityMap[$entityName])) {
|
||||
return;
|
||||
}
|
||||
|
@ -349,6 +349,20 @@ class UnitOfWorkTest extends OrmTestCase
|
||||
$this->assertFalse($this->_unitOfWork->isScheduledForInsert($entity2));
|
||||
}
|
||||
|
||||
public function testClearManagerWithObject()
|
||||
{
|
||||
$entity = new Country(456, 'United Kingdom');
|
||||
|
||||
$this->_unitOfWork->persist($entity);
|
||||
$this->assertTrue($this->_unitOfWork->isInIdentityMap($entity));
|
||||
|
||||
$this->_unitOfWork->clear($entity);
|
||||
|
||||
// true because entity wasn't a string so it wasn't cleared
|
||||
$this->assertTrue($this->_unitOfWork->isInIdentityMap($entity));
|
||||
$this->assertTrue($this->_unitOfWork->isScheduledForInsert($entity));
|
||||
}
|
||||
|
||||
/**
|
||||
* Data Provider
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user