Removed 'name' attribute from EntityManager since it's not needed.
This commit is contained in:
parent
2ef81cf2a9
commit
32d43c365f
@ -59,13 +59,6 @@ class EntityManager
|
|||||||
*/
|
*/
|
||||||
const FLUSHMODE_MANUAL = 'manual';
|
const FLUSHMODE_MANUAL = 'manual';
|
||||||
|
|
||||||
/**
|
|
||||||
* The unique name of the EntityManager.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $_name;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The used Configuration.
|
* The used Configuration.
|
||||||
*
|
*
|
||||||
@ -143,10 +136,9 @@ class EntityManager
|
|||||||
* @param Doctrine\ORM\Configuration $config
|
* @param Doctrine\ORM\Configuration $config
|
||||||
* @param Doctrine\Common\EventManager $eventManager
|
* @param Doctrine\Common\EventManager $eventManager
|
||||||
*/
|
*/
|
||||||
protected function __construct(Connection $conn, $name, Configuration $config, EventManager $eventManager)
|
protected function __construct(Connection $conn, Configuration $config, EventManager $eventManager)
|
||||||
{
|
{
|
||||||
$this->_conn = $conn;
|
$this->_conn = $conn;
|
||||||
$this->_name = $name;
|
|
||||||
$this->_config = $config;
|
$this->_config = $config;
|
||||||
$this->_eventManager = $eventManager;
|
$this->_eventManager = $eventManager;
|
||||||
$this->_metadataFactory = new ClassMetadataFactory(
|
$this->_metadataFactory = new ClassMetadataFactory(
|
||||||
@ -176,16 +168,6 @@ class EntityManager
|
|||||||
return $this->_metadataFactory;
|
return $this->_metadataFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the name of the EntityManager.
|
|
||||||
*
|
|
||||||
* @return string The name of the EntityManager.
|
|
||||||
*/
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return $this->_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts a transaction on the underlying connection.
|
* Starts a transaction on the underlying connection.
|
||||||
*/
|
*/
|
||||||
@ -540,7 +522,7 @@ class EntityManager
|
|||||||
private function _errorIfClosed()
|
private function _errorIfClosed()
|
||||||
{
|
{
|
||||||
if ($this->_closed) {
|
if ($this->_closed) {
|
||||||
throw EntityManagerException::notActiveOrClosed($this->_name);
|
throw EntityManagerException::notActiveOrClosed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -602,9 +584,6 @@ class EntityManager
|
|||||||
/**
|
/**
|
||||||
* Factory method to create EntityManager instances.
|
* Factory method to create EntityManager instances.
|
||||||
*
|
*
|
||||||
* A newly created EntityManager is immediately activated, making it the
|
|
||||||
* currently active EntityManager.
|
|
||||||
*
|
|
||||||
* @param mixed $conn An array with the connection parameters or an existing
|
* @param mixed $conn An array with the connection parameters or an existing
|
||||||
* Connection instance.
|
* Connection instance.
|
||||||
* @param string $name The name of the EntityManager.
|
* @param string $name The name of the EntityManager.
|
||||||
@ -612,8 +591,7 @@ class EntityManager
|
|||||||
* @param EventManager $eventManager The EventManager instance to use.
|
* @param EventManager $eventManager The EventManager instance to use.
|
||||||
* @return EntityManager The created EntityManager.
|
* @return EntityManager The created EntityManager.
|
||||||
*/
|
*/
|
||||||
public static function create($conn, $name, Configuration $config = null,
|
public static function create($conn, Configuration $config = null, EventManager $eventManager = null)
|
||||||
EventManager $eventManager = null)
|
|
||||||
{
|
{
|
||||||
if (is_array($conn)) {
|
if (is_array($conn)) {
|
||||||
$conn = \Doctrine\DBAL\DriverManager::getConnection($conn, $config, $eventManager);
|
$conn = \Doctrine\DBAL\DriverManager::getConnection($conn, $config, $eventManager);
|
||||||
@ -628,7 +606,7 @@ class EntityManager
|
|||||||
$eventManager = new EventManager();
|
$eventManager = new EventManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
$em = new EntityManager($conn, $name, $config, $eventManager);
|
$em = new EntityManager($conn, $config, $eventManager);
|
||||||
|
|
||||||
return $em;
|
return $em;
|
||||||
}
|
}
|
||||||
|
@ -58,8 +58,8 @@ class EntityManagerMock extends \Doctrine\ORM\EntityManager
|
|||||||
* @param Doctrine_EventManager $eventManager
|
* @param Doctrine_EventManager $eventManager
|
||||||
* @return Doctrine\ORM\EntityManager
|
* @return Doctrine\ORM\EntityManager
|
||||||
*/
|
*/
|
||||||
public static function create($conn, $name, \Doctrine\ORM\Configuration $config = null,
|
public static function create($conn, \Doctrine\ORM\Configuration $config = null,
|
||||||
Doctrine_Common_EventManager $eventManager = null)
|
\Doctrine\Common\EventManager $eventManager = null)
|
||||||
{
|
{
|
||||||
if (is_null($config)) {
|
if (is_null($config)) {
|
||||||
$config = new \Doctrine\ORM\Configuration();
|
$config = new \Doctrine\ORM\Configuration();
|
||||||
@ -68,7 +68,7 @@ class EntityManagerMock extends \Doctrine\ORM\EntityManager
|
|||||||
$eventManager = new \Doctrine\Common\EventManager();
|
$eventManager = new \Doctrine\Common\EventManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new EntityManagerMock($conn, $name, $config, $eventManager);
|
return new EntityManagerMock($conn, $config, $eventManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setIdGenerator($className, $generator)
|
public function setIdGenerator($className, $generator)
|
||||||
|
@ -12,11 +12,6 @@ use Doctrine\Tests\Models\Forum\ForumAvatar;
|
|||||||
|
|
||||||
require_once __DIR__ . '/../TestInit.php';
|
require_once __DIR__ . '/../TestInit.php';
|
||||||
|
|
||||||
#require_once 'lib/mocks/Doctrine_EntityManagerMock.php';
|
|
||||||
#require_once 'lib/mocks/Doctrine_ConnectionMock.php';
|
|
||||||
#require_once 'lib/mocks/Doctrine_ClassMetadataMock.php';
|
|
||||||
#require_once 'lib/mocks/Doctrine_UnitOfWorkMock.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EntityPersister tests.
|
* EntityPersister tests.
|
||||||
*/
|
*/
|
||||||
@ -30,7 +25,7 @@ class EntityPersisterTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->_connMock = new ConnectionMock(array());
|
$this->_connMock = new ConnectionMock(array());
|
||||||
$this->_emMock = EntityManagerMock::create($this->_connMock, 'persisterMockEM');
|
$this->_emMock = EntityManagerMock::create($this->_connMock);
|
||||||
$this->_uowMock = new UnitOfWorkMock($this->_emMock);
|
$this->_uowMock = new UnitOfWorkMock($this->_emMock);
|
||||||
$this->_emMock->setUnitOfWork($this->_uowMock);
|
$this->_emMock->setUnitOfWork($this->_uowMock);
|
||||||
$this->_idGenMock = new SequenceMock($this->_emMock);
|
$this->_idGenMock = new SequenceMock($this->_emMock);
|
||||||
|
@ -28,7 +28,7 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->_connectionMock = new ConnectionMock(array());
|
$this->_connectionMock = new ConnectionMock(array());
|
||||||
$this->_emMock = EntityManagerMock::create($this->_connectionMock, "uowMockEm");
|
$this->_emMock = EntityManagerMock::create($this->_connectionMock);
|
||||||
// SUT
|
// SUT
|
||||||
$this->_unitOfWork = new UnitOfWorkMock($this->_emMock);
|
$this->_unitOfWork = new UnitOfWorkMock($this->_emMock);
|
||||||
$this->_emMock->setUnitOfWork($this->_unitOfWork);
|
$this->_emMock->setUnitOfWork($this->_unitOfWork);
|
||||||
|
@ -135,6 +135,6 @@ class OrmFunctionalTestCase extends OrmTestCase
|
|||||||
$config->setMetadataCacheImpl(self::$_metadataCacheImpl);
|
$config->setMetadataCacheImpl(self::$_metadataCacheImpl);
|
||||||
$eventManager = new \Doctrine\Common\EventManager();
|
$eventManager = new \Doctrine\Common\EventManager();
|
||||||
$conn = $this->sharedFixture['conn'];
|
$conn = $this->sharedFixture['conn'];
|
||||||
return \Doctrine\ORM\EntityManager::create($conn, 'em', $config, $eventManager);
|
return \Doctrine\ORM\EntityManager::create($conn, $config, $eventManager);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -26,7 +26,7 @@ class OrmTestCase extends DoctrineTestCase
|
|||||||
'user' => 'john',
|
'user' => 'john',
|
||||||
'password' => 'wayne'
|
'password' => 'wayne'
|
||||||
);
|
);
|
||||||
return \Doctrine\ORM\EntityManager::create($connectionOptions, 'mockEM', $config, $eventManager);
|
return \Doctrine\ORM\EntityManager::create($connectionOptions, $config, $eventManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function getSharedMetadataCacheImpl()
|
private static function getSharedMetadataCacheImpl()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user