Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated UPGRADE_TO_2_1 and fixed some code

  • Loading branch information...
commit de73b8aeb2f8f157ddd9a05f219b1b9da3d5f78b 1 parent fea0871
@beberlei beberlei authored
View
22 UPGRADE_TO_2_1
@@ -16,4 +16,24 @@ The annotation reader was heavily refactored between 2.0 and 2.1-RC1. In theory
## Annotation Base class or @Annotation
-Beginning after 2.1-RC2 you have to either extend ``Doctrine\Common\Annotations\Annotation`` or add @Annotation to your annotations class-level docblock, otherwise you will get an exception.
+Beginning after 2.1-RC2 you have to either extend ``Doctrine\Common\Annotations\Annotation`` or add @Annotation to your annotations class-level docblock, otherwise the class will simply be ignored.
+
+## Removed methods on AnnotationReader
+
+* AnnotationReader::setAutoloadAnnotations()
+* AnnotationReader::getAutoloadAnnotations()
+* AnnotationReader::isAutoloadAnnotations()
+
+## AnnotationRegistry
+
+Autoloading through the PHP autoloader is removed from the 2.1 AnnotationReader. Instead you have to use the global AnnotationRegistry for loading purposes:
+
+ \Doctrine\Common\Annotations\AnnotationRegistry::registerFile($fileWithAnnotations);
+ \Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace($namespace, $dirs = null);
+ \Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespaces($namespaces);
+ \Doctrine\Common\Annotations\AnnotationRegistry::registerLoader($callable);
+
+The $callable for registering a loader accepts a class as first and only parameter and must try to silently autoload it. On success true has to be returned.
+The registerAutoloadNamespace function registers a PSR-0 compatible silent autoloader for all classes with the given namespace in the given directories.
+If null is passed as directory the include path will be used.
+
View
8 lib/Doctrine/Common/Annotations/AnnotationRegistry.php
@@ -109,11 +109,9 @@ static public function loadAnnotationClass($class)
return true;
}
} else {
- foreach((array)$dirs AS $dir) {
- if (file_exists($dir . DIRECTORY_SEPARATOR . $file)) {
- require $dir . DIRECTORY_SEPARATOR . $file;
- return true;
- }
+ if ($path = stream_resolve_include_path($file)) {
+ require $path;
+ return true;
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.