Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Moved the check on mapped superclasses to an dedicated method

The previous logic was specific to the ORM and could not be reused for
the MongoDB ODM.
  • Loading branch information...
commit c6a01cc34ec3907a797cd89a3af56e07f4fee66e 1 parent d2f8a36
@stof stof authored
View
14 lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php
@@ -158,6 +158,16 @@ public function getAllMetadata()
abstract protected function initializeReflection(ClassMetadata $class, ReflectionService $reflService);
/**
+ * Checks whether the class metadata is an entity.
+ *
+ * this method should
+ *
+ * @param ClassMetadata $class
+ * @return boolean
+ */
+ abstract protected function isEntity(ClassMetadata $class);
+
+ /**
* Gets the class metadata descriptor for a class.
*
* @param string $className The name of the class.
@@ -278,7 +288,7 @@ protected function loadMetadata($name)
foreach ($parentClasses as $className) {
if (isset($this->loadedMetadata[$className])) {
$parent = $this->loadedMetadata[$className];
- if (isset($parent->isMappedSuperclass) && $parent->isMappedSuperclass === false) {
+ if ($this->isEntity($parent)) {
$rootEntityFound = true;
array_unshift($visited, $className);
}
@@ -294,7 +304,7 @@ protected function loadMetadata($name)
$parent = $class;
- if (isset($parent->isMappedSuperclass) && $class->isMappedSuperclass === false) {
+ if ($this->isEntity($class)) {
$rootEntityFound = true;
array_unshift($visited, $className);
}
View
5 tests/Doctrine/Tests/Common/Persistence/Mapping/ClassMetadataFactoryTest.php
@@ -121,6 +121,11 @@ protected function wakeupReflection(ClassMetadata $class, ReflectionService $ref
protected function initializeReflection(ClassMetadata $class, ReflectionService $reflService)
{
}
+
+ protected function isEntity(ClassMetadata $class)
+ {
+ return isset($class->isMappedSuperclass) && $class->isMappedSuperclass === false;
+ }
}
class RootEntity

0 comments on commit c6a01cc

Please sign in to comment.
Something went wrong with that request. Please try again.