1
0
mirror of synced 2025-01-17 22:11:41 +03:00

DDC-899 - Add method to check if EntityManager is still open.

This commit is contained in:
Benjamin Eberlei 2010-12-03 17:44:24 +01:00
parent 8e4197adc5
commit c6a6aaf493
2 changed files with 20 additions and 0 deletions

View File

@ -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.
*

View File

@ -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());