From d4e554fb44d12f8f411b41db09fdcab336f5a0e0 Mon Sep 17 00:00:00 2001 From: romanb Date: Fri, 12 Sep 2008 17:39:39 +0000 Subject: [PATCH] moved classmetadata & co --- lib/Doctrine/ORM/EntityManager.php | 4 ++-- lib/Doctrine/{ => ORM/Mapping}/ClassMetadata.php | 2 +- .../Factory.php => ORM/Mapping/ClassMetadataFactory.php} | 8 ++++---- .../{ClassMetadata => ORM/Mapping/Driver}/CodeDriver.php | 4 ++-- .../{ClassMetadata => ORM/Mapping/Driver}/YamlDriver.php | 4 ++-- lib/Doctrine/{ClassMetadata => ORM/Mapping}/Exception.php | 0 lib/Doctrine/ORM/Persisters/AbstractEntityPersister.php | 2 +- tests/Orm/Query/IdentifierRecognitionTest.php | 4 ++-- tests/lib/mocks/Doctrine_ClassMetadataMock.php | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) rename lib/Doctrine/{ => ORM/Mapping}/ClassMetadata.php (99%) rename lib/Doctrine/{ClassMetadata/Factory.php => ORM/Mapping/ClassMetadataFactory.php} (95%) rename lib/Doctrine/{ClassMetadata => ORM/Mapping/Driver}/CodeDriver.php (93%) rename lib/Doctrine/{ClassMetadata => ORM/Mapping/Driver}/YamlDriver.php (61%) rename lib/Doctrine/{ClassMetadata => ORM/Mapping}/Exception.php (100%) diff --git a/lib/Doctrine/ORM/EntityManager.php b/lib/Doctrine/ORM/EntityManager.php index 1456565f5..7c31f9cc9 100644 --- a/lib/Doctrine/ORM/EntityManager.php +++ b/lib/Doctrine/ORM/EntityManager.php @@ -155,8 +155,8 @@ class Doctrine_ORM_EntityManager $this->_name = $name; $this->_config = $config; $this->_eventManager = $eventManager; - $this->_metadataFactory = new Doctrine_ClassMetadata_Factory( - $this, new Doctrine_ClassMetadata_CodeDriver()); + $this->_metadataFactory = new Doctrine_ORM_Mapping_ClassMetadataFactory( + $this, new Doctrine_ORM_Mapping_Driver_CodeDriver()); $this->_unitOfWork = new Doctrine_ORM_UnitOfWork($this); $this->_nullObject = Doctrine_ORM_Internal_Null::$INSTANCE; } diff --git a/lib/Doctrine/ClassMetadata.php b/lib/Doctrine/ORM/Mapping/ClassMetadata.php similarity index 99% rename from lib/Doctrine/ClassMetadata.php rename to lib/Doctrine/ORM/Mapping/ClassMetadata.php index 81966e37a..1b4791e9b 100644 --- a/lib/Doctrine/ClassMetadata.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadata.php @@ -32,7 +32,7 @@ * @since 2.0 * @todo Rename to ClassDescriptor. */ -class Doctrine_ClassMetadata implements Doctrine_Common_Configurable, Serializable +class Doctrine_ORM_Mapping_ClassMetadata implements Doctrine_Common_Configurable, Serializable { /* The inheritance mapping types */ /** diff --git a/lib/Doctrine/ClassMetadata/Factory.php b/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php similarity index 95% rename from lib/Doctrine/ClassMetadata/Factory.php rename to lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php index 9ee5bd972..82223ea1c 100644 --- a/lib/Doctrine/ClassMetadata/Factory.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php @@ -33,7 +33,7 @@ * @since 2.0 * @todo Rename to ClassDescriptorFactory. */ -class Doctrine_ClassMetadata_Factory +class Doctrine_ORM_Mapping_ClassMetadataFactory { protected $_em; protected $_driver; @@ -102,7 +102,7 @@ class Doctrine_ClassMetadata_Factory $class = $classes[$loadedParentClass]; } else { $rootClassOfHierarchy = count($parentClasses) > 0 ? array_shift($parentClasses) : $name; - $class = new Doctrine_ClassMetadata($rootClassOfHierarchy, $this->_em); + $class = new Doctrine_ORM_Mapping_ClassMetadata($rootClassOfHierarchy, $this->_em); $this->_loadMetadata($class, $rootClassOfHierarchy); $classes[$rootClassOfHierarchy] = $class; } @@ -117,7 +117,7 @@ class Doctrine_ClassMetadata_Factory // Move down the hierarchy of parent classes, starting from the topmost class $parent = $class; foreach ($parentClasses as $subclassName) { - $subClass = new Doctrine_ClassMetadata($subclassName, $this->_em); + $subClass = new Doctrine_ORM_Mapping_ClassMetadata($subclassName, $this->_em); $subClass->setInheritanceType($parent->getInheritanceType(), $parent->getInheritanceOptions()); $this->_addInheritedFields($subClass, $parent); $this->_addInheritedRelations($subClass, $parent); @@ -166,7 +166,7 @@ class Doctrine_ClassMetadata_Factory * @param Doctrine_ClassMetadata $class The container for the metadata. * @param string $name The name of the class for which the metadata will be loaded. */ - protected function _loadMetadata(Doctrine_ClassMetadata $class, $name) + protected function _loadMetadata(Doctrine_ORM_Mapping_ClassMetadata $class, $name) { if ( ! class_exists($name) || empty($name)) { throw new Doctrine_Exception("Couldn't find class " . $name . "."); diff --git a/lib/Doctrine/ClassMetadata/CodeDriver.php b/lib/Doctrine/ORM/Mapping/Driver/CodeDriver.php similarity index 93% rename from lib/Doctrine/ClassMetadata/CodeDriver.php rename to lib/Doctrine/ORM/Mapping/Driver/CodeDriver.php index 46e440f83..53989c9f8 100644 --- a/lib/Doctrine/ClassMetadata/CodeDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/CodeDriver.php @@ -32,7 +32,7 @@ * @link www.phpdoctrine.org * @since 2.0 */ -class Doctrine_ClassMetadata_CodeDriver +class Doctrine_ORM_Mapping_Driver_CodeDriver { /** * Name of the callback method. @@ -44,7 +44,7 @@ class Doctrine_ClassMetadata_CodeDriver /** * Loads the metadata for the specified class into the provided container. */ - public function loadMetadataForClass($className, Doctrine_ClassMetadata $metadata) + public function loadMetadataForClass($className, Doctrine_ORM_Mapping_ClassMetadata $metadata) { if ( ! method_exists($className, self::CALLBACK_METHOD)) { throw new Doctrine_ClassMetadata_Exception("Unable to load metadata for class" diff --git a/lib/Doctrine/ClassMetadata/YamlDriver.php b/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php similarity index 61% rename from lib/Doctrine/ClassMetadata/YamlDriver.php rename to lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php index e9549213e..ec8a19650 100644 --- a/lib/Doctrine/ClassMetadata/YamlDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php @@ -4,12 +4,12 @@ * The yaml driver loads metadata informations about classes from .yml files. * */ -class Doctrine_ClassMetadata_YamlDriver +class Doctrine_ORM_Mapping_Driver_YamlDriver { /** * */ - public function loadMetadataForClass($className, Doctrine_ClassMetadata $metadata) + public function loadMetadataForClass($className, Doctrine_ORM_Mapping_ClassMetadata $metadata) { throw new Doctrine_ClassMetadata_Exception("YAML driver not yet implemented."); } diff --git a/lib/Doctrine/ClassMetadata/Exception.php b/lib/Doctrine/ORM/Mapping/Exception.php similarity index 100% rename from lib/Doctrine/ClassMetadata/Exception.php rename to lib/Doctrine/ORM/Mapping/Exception.php diff --git a/lib/Doctrine/ORM/Persisters/AbstractEntityPersister.php b/lib/Doctrine/ORM/Persisters/AbstractEntityPersister.php index 1c5d36aec..a7d48d595 100644 --- a/lib/Doctrine/ORM/Persisters/AbstractEntityPersister.php +++ b/lib/Doctrine/ORM/Persisters/AbstractEntityPersister.php @@ -74,7 +74,7 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister /** * Constructs a new EntityPersister. */ - public function __construct(Doctrine_ORM_EntityManager $em, Doctrine_ClassMetadata $classMetadata) + public function __construct(Doctrine_ORM_EntityManager $em, Doctrine_ORM_Mapping_ClassMetadata $classMetadata) { $this->_em = $em; $this->_entityName = $classMetadata->getClassName(); diff --git a/tests/Orm/Query/IdentifierRecognitionTest.php b/tests/Orm/Query/IdentifierRecognitionTest.php index 051b2dd91..9fd4c3285 100755 --- a/tests/Orm/Query/IdentifierRecognitionTest.php +++ b/tests/Orm/Query/IdentifierRecognitionTest.php @@ -45,7 +45,7 @@ class Orm_Query_IdentifierRecognitionTest extends Doctrine_OrmTestCase $decl = $parserResult->getQueryComponent('u'); - $this->assertTrue($decl['metadata'] instanceof Doctrine_ClassMetadata); + $this->assertTrue($decl['metadata'] instanceof Doctrine_ORM_Mapping_ClassMetadata); $this->assertEquals(null, $decl['relation']); $this->assertEquals(null, $decl['parent']); $this->assertEquals(null, $decl['scalar']); @@ -60,7 +60,7 @@ class Orm_Query_IdentifierRecognitionTest extends Doctrine_OrmTestCase $decl = $parserResult->getQueryComponent('u'); - $this->assertTrue($decl['metadata'] instanceof Doctrine_ClassMetadata); + $this->assertTrue($decl['metadata'] instanceof Doctrine_ORM_Mapping_ClassMetadata); $this->assertEquals(null, $decl['relation']); $this->assertEquals(null, $decl['parent']); $this->assertEquals(null, $decl['scalar']); diff --git a/tests/lib/mocks/Doctrine_ClassMetadataMock.php b/tests/lib/mocks/Doctrine_ClassMetadataMock.php index 1569a2ad9..f580ae970 100644 --- a/tests/lib/mocks/Doctrine_ClassMetadataMock.php +++ b/tests/lib/mocks/Doctrine_ClassMetadataMock.php @@ -1,6 +1,6 @@