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

Reverting to default annotation driver with - delayed to 3.0

This commit is contained in:
Marco Pivetta 2012-07-08 17:33:50 +02:00
parent 245d906ebf
commit 346e34adf6
4 changed files with 4 additions and 32 deletions

View File

@ -1,33 +1,5 @@
# Upgrade to 2.3
## Configuration *BC Break*
The default annotation syntax has been changed from `@Entity` to `@ORM\Entity`. If you still want to use the simplified
version, you should use `Doctrine\Common\Annotations\SimpleAnnotationReader` for your AnnotationDriver or call
`Doctrine\ORM\Configuration#newDefaultAnnotationDriver` with its second parameter set to `true`.
* before:
```php
<?php
/** @Entity */
class MyEntity
{
}
```
* after:
```php
<?php
use Doctrine\ORM\Mapping as ORM;
/** @ORM\Entity */
class MyEntity
{
}
```
## EntityGenerator add*() method generation
When generating an add*() method for a collection the EntityGenerator will now not

View File

@ -133,7 +133,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
* @param bool $useSimpleAnnotationReader
* @return AnnotationDriver
*/
public function newDefaultAnnotationDriver($paths = array(), $useSimpleAnnotationReader = false)
public function newDefaultAnnotationDriver($paths = array(), $useSimpleAnnotationReader = true)
{
AnnotationRegistry::registerFile(__DIR__ . '/Mapping/Driver/DoctrineAnnotations.php');

View File

@ -114,7 +114,7 @@ class Setup
* @param bool $useSimpleAnnotationReader
* @return Configuration
*/
static public function createAnnotationMetadataConfiguration(array $paths, $isDevMode = false, $proxyDir = null, Cache $cache = null, $useSimpleAnnotationReader = false)
static public function createAnnotationMetadataConfiguration(array $paths, $isDevMode = false, $proxyDir = null, Cache $cache = null, $useSimpleAnnotationReader = true)
{
$config = self::createConfiguration($isDevMode, $proxyDir, $cache);
$config->setMetadataDriverImpl($config->newDefaultAnnotationDriver($paths, $useSimpleAnnotationReader));

View File

@ -65,7 +65,7 @@ class ConfigurationTest extends PHPUnit_Framework_TestCase
$paths = array(__DIR__);
$reflectionClass = new ReflectionClass(__NAMESPACE__ . '\ConfigurationTestAnnotationReaderChecker');
$annotationDriver = $this->configuration->newDefaultAnnotationDriver($paths);
$annotationDriver = $this->configuration->newDefaultAnnotationDriver($paths, false);
$reader = $annotationDriver->getReader();
$annotation = $reader->getMethodAnnotation(
$reflectionClass->getMethod('namespacedAnnotationMethod'),
@ -73,7 +73,7 @@ class ConfigurationTest extends PHPUnit_Framework_TestCase
);
$this->assertInstanceOf('Doctrine\ORM\Mapping\PrePersist', $annotation);
$annotationDriver = $this->configuration->newDefaultAnnotationDriver($paths, true);
$annotationDriver = $this->configuration->newDefaultAnnotationDriver($paths);
$reader = $annotationDriver->getReader();
$annotation = $reader->getMethodAnnotation(
$reflectionClass->getMethod('simpleAnnotationMethod'),