1
0
mirror of synced 2024-12-05 03:06:05 +03:00

Updating upgrade docs and fixes suggested by @beberlei

This commit is contained in:
Marco Pivetta 2012-07-08 15:16:35 +02:00
parent 86dbddd596
commit fc00d5f39f
2 changed files with 17 additions and 9 deletions

View File

@ -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

View File

@ -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);
}