Chris@0: This document details all the possible changes that you should investigate when updating Chris@0: your project from Doctrine Common 2.0.x to 2.1 Chris@0: Chris@0: ## AnnotationReader changes Chris@0: Chris@0: The annotation reader was heavily refactored between 2.0 and 2.1-RC1. In theory the operation of the new reader should be backwards compatible, but it has to be setup differently to work that way: Chris@0: Chris@0: $reader = new \Doctrine\Common\Annotations\AnnotationReader(); Chris@0: $reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\'); Chris@0: // new code necessary starting here Chris@0: $reader->setIgnoreNotImportedAnnotations(true); Chris@0: $reader->setEnableParsePhpImports(false); Chris@0: $reader = new \Doctrine\Common\Annotations\CachedReader( Chris@0: new \Doctrine\Common\Annotations\IndexedReader($reader), new ArrayCache() Chris@0: ); Chris@0: Chris@0: ## Annotation Base class or @Annotation Chris@0: Chris@0: 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. Chris@0: Chris@0: ## Removed methods on AnnotationReader Chris@0: Chris@0: * AnnotationReader::setAutoloadAnnotations() Chris@0: * AnnotationReader::getAutoloadAnnotations() Chris@0: * AnnotationReader::isAutoloadAnnotations() Chris@0: Chris@0: ## AnnotationRegistry Chris@0: Chris@0: Autoloading through the PHP autoloader is removed from the 2.1 AnnotationReader. Instead you have to use the global AnnotationRegistry for loading purposes: Chris@0: Chris@0: \Doctrine\Common\Annotations\AnnotationRegistry::registerFile($fileWithAnnotations); Chris@0: \Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace($namespace, $dirs = null); Chris@0: \Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespaces($namespaces); Chris@0: \Doctrine\Common\Annotations\AnnotationRegistry::registerLoader($callable); Chris@0: Chris@0: 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. Chris@0: The registerAutoloadNamespace function registers a PSR-0 compatible silent autoloader for all classes with the given namespace in the given directories. Chris@0: If null is passed as directory the include path will be used. Chris@0: