Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 95c8189

Browse files
authored
Merge pull request #10098 from greg0ire/deprecate-annotations
2 parents de32d82 + f270348 commit 95c8189

4 files changed

Lines changed: 28 additions & 14 deletions

File tree

UPGRADE.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Upgrade to 2.14
22

3+
## Deprecated annotation mapping driver.
4+
5+
Please switch to one of the other mapping drivers. Native attributes which PHP
6+
supports since version 8.0 are probably your best option.
7+
38
## Deprecated `Doctrine\ORM\Proxy\Proxy` interface.
49

510
Use `Doctrine\Persistence\Proxy` instead to check whether proxies are initialized.
@@ -412,7 +417,7 @@ function foo(EntityManagerInterface $entityManager, callable $func) {
412417
if (method_exists($entityManager, 'wrapInTransaction')) {
413418
return $entityManager->wrapInTransaction($func);
414419
}
415-
420+
416421
return $entityManager->transactional($func);
417422
}
418423
```
@@ -478,7 +483,7 @@ implementation. To work around this:
478483
* As a quick workaround, you can lock the doctrine/cache dependency to work around this: `composer require doctrine/cache ^1.11`.
479484
Note that this is only recommended as a bandaid fix, as future versions of ORM will no longer work with doctrine/cache
480485
1.11.
481-
486+
482487
## Deprecated: doctrine/cache for metadata caching
483488

484489
The `Doctrine\ORM\Configuration#setMetadataCacheImpl()` method is deprecated and should no longer be used. Please use
@@ -503,12 +508,12 @@ Note that `toIterable()` yields results of the query, unlike `iterate()` which y
503508

504509
# Upgrade to 2.7
505510

506-
## Added `Doctrine\ORM\AbstractQuery#enableResultCache()` and `Doctrine\ORM\AbstractQuery#disableResultCache()` methods
511+
## Added `Doctrine\ORM\AbstractQuery#enableResultCache()` and `Doctrine\ORM\AbstractQuery#disableResultCache()` methods
507512

508513
Method `Doctrine\ORM\AbstractQuery#useResultCache()` which could be used for both enabling and disabling the cache
509-
(depending on passed flag) was split into two.
514+
(depending on passed flag) was split into two.
510515

511-
## Minor BC BREAK: paginator output walkers aren't be called anymore on sub-queries for queries without max results
516+
## Minor BC BREAK: paginator output walkers aren't be called anymore on sub-queries for queries without max results
512517

513518
To optimize DB interaction, `Doctrine\ORM\Tools\Pagination\Paginator` no longer fetches identifiers to be able to
514519
perform the pagination with join collections when max results isn't set in the query.
@@ -527,7 +532,7 @@ In the last patch of the `v2.6.x` series, we fixed a bug that was not converting
527532
In order to not break BC we've introduced a way to enable the fixed behavior using a boolean constructor argument. This
528533
argument will be removed in 3.0 and the default behavior will be the fixed one.
529534

530-
## Deprecated: `Doctrine\ORM\AbstractQuery#useResultCache()`
535+
## Deprecated: `Doctrine\ORM\AbstractQuery#useResultCache()`
531536

532537
Method `Doctrine\ORM\AbstractQuery#useResultCache()` is deprecated because it is split into `enableResultCache()`
533538
and `disableResultCache()`. It will be removed in 3.0.
@@ -557,7 +562,7 @@ These related classes have been deprecated:
557562

558563
* `Doctrine\ORM\Proxy\ProxyFactory`
559564
* `Doctrine\ORM\Proxy\Autoloader` - we suggest using the composer autoloader instead
560-
565+
561566
These methods have been deprecated:
562567

563568
* `Doctrine\ORM\Configuration#getAutoGenerateProxyClasses()`
@@ -606,7 +611,7 @@ If your code relies on single entity flushing optimisations via
606611

607612
Said API was affected by multiple data integrity bugs due to the fact
608613
that change tracking was being restricted upon a subset of the managed
609-
entities. The ORM cannot support committing subsets of the managed
614+
entities. The ORM cannot support committing subsets of the managed
610615
entities while also guaranteeing data integrity, therefore this
611616
utility was removed.
612617

@@ -707,8 +712,8 @@ either:
707712
- map those classes as `MappedSuperclass`
708713

709714
## Minor BC BREAK: ``EntityManagerInterface`` instead of ``EntityManager`` in type-hints
710-
711-
As of 2.5, classes requiring the ``EntityManager`` in any method signature will now require
715+
716+
As of 2.5, classes requiring the ``EntityManager`` in any method signature will now require
712717
an ``EntityManagerInterface`` instead.
713718
If you are extending any of the following classes, then you need to check following
714719
signatures:
@@ -801,7 +806,7 @@ the `Doctrine\ORM\Repository\DefaultRepositoryFactory`.
801806
When executing DQL queries with new object expressions, instead of returning DTOs numerically indexes, it will now respect user provided aliases. Consider the following query:
802807

803808
SELECT new UserDTO(u.id,u.name) as user,new AddressDTO(a.street,a.postalCode) as address, a.id as addressId FROM User u INNER JOIN u.addresses a WITH a.isPrimary = true
804-
809+
805810
Previously, your result would be similar to this:
806811

807812
array(

docs/en/reference/annotations-reference.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Annotations Reference
22
=====================
33

4+
.. warning::
5+
The annotation driver is deprecated and will be removed in version
6+
3.0. It is strongly recommended to switch to one of the other
7+
mapping drivers.
8+
49
.. note::
510

611
To be able to use annotations, you will have to install an extra
@@ -124,7 +129,7 @@ Optional attributes:
124129
- **nullable**: Determines if NULL values allowed for this column. If not specified, default value is false.
125130

126131
- **insertable**: Boolean value to determine if the column should be
127-
included when inserting a new row into the underlying entities table.
132+
included when inserting a new row into the underlying entities table.
128133
If not specified, default value is true.
129134

130135
- **updatable**: Boolean value to determine if the column should be
@@ -1382,4 +1387,3 @@ Example:
13821387
* @Version
13831388
*/
13841389
protected $version;
1385-

docs/en/reference/yaml-mapping.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
YAML Mapping
22
============
33

4-
.. note::
4+
.. warning::
55
The YAML driver is deprecated and will be removed in version 3.0.
66
It is strongly recommended to switch to one of the other mappings.
77

lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ class AnnotationDriver extends CompatibilityAnnotationDriver
6262
*/
6363
public function __construct($reader, $paths = null)
6464
{
65+
Deprecation::trigger(
66+
'doctrine/orm',
67+
'https://github.com/doctrine/orm/issues/10096',
68+
'The annotation mapping driver is deprecated and will be removed in Doctrine ORM 3.0, please migrate to the attribute or XML driver.'
69+
);
6570
$this->reader = $reader;
6671

6772
$this->addPaths((array) $paths);

0 commit comments

Comments
 (0)