From fc00d5f39f336aad5d2faac43c9dd4e3fcece5fb Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Sun, 8 Jul 2012 15:16:35 +0200 Subject: [PATCH] Updating upgrade docs and fixes suggested by @beberlei --- UPGRADE.md | 15 +++++++++++---- lib/Doctrine/ORM/Configuration.php | 11 ++++++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index 803d3fa15..62b651e7c 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,5 +1,12 @@ # Upgrade to 2.3 +## Configuration + +`Doctrine\ORM\Configuration#newDefaultAnnotationDriver` has been changed to reflect latest changes in Doctrine\Common. +If you use it to have an AnnotationDriver configured with a SimpleAnnotationReader in your projects, you should from now +on call `newDefaultAnnotationDriver` with its second parameter set to `true`. Otherwise, the default consumed reader +will be the AnnotationReader, which uses the `@Namespace\AnnotationName` syntax. + ## EntityGenerator add*() method generation When generating an add*() method for a collection the EntityGenerator will now not @@ -315,7 +322,7 @@ the association. Example: private $user; //... } - + // SINCE BETA1 // User class DOES NOT CHANGE class Address @@ -325,7 +332,7 @@ the association. Example: private $user; //... } - + Thus, the inversedBy attribute is the counterpart to the mappedBy attribute. This change was necessary to enable some simplifications and further performance improvements. We apologize for the inconvenience. @@ -344,7 +351,7 @@ had a DQL query like this: [sql] SELECT u.id, u.name FROM User u - + Since BETA1, simple state field path expressions in the select clause are used to select object fields as plain scalar values (something that was not possible before). To achieve the same result as previously (that is, a partial object with only id and name populated) @@ -427,7 +434,7 @@ With new required method AbstractTask::buildDocumentation, its implementation de # Upgrade from 2.0-ALPHA2 to 2.0-ALPHA3 This section details the changes made to Doctrine 2.0-ALPHA3 to make it easier for you -to upgrade your projects to use this version. +to upgrade your projects to use this version. ## CLI Changes diff --git a/lib/Doctrine/ORM/Configuration.php b/lib/Doctrine/ORM/Configuration.php index 4a0c7c3ba..d2da10e30 100644 --- a/lib/Doctrine/ORM/Configuration.php +++ b/lib/Doctrine/ORM/Configuration.php @@ -126,22 +126,23 @@ class Configuration extends \Doctrine\DBAL\Configuration } /** - * Add a new default annotation driver with a correctly configured annotation reader. If $useDefaultNamespace is - * to true, the notation `@Entity` will work, otherwise, the notation `@ORM\Entity` will be supported. + * Add a new default annotation driver with a correctly configured annotation reader. If $useSimpleAnnotationReader + * is true, the notation `@Entity` will work, otherwise, the notation `@ORM\Entity` will be supported. * * @param array $paths - * @param bool $useDefaultNamespace + * @param bool $useSimpleAnnotationReader * @return AnnotationDriver */ - public function newDefaultAnnotationDriver($paths = array(), $useDefaultNamespace = false) + public function newDefaultAnnotationDriver($paths = array(), $useSimpleAnnotationReader = false) { AnnotationRegistry::registerFile(__DIR__ . '/Mapping/Driver/DoctrineAnnotations.php'); - if ($useDefaultNamespace) { + if ($useSimpleAnnotationReader) { // Register the ORM Annotations in the AnnotationRegistry $reader = new SimpleAnnotationReader(); $reader->addNamespace('Doctrine\ORM\Mapping'); $cachedReader = new CachedReader($reader, new ArrayCache()); + return new AnnotationDriver($cachedReader, (array) $paths); }