Reverting to default annotation driver with - delayed to 3.0
This commit is contained in:
parent
245d906ebf
commit
346e34adf6
28
UPGRADE.md
28
UPGRADE.md
@ -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
|
||||
|
@ -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');
|
||||
|
||||
|
@ -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));
|
||||
|
@ -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'),
|
||||
|
Loading…
Reference in New Issue
Block a user