Permalink
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...
1 parent d2f8a36 commit c6a01cc34ec3907a797cd89a3af56e07f4fee66e @stof stof committed Jul 6, 2012
@@ -157,6 +157,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.
*
@@ -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);
}
@@ -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.