Commit 70c96548 authored by romanb's avatar romanb

moved entitymanager and entityrepository

parent e64e3349
...@@ -356,7 +356,7 @@ class Doctrine_ClassMetadata implements Doctrine_Common_Configurable, Serializab ...@@ -356,7 +356,7 @@ class Doctrine_ClassMetadata implements Doctrine_Common_Configurable, Serializab
* @param string $entityName Name of the entity class the metadata info is used for. * @param string $entityName Name of the entity class the metadata info is used for.
* @param Doctrine::ORM::Entitymanager $em * @param Doctrine::ORM::Entitymanager $em
*/ */
public function __construct($entityName, Doctrine_EntityManager $em) public function __construct($entityName, Doctrine_ORM_EntityManager $em)
{ {
$this->_entityName = $entityName; $this->_entityName = $entityName;
$this->_rootEntityName = $entityName; $this->_rootEntityName = $entityName;
......
...@@ -51,7 +51,7 @@ class Doctrine_ClassMetadata_Factory ...@@ -51,7 +51,7 @@ class Doctrine_ClassMetadata_Factory
* @param $conn The connection to use. * @param $conn The connection to use.
* @param $driver The metadata driver to use. * @param $driver The metadata driver to use.
*/ */
public function __construct(Doctrine_EntityManager $em, $driver) public function __construct(Doctrine_ORM_EntityManager $em, $driver)
{ {
$this->_em = $em; $this->_em = $em;
$this->_driver = $driver; $this->_driver = $driver;
......
...@@ -120,7 +120,7 @@ class Doctrine_Connection_UnitOfWork ...@@ -120,7 +120,7 @@ class Doctrine_Connection_UnitOfWork
* *
* @param Doctrine_EntityManager $em * @param Doctrine_EntityManager $em
*/ */
public function __construct(Doctrine_EntityManager $em) public function __construct(Doctrine_ORM_EntityManager $em)
{ {
$this->_em = $em; $this->_em = $em;
//TODO: any benefit with lazy init? //TODO: any benefit with lazy init?
......
...@@ -130,7 +130,7 @@ class Doctrine_ORM_Collection implements Countable, IteratorAggregate, Serializa ...@@ -130,7 +130,7 @@ class Doctrine_ORM_Collection implements Countable, IteratorAggregate, Serializa
public function __construct($entityBaseType, $keyField = null) public function __construct($entityBaseType, $keyField = null)
{ {
$this->_entityBaseType = $entityBaseType; $this->_entityBaseType = $entityBaseType;
$this->_em = Doctrine_EntityManager::getActiveEntityManager(); $this->_em = Doctrine_ORM_EntityManager::getActiveEntityManager();
if ($keyField !== null) { if ($keyField !== null) {
if ( ! $this->_em->getClassMetadata($entityBaseType)->hasField($keyField)) { if ( ! $this->_em->getClassMetadata($entityBaseType)->hasField($keyField)) {
...@@ -1018,7 +1018,7 @@ class Doctrine_ORM_Collection implements Countable, IteratorAggregate, Serializa ...@@ -1018,7 +1018,7 @@ class Doctrine_ORM_Collection implements Countable, IteratorAggregate, Serializa
*/ */
public function unserialize($serialized) public function unserialize($serialized)
{ {
$manager = Doctrine_EntityManager::getActiveEntityManager(); $manager = Doctrine_ORM_EntityManager::getActiveEntityManager();
$connection = $manager->getConnection(); $connection = $manager->getConnection();
$array = unserialize($serialized); $array = unserialize($serialized);
......
...@@ -204,7 +204,7 @@ abstract class Doctrine_ORM_Entity implements ArrayAccess, Serializable ...@@ -204,7 +204,7 @@ abstract class Doctrine_ORM_Entity implements ArrayAccess, Serializable
public function __construct() public function __construct()
{ {
$this->_entityName = get_class($this); $this->_entityName = get_class($this);
$this->_em = Doctrine_EntityManager::getActiveEntityManager(); $this->_em = Doctrine_ORM_EntityManager::getActiveEntityManager();
$this->_class = $this->_em->getClassMetadata($this->_entityName); $this->_class = $this->_em->getClassMetadata($this->_entityName);
$this->_oid = self::$_index++; $this->_oid = self::$_index++;
$this->_data = $this->_em->_getTmpEntityData(); $this->_data = $this->_em->_getTmpEntityData();
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
* @version $Revision$ * @version $Revision$
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
*/ */
class Doctrine_EntityManager class Doctrine_ORM_EntityManager
{ {
/** /**
* IMMEDIATE: Flush occurs automatically after each operation that issues database * IMMEDIATE: Flush occurs automatically after each operation that issues database
...@@ -498,7 +498,7 @@ class Doctrine_EntityManager ...@@ -498,7 +498,7 @@ class Doctrine_EntityManager
if ($customRepositoryClassName !== null) { if ($customRepositoryClassName !== null) {
$repository = new $customRepositoryClassName($entityName, $metadata); $repository = new $customRepositoryClassName($entityName, $metadata);
} else { } else {
$repository = new Doctrine_EntityRepository($entityName, $metadata); $repository = new Doctrine_ORM_EntityRepository($entityName, $metadata);
} }
$this->_repositories[$entityName] = $repository; $this->_repositories[$entityName] = $repository;
...@@ -715,7 +715,7 @@ class Doctrine_EntityManager ...@@ -715,7 +715,7 @@ class Doctrine_EntityManager
$eventManager = new Doctrine_Common_EventManager(); $eventManager = new Doctrine_Common_EventManager();
} }
$em = new Doctrine_EntityManager($conn, $name, $config, $eventManager); $em = new Doctrine_ORM_EntityManager($conn, $name, $config, $eventManager);
$em->activate(); $em->activate();
return $em; return $em;
......
...@@ -33,9 +33,8 @@ ...@@ -33,9 +33,8 @@
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision$
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @todo package:orm
*/ */
class Doctrine_EntityRepository class Doctrine_ORM_EntityRepository
{ {
protected $_entityName; protected $_entityName;
protected $_em; protected $_em;
......
...@@ -34,6 +34,4 @@ ...@@ -34,6 +34,4 @@
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
*/ */
class Doctrine_ORM_Exceptions_ORMException extends Doctrine_Common_Exceptions_DoctrineException class Doctrine_ORM_Exceptions_ORMException extends Doctrine_Common_Exceptions_DoctrineException
{ {}
}
...@@ -13,7 +13,7 @@ abstract class Doctrine_ORM_Id_AbstractIdGenerator ...@@ -13,7 +13,7 @@ abstract class Doctrine_ORM_Id_AbstractIdGenerator
protected $_em; protected $_em;
public function __construct(Doctrine_EntityManager $em) public function __construct(Doctrine_ORM_EntityManager $em)
{ {
$this->_em = $em; $this->_em = $em;
} }
......
...@@ -66,7 +66,7 @@ abstract class Doctrine_ORM_Internal_Hydration_AbstractHydrator ...@@ -66,7 +66,7 @@ abstract class Doctrine_ORM_Internal_Hydration_AbstractHydrator
* *
* @param Doctrine_Connection|null $connection * @param Doctrine_Connection|null $connection
*/ */
public function __construct(Doctrine_EntityManager $em) public function __construct(Doctrine_ORM_EntityManager $em)
{ {
$this->_em = $em; $this->_em = $em;
$this->_nullObject = Doctrine_ORM_Internal_Null::$INSTANCE; $this->_nullObject = Doctrine_ORM_Internal_Null::$INSTANCE;
......
...@@ -41,7 +41,7 @@ class Doctrine_ORM_Internal_Hydration_ObjectDriver ...@@ -41,7 +41,7 @@ class Doctrine_ORM_Internal_Hydration_ObjectDriver
/** The EntityManager */ /** The EntityManager */
private $_em; private $_em;
public function __construct(Doctrine_EntityManager $em) public function __construct(Doctrine_ORM_EntityManager $em)
{ {
$this->_nullObject = Doctrine_ORM_Internal_Null::$INSTANCE; $this->_nullObject = Doctrine_ORM_Internal_Null::$INSTANCE;
$this->_em = $em; $this->_em = $em;
......
...@@ -74,7 +74,7 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister ...@@ -74,7 +74,7 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister
/** /**
* Constructs a new EntityPersister. * Constructs a new EntityPersister.
*/ */
public function __construct(Doctrine_EntityManager $em, Doctrine_ClassMetadata $classMetadata) public function __construct(Doctrine_ORM_EntityManager $em, Doctrine_ClassMetadata $classMetadata)
{ {
$this->_em = $em; $this->_em = $em;
$this->_entityName = $classMetadata->getClassName(); $this->_entityName = $classMetadata->getClassName();
......
...@@ -93,7 +93,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract ...@@ -93,7 +93,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract
// End of Caching Stuff // End of Caching Stuff
public function __construct(Doctrine_EntityManager $entityManager) public function __construct(Doctrine_ORM_EntityManager $entityManager)
{ {
$this->_entityManager = $entityManager; $this->_entityManager = $entityManager;
$this->_hydrator = new Doctrine_ORM_Internal_Hydration_StandardHydrator($entityManager); $this->_hydrator = new Doctrine_ORM_Internal_Hydration_StandardHydrator($entityManager);
......
...@@ -42,7 +42,7 @@ abstract class Doctrine_Query_SqlBuilder ...@@ -42,7 +42,7 @@ abstract class Doctrine_Query_SqlBuilder
protected $_connection; protected $_connection;
public static function fromConnection(Doctrine_EntityManager $entityManager) public static function fromConnection(Doctrine_ORM_EntityManager $entityManager)
{ {
$connection = $entityManager->getConnection(); $connection = $entityManager->getConnection();
......
...@@ -22,7 +22,7 @@ class Doctrine_OrmTestCase extends Doctrine_TestCase ...@@ -22,7 +22,7 @@ class Doctrine_OrmTestCase extends Doctrine_TestCase
'user' => 'john', 'user' => 'john',
'password' => 'wayne' 'password' => 'wayne'
); );
$em = Doctrine_EntityManager::create($connectionOptions, 'mockEM', $config, $eventManager); $em = Doctrine_ORM_EntityManager::create($connectionOptions, 'mockEM', $config, $eventManager);
$this->_em = $em; $this->_em = $em;
} }
$this->_em->activate(); $this->_em->activate();
......
...@@ -17,7 +17,7 @@ class Doctrine_OrmTestSuite extends Doctrine_TestSuite ...@@ -17,7 +17,7 @@ class Doctrine_OrmTestSuite extends Doctrine_TestSuite
'user' => 'john', 'user' => 'john',
'password' => 'wayne' 'password' => 'wayne'
); );
$em = Doctrine_EntityManager::create($connectionOptions, 'mockEM', $config, $eventManager); $em = Doctrine_ORM_EntityManager::create($connectionOptions, 'mockEM', $config, $eventManager);
$this->sharedFixture['em'] = $em; $this->sharedFixture['em'] = $em;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require_once 'lib/mocks/Doctrine_EntityPersisterMock.php'; require_once 'lib/mocks/Doctrine_EntityPersisterMock.php';
class Doctrine_EntityManagerMock extends Doctrine_EntityManager class Doctrine_EntityManagerMock extends Doctrine_ORM_EntityManager
{ {
private $_persisterMock; private $_persisterMock;
......
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