DDC-899 - Add method to check if EntityManager is still open.
This commit is contained in:
parent
8e4197adc5
commit
c6a6aaf493
@ -619,6 +619,16 @@ class EntityManager
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the Entity manager is open or closed.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isOpen()
|
||||
{
|
||||
return (!$this->closed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the UnitOfWork used by the EntityManager to coordinate operations.
|
||||
*
|
||||
|
@ -14,6 +14,16 @@ class EntityManagerTest extends \Doctrine\Tests\OrmTestCase
|
||||
$this->_em = $this->_getTestEntityManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* @group DDC-899
|
||||
*/
|
||||
public function testIsOpen()
|
||||
{
|
||||
$this->assertTrue($this->_em->isOpen());
|
||||
$this->_em->close();
|
||||
$this->assertFalse($this->_em->isOpen());
|
||||
}
|
||||
|
||||
public function testGetConnection()
|
||||
{
|
||||
$this->assertType('\Doctrine\DBAL\Connection', $this->_em->getConnection());
|
||||
|
Loading…
x
Reference in New Issue
Block a user