1+ # Upgrade to 3.0
2+
3+ ## BC BREAK: Remove cache settings inspection
4+
5+ Doctrine does not provide its own cache implementation anymore and relies on
6+ the PSR-6 standard instead. As a consequence, we cannot determine anymore
7+ whether a given cache adapter is suitable for a production environment.
8+ Because of that, functionality that aims to do so has been removed:
9+
10+ * ` Configuration::ensureProductionSettings() `
11+ * the ` orm:ensure-production-settings ` console command
12+
13+ ## BC BREAK: PSR-6-based second level cache
14+
15+ The second level cache has been reworked to consume a PSR-6 cache. Using a
16+ Doctrine Cache instance is not supported anymore.
17+
18+ * ` DefaultCacheFactory ` : The constructor expects a PSR-6 cache item pool as
19+ second argument now.
20+ * ` DefaultMultiGetRegion ` : This class has been removed.
21+ * ` DefaultRegion ` :
22+ * The constructor expects a PSR-6 cache item pool as second argument now.
23+ * The protected ` $cache ` property is removed.
24+ * The properties ` $name ` and ` $lifetime ` as well as the constant
25+ ` REGION_KEY_SEPARATOR ` and the method ` getCacheEntryKey() ` are
26+ ` private ` now.
27+ * The method ` getCache() ` has been removed.
28+
29+
30+ ## BC Break: Remove ` Doctrine\ORM\Mapping\Driver\PHPDriver `
31+
32+ Use ` StaticPHPDriver ` instead when you want to programmatically configure
33+ entity metadata.
34+
35+ ## BC BREAK: Remove ` Doctrine\ORM\EntityManagerInterface#transactional() `
36+
37+ This method has been replaced by ` Doctrine\ORM\EntityManagerInterface#wrapInTransaction() ` .
38+
39+ ## BC BREAK: Removed support for schema emulation.
40+
41+ The ORM no longer attempts to emulate schemas on SQLite.
42+
43+ ## BC BREAK: Remove ` Setup::registerAutoloadDirectory() `
44+
45+ Use Composer's autoloader instead.
46+
47+ ## BC BREAK: Remove YAML mapping drivers.
48+
49+ If your code relies on ` YamlDriver ` or ` SimpleYamlDriver ` , you ** MUST** migrate to
50+ attribute, annotation or XML drivers instead.
51+
52+ You can use the ` orm:convert-mapping ` command to convert your metadata mapping to XML
53+ _ before_ upgrading to 3.0:
54+
55+ ``` sh
56+ php doctrine orm:convert-mapping xml /path/to/mapping-path-converted-to-xml
57+ ```
58+
59+ ## BC BREAK: Remove code generators and related console commands
60+
61+ These console commands have been removed:
62+
63+ * ` orm:convert-d1-schema `
64+ * ` orm:convert-mapping `
65+ * ` orm:generate:entities `
66+ * ` orm:generate-repositories `
67+
68+ These classes have been deprecated:
69+
70+ * ` Doctrine\ORM\Tools\ConvertDoctrine1Schema `
71+ * ` Doctrine\ORM\Tools\EntityGenerator `
72+ * ` Doctrine\ORM\Tools\EntityRepositoryGenerator `
73+
74+ The entire ` Doctrine\ORM\Tools\Export ` namespace has been removed as well.
75+
76+ ## BC BREAK: Removed ` Doctrine\ORM\Version `
77+
78+ Use Composer's runtime API if you _ really_ need to check the version of the ORM package at runtime.
79+
80+ ## BC BREAK: EntityRepository::count() signature change
81+
82+ The argument ` $criteria ` of ` Doctrine\ORM\EntityRepository::count() ` is now
83+ optional. Overrides in child classes should be made compatible.
84+
85+ ## BC BREAK: changes in exception hierarchy
86+
87+ - ` Doctrine\ORM\ORMException ` has been removed
88+ - ` Doctrine\ORM\Exception\ORMException ` is now an interface
89+
90+ ## Variadic methods now use native variadics
91+ The following methods were using ` func_get_args() ` to simulate a variadic argument:
92+ - ` Doctrine\ORM\Query\Expr#andX() `
93+ - ` Doctrine\ORM\Query\Expr#orX() `
94+ - ` Doctrine\ORM\QueryBuilder#select() `
95+ - ` Doctrine\ORM\QueryBuilder#addSelect() `
96+ - ` Doctrine\ORM\QueryBuilder#where() `
97+ - ` Doctrine\ORM\QueryBuilder#andWhere() `
98+ - ` Doctrine\ORM\QueryBuilder#orWhere() `
99+ - ` Doctrine\ORM\QueryBuilder#groupBy() `
100+ - ` Doctrine\ORM\QueryBuilder#andGroupBy() `
101+ - ` Doctrine\ORM\QueryBuilder#having() `
102+ - ` Doctrine\ORM\QueryBuilder#andHaving() `
103+ - ` Doctrine\ORM\QueryBuilder#orHaving() `
104+ A variadic argument is now actually used in their signatures signature (` ...$x ` ).
105+ Signatures of overridden methods should be changed accordingly
106+
107+ ## Minor BC BREAK: removed ` Doctrine\ORM\EntityManagerInterface#copy() `
108+
109+ Method ` Doctrine\ORM\EntityManagerInterface#copy() ` never got its implementation and is removed in 3.0.
110+
111+ ## BC BREAK: Removed classes related to UUID and TABLE generator strategies
112+
113+ The following classes have been removed:
114+ - ` Doctrine\ORM\Id\TableGenerator `
115+ - ` Doctrine\ORM\Id\UuidGenerator `
116+
117+ Using the ` UUID ` strategy for generating identifiers is not supported anymore.
118+
119+ ## BC BREAK: Removed ` Query::iterate() `
120+
121+ The deprecated method ` Query::iterate() ` has been removed along with the
122+ following classes and methods:
123+
124+ - ` AbstractHydrator::iterate() `
125+ - ` AbstractHydrator::hydrateRow() `
126+ - ` IterableResult `
127+
128+ Use ` toIterable() ` instead.
129+
1130# Upgrade to 2.11
2131
3132## Rename ` AbstractIdGenerator::generate() ` to ` generateId() `
@@ -171,12 +300,12 @@ Note that `toIterable()` yields results of the query, unlike `iterate()` which y
171300
172301# Upgrade to 2.7
173302
174- ## Added ` Doctrine\ORM\AbstractQuery#enableResultCache() ` and ` Doctrine\ORM\AbstractQuery#disableResultCache() ` methods
303+ ## Added ` Doctrine\ORM\AbstractQuery#enableResultCache() ` and ` Doctrine\ORM\AbstractQuery#disableResultCache() ` methods
175304
176305Method ` Doctrine\ORM\AbstractQuery#useResultCache() ` which could be used for both enabling and disabling the cache
177- (depending on passed flag) was split into two.
306+ (depending on passed flag) was split into two.
178307
179- ## Minor BC BREAK: paginator output walkers aren't be called anymore on sub-queries for queries without max results
308+ ## Minor BC BREAK: paginator output walkers aren't be called anymore on sub-queries for queries without max results
180309
181310To optimize DB interaction, ` Doctrine\ORM\Tools\Pagination\Paginator ` no longer fetches identifiers to be able to
182311perform the pagination with join collections when max results isn't set in the query.
@@ -195,7 +324,7 @@ In the last patch of the `v2.6.x` series, we fixed a bug that was not converting
195324In order to not break BC we've introduced a way to enable the fixed behavior using a boolean constructor argument. This
196325argument will be removed in 3.0 and the default behavior will be the fixed one.
197326
198- ## Deprecated: ` Doctrine\ORM\AbstractQuery#useResultCache() `
327+ ## Deprecated: ` Doctrine\ORM\AbstractQuery#useResultCache() `
199328
200329Method ` Doctrine\ORM\AbstractQuery#useResultCache() ` is deprecated because it is split into ` enableResultCache() `
201330and ` disableResultCache() ` . It will be removed in 3.0.
@@ -225,7 +354,7 @@ These related classes have been deprecated:
225354
226355 * ` Doctrine\ORM\Proxy\ProxyFactory `
227356 * ` Doctrine\ORM\Proxy\Autoloader ` - we suggest using the composer autoloader instead
228-
357+
229358These methods have been deprecated:
230359
231360 * ` Doctrine\ORM\Configuration#getAutoGenerateProxyClasses() `
@@ -274,7 +403,7 @@ If your code relies on single entity flushing optimisations via
274403
275404Said API was affected by multiple data integrity bugs due to the fact
276405that change tracking was being restricted upon a subset of the managed
277- entities. The ORM cannot support committing subsets of the managed
406+ entities. The ORM cannot support committing subsets of the managed
278407entities while also guaranteeing data integrity, therefore this
279408utility was removed.
280409
@@ -375,8 +504,8 @@ either:
375504 - map those classes as ` MappedSuperclass `
376505
377506## Minor BC BREAK: `` EntityManagerInterface `` instead of `` EntityManager `` in type-hints
378-
379- As of 2.5, classes requiring the `` EntityManager `` in any method signature will now require
507+
508+ As of 2.5, classes requiring the `` EntityManager `` in any method signature will now require
380509an `` EntityManagerInterface `` instead.
381510If you are extending any of the following classes, then you need to check following
382511signatures:
@@ -469,7 +598,7 @@ the `Doctrine\ORM\Repository\DefaultRepositoryFactory`.
469598When executing DQL queries with new object expressions, instead of returning DTOs numerically indexes, it will now respect user provided aliases. Consider the following query:
470599
471600 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
472-
601+
473602Previously, your result would be similar to this:
474603
475604 array(
0 commit comments