diff --git a/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php b/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php index b7562ad52..f00ca3e0d 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php @@ -60,8 +60,12 @@ class AnnotationDriver extends AbstractAnnotationDriver $classAnnotations = $this->reader->getClassAnnotations($class); - if ($classAnnotations && is_numeric(key($classAnnotations))) { - foreach ($classAnnotations as $annot) { + if ($classAnnotations) { + foreach ($classAnnotations as $key => $annot) { + if ( ! is_numeric($key)) { + continue; + } + $classAnnotations[get_class($annot)] = $annot; } } @@ -456,8 +460,11 @@ class AnnotationDriver extends AbstractAnnotationDriver if ($method->isPublic() && $method->getDeclaringClass()->getName() == $class->name) { $annotations = $this->reader->getMethodAnnotations($method); - if ($annotations && is_numeric(key($annotations))) { - foreach ($annotations as $annot) { + if ($annotations) { + foreach ($annotations as $key => $annot) { + if ( ! is_numeric($key)) { + continue; + } $annotations[get_class($annot)] = $annot; } }