Commit 32d43c36 authored by romanb's avatar romanb

Removed 'name' attribute from EntityManager since it's not needed.

parent 2ef81cf2
......@@ -59,13 +59,6 @@ class EntityManager
*/
const FLUSHMODE_MANUAL = 'manual';
/**
* The unique name of the EntityManager.
*
* @var string
*/
private $_name;
/**
* The used Configuration.
*
......@@ -143,10 +136,9 @@ class EntityManager
* @param Doctrine\ORM\Configuration $config
* @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->_name = $name;
$this->_config = $config;
$this->_eventManager = $eventManager;
$this->_metadataFactory = new ClassMetadataFactory(
......@@ -176,16 +168,6 @@ class EntityManager
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.
*/
......@@ -540,7 +522,7 @@ class EntityManager
private function _errorIfClosed()
{
if ($this->_closed) {
throw EntityManagerException::notActiveOrClosed($this->_name);
throw EntityManagerException::notActiveOrClosed();
}
}
......@@ -602,9 +584,6 @@ class EntityManager
/**
* 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
* Connection instance.
* @param string $name The name of the EntityManager.
......@@ -612,8 +591,7 @@ class EntityManager
* @param EventManager $eventManager The EventManager instance to use.
* @return EntityManager The created EntityManager.
*/
public static function create($conn, $name, Configuration $config = null,
EventManager $eventManager = null)
public static function create($conn, Configuration $config = null, EventManager $eventManager = null)
{
if (is_array($conn)) {
$conn = \Doctrine\DBAL\DriverManager::getConnection($conn, $config, $eventManager);
......@@ -628,7 +606,7 @@ class EntityManager
$eventManager = new EventManager();
}
$em = new EntityManager($conn, $name, $config, $eventManager);
$em = new EntityManager($conn, $config, $eventManager);
return $em;
}
......
......@@ -58,8 +58,8 @@ class EntityManagerMock extends \Doctrine\ORM\EntityManager
* @param Doctrine_EventManager $eventManager
* @return Doctrine\ORM\EntityManager
*/
public static function create($conn, $name, \Doctrine\ORM\Configuration $config = null,
Doctrine_Common_EventManager $eventManager = null)
public static function create($conn, \Doctrine\ORM\Configuration $config = null,
\Doctrine\Common\EventManager $eventManager = null)
{
if (is_null($config)) {
$config = new \Doctrine\ORM\Configuration();
......@@ -68,7 +68,7 @@ class EntityManagerMock extends \Doctrine\ORM\EntityManager
$eventManager = new \Doctrine\Common\EventManager();
}
return new EntityManagerMock($conn, $name, $config, $eventManager);
return new EntityManagerMock($conn, $config, $eventManager);
}
public function setIdGenerator($className, $generator)
......
......@@ -12,11 +12,6 @@ use Doctrine\Tests\Models\Forum\ForumAvatar;
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.
*/
......@@ -30,7 +25,7 @@ class EntityPersisterTest extends \Doctrine\Tests\OrmTestCase
protected function setUp() {
parent::setUp();
$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->_emMock->setUnitOfWork($this->_uowMock);
$this->_idGenMock = new SequenceMock($this->_emMock);
......
......@@ -28,7 +28,7 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase
protected function setUp() {
parent::setUp();
$this->_connectionMock = new ConnectionMock(array());
$this->_emMock = EntityManagerMock::create($this->_connectionMock, "uowMockEm");
$this->_emMock = EntityManagerMock::create($this->_connectionMock);
// SUT
$this->_unitOfWork = new UnitOfWorkMock($this->_emMock);
$this->_emMock->setUnitOfWork($this->_unitOfWork);
......
......@@ -135,6 +135,6 @@ class OrmFunctionalTestCase extends OrmTestCase
$config->setMetadataCacheImpl(self::$_metadataCacheImpl);
$eventManager = new \Doctrine\Common\EventManager();
$conn = $this->sharedFixture['conn'];
return \Doctrine\ORM\EntityManager::create($conn, 'em', $config, $eventManager);
return \Doctrine\ORM\EntityManager::create($conn, $config, $eventManager);
}
}
\ No newline at end of file
......@@ -26,7 +26,7 @@ class OrmTestCase extends DoctrineTestCase
'user' => 'john',
'password' => 'wayne'
);
return \Doctrine\ORM\EntityManager::create($connectionOptions, 'mockEM', $config, $eventManager);
return \Doctrine\ORM\EntityManager::create($connectionOptions, $config, $eventManager);
}
private static function getSharedMetadataCacheImpl()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment