summaryrefslogtreecommitdiff
path: root/vendor/doctrine/orm/UPGRADE.md
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/doctrine/orm/UPGRADE.md')
-rw-r--r--vendor/doctrine/orm/UPGRADE.md2303
1 files changed, 2303 insertions, 0 deletions
diff --git a/vendor/doctrine/orm/UPGRADE.md b/vendor/doctrine/orm/UPGRADE.md
new file mode 100644
index 0000000..1869e9f
--- /dev/null
+++ b/vendor/doctrine/orm/UPGRADE.md
@@ -0,0 +1,2303 @@
1# Upgrade to 3.2
2
3## Deprecate the `NotSupported` exception
4
5The class `Doctrine\ORM\Exception\NotSupported` is deprecated without replacement.
6
7## Deprecate remaining `Serializable` implementation
8
9Relying on `SequenceGenerator` implementing the `Serializable` is deprecated
10because that interface won't be implemented in ORM 4 anymore.
11
12The following methods are deprecated:
13
14* `SequenceGenerator::serialize()`
15* `SequenceGenerator::unserialize()`
16
17## `orm:schema-tool:update` option `--complete` is deprecated
18
19That option behaves as a no-op, and is deprecated. It will be removed in 4.0.
20
21## Deprecate properties `$indexes` and `$uniqueConstraints` of `Doctrine\ORM\Mapping\Table`
22
23The properties `$indexes` and `$uniqueConstraints` have been deprecated since they had no effect at all.
24The preferred way of defining indices and unique constraints is by
25using the `\Doctrine\ORM\Mapping\UniqueConstraint` and `\Doctrine\ORM\Mapping\Index` attributes.
26
27# Upgrade to 3.1
28
29## Deprecate `Doctrine\ORM\Mapping\ReflectionEnumProperty`
30
31This class is deprecated and will be removed in 4.0.
32Instead, use `Doctrine\Persistence\Reflection\EnumReflectionProperty` from
33`doctrine/persistence`.
34
35## Deprecate passing null to `ClassMetadata::fullyQualifiedClassName()`
36
37Passing `null` to `Doctrine\ORM\ClassMetadata::fullyQualifiedClassName()` is
38deprecated and will no longer be possible in 4.0.
39
40## Deprecate array access
41
42Using array access on instances of the following classes is deprecated:
43
44- `Doctrine\ORM\Mapping\DiscriminatorColumnMapping`
45- `Doctrine\ORM\Mapping\EmbedClassMapping`
46- `Doctrine\ORM\Mapping\FieldMapping`
47- `Doctrine\ORM\Mapping\JoinColumnMapping`
48- `Doctrine\ORM\Mapping\JoinTableMapping`
49
50# Upgrade to 3.0
51
52## BC BREAK: Calling `ClassMetadata::getAssociationMappedByTargetField()` with the owning side of an association now throws an exception
53
54Previously, calling
55`Doctrine\ORM\Mapping\ClassMetadata::getAssociationMappedByTargetField()` with
56the owning side of an association returned `null`, which was undocumented, and
57wrong according to the phpdoc of the parent method.
58
59If you do not know whether you are on the owning or inverse side of an association,
60you can use `Doctrine\ORM\Mapping\ClassMetadata::isAssociationInverseSide()`
61to find out.
62
63## BC BREAK: `Doctrine\ORM\Proxy\Autoloader` no longer extends `Doctrine\Common\Proxy\Autoloader`
64
65Make sure to use the former when writing a type declaration or an `instanceof` check.
66
67## Minor BC BREAK: Changed order of arguments passed to `OneToOne`, `ManyToOne` and `Index` mapping PHP attributes
68
69To keep PHP mapping attributes consistent, order of arguments passed to above attributes has been changed
70so `$targetEntity` is a first argument now. This change affects only non-named arguments usage.
71
72## BC BREAK: AUTO keyword for identity generation defaults to IDENTITY for PostgreSQL when using `doctrine/dbal` 4
73
74When using the `AUTO` strategy to let Doctrine determine the identity generation mechanism for
75an entity, and when using `doctrine/dbal` 4, PostgreSQL now uses `IDENTITY`
76instead of `SEQUENCE` or `SERIAL`.
77* If you want to upgrade your existing tables to identity columns, you will need to follow [migration to identity columns on PostgreSQL](https://www.doctrine-project.org/projects/doctrine-dbal/en/4.0/how-to/postgresql-identity-migration.html)
78* If you want to keep using SQL sequences, you need to configure the ORM this way:
79```php
80use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
81use Doctrine\ORM\Configuration;
82use Doctrine\ORM\Mapping\ClassMetadata;
83
84assert($configuration instanceof Configuration);
85$configuration->setIdentityGenerationPreferences([
86 PostgreSQLPlatform::CLASS => ClassMetadata::GENERATOR_TYPE_SEQUENCE,
87]);
88```
89
90## BC BREAK: Throw exceptions when using illegal attributes on Embeddable
91
92There are only a few attributes allowed on an embeddable such as `#[Column]` or
93`#[Embedded]`. Previously all others that target entity classes where ignored,
94now they throw an exception.
95
96## BC BREAK: Partial objects are removed
97
98- The `PARTIAL` keyword in DQL no longer exists.
99- `Doctrine\ORM\Query\AST\PartialObjectExpression`is removed.
100- `Doctrine\ORM\Query\SqlWalker::HINT_PARTIAL` and
101 `Doctrine\ORM\Query::HINT_FORCE_PARTIAL_LOAD` are removed.
102- `Doctrine\ORM\EntityManager*::getPartialReference()` is removed.
103
104## BC BREAK: `Doctrine\ORM\Persister\Entity\EntityPersister::executeInserts()` return type changed to `void`
105
106Implementors should adapt to the new signature, and should call
107`UnitOfWork::assignPostInsertId()` for each entry in the previously returned
108array.
109
110## BC BREAK: `Doctrine\ORM\Proxy\ProxyFactory` no longer extends abstract factory from `doctrine/common`
111
112It is no longer possible to call methods, constants or properties inherited
113from that class on a `ProxyFactory` instance.
114
115`Doctrine\ORM\Proxy\ProxyFactory::createProxyDefinition()` and
116`Doctrine\ORM\Proxy\ProxyFactory::resetUninitializedProxy()` are removed as well.
117
118## BC BREAK: lazy ghosts are enabled unconditionally
119
120`Doctrine\ORM\Configuration::setLazyGhostObjectEnabled()` and
121`Doctrine\ORM\Configuration::isLazyGhostObjectEnabled()` are now no-ops and
122will be deprecated in 3.1.0
123
124## BC BREAK: collisions in identity map are unconditionally rejected
125
126`Doctrine\ORM\Configuration::setRejectIdCollisionInIdentityMap()` and
127`Doctrine\ORM\Configuration::isRejectIdCollisionInIdentityMapEnabled()` are now
128no-ops and will be deprecated in 3.1.0.
129
130## BC BREAK: Lifecycle callback mapping on embedded classes is now explicitly forbidden
131
132Lifecycle callback mapping on embedded classes produced no effect, and is now
133explicitly forbidden to point out mistakes.
134
135## BC BREAK: The `NOTIFY` change tracking policy is removed
136
137You should use `DEFERRED_EXPLICIT` instead.
138
139## BC BREAK: `Mapping\Driver\XmlDriver::__construct()` third argument is now enabled by default
140
141The third argument to
142`Doctrine\ORM\Mapping\Driver\XmlDriver::__construct()` was introduced to
143let users opt-in to XML validation, that is now always enabled by default.
144
145As a consequence, the same goes for
146`Doctrine\ORM\Mapping\Driver\SimplifiedXmlDriver`, and for
147`Doctrine\ORM\ORMSetup::createXMLMetadataConfiguration()`.
148
149## BC BREAK: `Mapping\Driver\AttributeDriver::__construct()` second argument is now a no-op
150
151The second argument to
152`Doctrine\ORM\Mapping\Driver\AttributeDriver::__construct()` was introduced to
153let users opt-in to a new behavior, that is now always enforced, regardless of
154the value of that argument.
155
156## BC BREAK: `Query::setDQL()` and `Query::setFirstResult()` no longer accept `null`
157
158The `$dqlQuery` argument of `Doctrine\ORM\Query::setDQL()` must always be a
159string.
160
161The `$firstResult` argument of `Doctrine\ORM\Query::setFirstResult()` must
162always be an integer.
163
164## BC BREAK: `orm:schema-tool:update` option `--complete` is now a no-op
165
166`orm:schema-tool:update` now behaves as if `--complete` was provided,
167regardless of whether it is provided or not.
168
169## BC BREAK: Removed `Doctrine\ORM\Proxy\Proxy` interface.
170
171Use `Doctrine\Persistence\Proxy` instead to check whether proxies are initialized.
172
173## BC BREAK: Overriding fields or associations declared in other than mapped superclasses
174
175As stated in the documentation, fields and associations may only be overridden when being inherited
176from mapped superclasses. Overriding them for parent entity classes now throws a `MappingException`.
177
178## BC BREAK: Undeclared entity inheritance now throws a `MappingException`
179
180As soon as an entity class inherits from another entity class, inheritance has to
181be declared by adding the appropriate configuration for the root entity.
182
183## Removed `getEntityManager()` in `Doctrine\ORM\Event\OnClearEventArgs` and `Doctrine\ORM\Event\*FlushEventArgs`
184
185Use `getObjectManager()` instead.
186
187## BC BREAK: Removed `Doctrine\ORM\Mapping\ClassMetadataInfo` class
188
189Use `Doctrine\ORM\Mapping\ClassMetadata` instead.
190
191## BC BREAK: Removed `Doctrine\ORM\Event\LifecycleEventArgs` class.
192
193Use one of the dedicated event classes instead:
194
195* `Doctrine\ORM\Event\PrePersistEventArgs`
196* `Doctrine\ORM\Event\PreUpdateEventArgs`
197* `Doctrine\ORM\Event\PreRemoveEventArgs`
198* `Doctrine\ORM\Event\PostPersistEventArgs`
199* `Doctrine\ORM\Event\PostUpdateEventArgs`
200* `Doctrine\ORM\Event\PostRemoveEventArgs`
201* `Doctrine\ORM\Event\PostLoadEventArgs`
202
203## BC BREAK: Removed `AttributeDriver::$entityAnnotationClasses` and `AttributeDriver::getReader()`
204
205* If you need to change the behavior of `AttributeDriver::isTransient()`,
206 override that method instead.
207* The attribute reader is internal to the driver and should not be accessed from outside.
208
209## BC BREAK: Removed `Doctrine\ORM\Query\AST\InExpression`
210
211The AST parser will create a `InListExpression` or a `InSubselectExpression` when
212encountering an `IN ()` DQL expression instead of a generic `InExpression`.
213
214As a consequence, `SqlWalker::walkInExpression()` has been replaced by
215`SqlWalker::walkInListExpression()` and `SqlWalker::walkInSubselectExpression()`.
216
217## BC BREAK: Changed `EntityManagerInterface#refresh($entity)`, `EntityManagerDecorator#refresh($entity)` and `UnitOfWork#refresh($entity)` signatures
218
219The new signatures of these methods add an optional `LockMode|int|null $lockMode`
220param with default `null` value (no lock).
221
222## BC Break: Removed AnnotationDriver
223
224The annotation driver and anything related to annotation has been removed.
225Please migrate to another mapping driver.
226
227The `Doctrine\ORM\Mapping\Annotation` maker interface has been removed in favor of the new
228`Doctrine\ORM\Mapping\MappingAttribute` interface.
229
230## BC BREAK: Removed `EntityManager::create()`
231
232The constructor of `EntityManager` is now public and must be used instead of the `create()` method.
233However, the constructor expects a `Connection` while `create()` accepted an array with connection parameters.
234You can pass that array to DBAL's `Doctrine\DBAL\DriverManager::getConnection()` method to bootstrap the
235connection.
236
237## BC BREAK: Removed `QueryBuilder` methods and constants.
238
239The following `QueryBuilder` constants and methods have been removed:
240
2411. `SELECT`,
2422. `DELETE`,
2433. `UPDATE`,
2444. `STATE_DIRTY`,
2455. `STATE_CLEAN`,
2466. `getState()`,
2477. `getType()`.
248
249## BC BREAK: Omitting only the alias argument for `QueryBuilder::update` and `QueryBuilder::delete` is not supported anymore
250
251When building an UPDATE or DELETE query and when passing a class/type to the function, the alias argument must not be omitted.
252
253### Before
254
255```php
256$qb = $em->createQueryBuilder()
257 ->delete('User u')
258 ->where('u.id = :user_id')
259 ->setParameter('user_id', 1);
260```
261
262### After
263
264```php
265$qb = $em->createQueryBuilder()
266 ->delete('User', 'u')
267 ->where('u.id = :user_id')
268 ->setParameter('user_id', 1);
269```
270
271## BC BREAK: Split output walkers and tree walkers
272
273`SqlWalker` and its child classes don't implement the `TreeWalker` interface
274anymore.
275
276The following methods have been removed from the `TreeWalker` interface and
277from the `TreeWalkerAdapter` and `TreeWalkerChain` classes:
278
279* `setQueryComponent()`
280* `walkSelectClause()`
281* `walkFromClause()`
282* `walkFunction()`
283* `walkOrderByClause()`
284* `walkOrderByItem()`
285* `walkHavingClause()`
286* `walkJoin()`
287* `walkSelectExpression()`
288* `walkQuantifiedExpression()`
289* `walkSubselect()`
290* `walkSubselectFromClause()`
291* `walkSimpleSelectClause()`
292* `walkSimpleSelectExpression()`
293* `walkAggregateExpression()`
294* `walkGroupByClause()`
295* `walkGroupByItem()`
296* `walkDeleteClause()`
297* `walkUpdateClause()`
298* `walkUpdateItem()`
299* `walkWhereClause()`
300* `walkConditionalExpression()`
301* `walkConditionalTerm()`
302* `walkConditionalFactor()`
303* `walkConditionalPrimary()`
304* `walkExistsExpression()`
305* `walkCollectionMemberExpression()`
306* `walkEmptyCollectionComparisonExpression()`
307* `walkNullComparisonExpression()`
308* `walkInExpression()`
309* `walkInstanceOfExpression()`
310* `walkLiteral()`
311* `walkBetweenExpression()`
312* `walkLikeExpression()`
313* `walkStateFieldPathExpression()`
314* `walkComparisonExpression()`
315* `walkInputParameter()`
316* `walkArithmeticExpression()`
317* `walkArithmeticTerm()`
318* `walkStringPrimary()`
319* `walkArithmeticFactor()`
320* `walkSimpleArithmeticExpression()`
321* `walkPathExpression()`
322* `walkResultVariable()`
323* `getExecutor()`
324
325The following changes have been made to the abstract `TreeWalkerAdapter` class:
326
327* The method `setQueryComponent()` is now protected.
328* The method `_getQueryComponents()` has been removed in favor of
329 `getQueryComponents()`.
330
331## BC BREAK: Removed identity columns emulation through sequences
332
333If the platform you are using does not support identity columns, you should
334switch to the `SEQUENCE` strategy.
335
336## BC BREAK: Made setters parameters mandatory
337
338The following methods require an argument when being called. Pass `null`
339instead of omitting the argument.
340
341* `Doctrine\ORM\Event\OnClassMetadataNotFoundEventArgs::setFoundMetadata()`
342* `Doctrine\ORM\AbstractQuery::setHydrationCacheProfile()`
343* `Doctrine\ORM\AbstractQuery::setResultCache()`
344* `Doctrine\ORM\AbstractQuery::setResultCacheProfile()`
345
346## BC BREAK: New argument to `NamingStrategy::joinColumnName()`
347
348### Before
349
350```php
351<?php
352class MyStrategy implements NamingStrategy
353{
354 /**
355 * @param string $propertyName A property name.
356 */
357 public function joinColumnName($propertyName): string
358 {
359 // …
360 }
361}
362```
363
364### After
365
366The `class-string` type for `$className` can be inherited from the signature of
367the interface.
368
369```php
370<?php
371class MyStrategy implements NamingStrategy
372{
373 /**
374 * {@inheritdoc}
375 */
376 public function joinColumnName(string $propertyName, string $className): string
377 {
378 // …
379 }
380}
381```
382
383## BC BREAK: Remove `StaticPHPDriver` and `DriverChain`
384
385Use `Doctrine\Persistence\Mapping\Driver\StaticPHPDriver` and
386`Doctrine\Persistence\Mapping\Driver\MappingDriverChain` from
387`doctrine/persistence` instead.
388
389## BC BREAK: `UnderscoreNamingStrategy` is number aware only
390
391The second argument to `UnderscoreNamingStrategy::__construct()` was dropped,
392the strategy can no longer be unaware of numbers.
393
394## BC BREAK: Remove `Doctrine\ORM\Tools\DisconnectedClassMetadataFactory`
395
396No replacement is provided.
397
398## BC BREAK: Remove support for `Type::canRequireSQLConversion()`
399
400This feature was deprecated in DBAL 3.3.0 and will be removed in DBAL 4.0.
401The value conversion methods are now called regardless of the type.
402
403The `MappingException::sqlConversionNotAllowedForIdentifiers()` method has been removed
404as no longer relevant.
405
406## BC Break: Removed the `doctrine` binary.
407
408The documentation explains how the console tools can be bootstrapped for
409standalone usage:
410
411https://www.doctrine-project.org/projects/doctrine-orm/en/stable/reference/tools.html
412
413The method `ConsoleRunner::printCliConfigTemplate()` has been removed as well
414because it was only useful in the context of the `doctrine` binary.
415
416## BC Break: Removed `EntityManagerHelper` and related logic
417
418All console commands require a `$entityManagerProvider` to be passed via the
419constructor. Commands won't try to get the entity manager from a previously
420registered `em` console helper.
421
422The following classes have been removed:
423
424* `Doctrine\ORM\Tools\Console\EntityManagerProvider\HelperSetManagerProvider`
425* `Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper`
426
427The following breaking changes have been applied to `Doctrine\ORM\Tools\Console\ConsoleRunner`:
428
429* The method `createHelperSet()` has been removed.
430* The methods `run()` and `createApplication()` don't accept an instance of
431 `HelperSet` as first argument anymore.
432* The method `addCommands()` requires an instance of `EntityManagerProvider`
433 as second argument now.
434
435## BC Break: `Exception\ORMException` is no longer a class, but an interface
436
437All methods in `Doctrine\ORM\ORMException` have been extracted to dedicated exceptions.
438
439 * `missingMappingDriverImpl()` => `Exception\MissingMappingDriverImplementation::create()`
440 * `unrecognizedField()` => `Persisters\Exception\UnrecognizedField::byName()`
441 * `unexpectedAssociationValue()` => `Exception\UnexpectedAssociationValue::create()`
442 * `invalidOrientation()` => `Persisters\Exception\InvalidOrientation::fromClassNameAndField()`
443 * `entityManagerClosed()` => `Exception\EntityManagerClosed::create()`
444 * `invalidHydrationMode()` => `Exception\InvalidHydrationMode::fromMode()`
445 * `mismatchedEventManager()` => `Exception\MismatchedEventManager::create()`
446 * `findByRequiresParameter()` => `Repository\Exception\InvalidMagicMethodCall::onMissingParameter()`
447 * `invalidMagicCall()` => `Repository\Exception\InvalidMagicMethodCall::becauseFieldNotFoundIn()`
448 * `invalidFindByInverseAssociation()` => `Repository\Exception\InvalidFindByCall::fromInverseSideUsage()`
449 * `invalidResultCacheDriver()` => `Cache\Exception\InvalidResultCacheDriver::create()`
450 * `notSupported()` => `Exception\NotSupported::create()`
451 * `queryCacheNotConfigured()` => `QueryCacheNotConfigured::create()`
452 * `metadataCacheNotConfigured()` => `Cache\Exception\MetadataCacheNotConfigured::create()`
453 * `queryCacheUsesNonPersistentCache()` => `Cache\Exception\QueryCacheUsesNonPersistentCache::fromDriver()`
454 * `metadataCacheUsesNonPersistentCache()` => `Cache\Exception\MetadataCacheUsesNonPersistentCache::fromDriver()`
455 * `proxyClassesAlwaysRegenerating()` => `Exception\ProxyClassesAlwaysRegenerating::create()`
456 * `invalidEntityRepository()` => `Exception\InvalidEntityRepository::fromClassName()`
457 * `missingIdentifierField()` => `Exception\MissingIdentifierField::fromFieldAndClass()`
458 * `unrecognizedIdentifierFields()` => `Exception\UnrecognizedIdentifierFields::fromClassAndFieldNames()`
459 * `cantUseInOperatorOnCompositeKeys()` => `Persisters\Exception\CantUseInOperatorOnCompositeKeys::create()`
460
461## BC Break: `CacheException` is no longer a class, but an interface
462
463All methods in `Doctrine\ORM\Cache\CacheException` have been extracted to dedicated exceptions.
464
465 * `updateReadOnlyCollection()` => `Cache\Exception\CannotUpdateReadOnlyCollection::fromEntityAndField()`
466 * `updateReadOnlyEntity()` => `Cache\Exception\CannotUpdateReadOnlyEntity::fromEntity()`
467 * `nonCacheableEntity()` => `Cache\Exception\NonCacheableEntity::fromEntity()`
468 * `nonCacheableEntityAssociation()` => `Cache\Exception\NonCacheableEntityAssociation::fromEntityAndField()`
469
470
471## BC Break: Missing type declaration added for identifier generators
472
473Although undocumented, it was possible to configure a custom repository
474class that implements `ObjectRepository` but does not extend the
475`EntityRepository` base class. Repository classes have to extend
476`EntityRepository` now.
477
478## BC BREAK: Removed support for entity namespace alias
479
480- `EntityManager::getRepository()` no longer accepts the entity namespace alias
481 notation.
482- `Configuration::addEntityNamespace()` and
483 `Configuration::getEntityNamespace()` have been removed.
484
485## BC BREAK: Remove helper methods from `AbstractCollectionPersister`
486
487The following protected methods of
488`Doctrine\ORM\Cache\Persister\Collection\AbstractCollectionPersister`
489have been removed.
490
491* `evictCollectionCache()`
492* `evictElementCache()`
493
494## BC BREAK: `Doctrine\ORM\Query\TreeWalkerChainIterator`
495
496This class has been removed without replacement.
497
498## BC BREAK: Remove quoting methods from `ClassMetadata`
499
500The following methods have been removed from the class metadata because
501quoting is handled by implementations of `Doctrine\ORM\Mapping\QuoteStrategy`:
502
503* `getQuotedIdentifierColumnNames()`
504* `getQuotedColumnName()`
505* `getQuotedTableName()`
506* `getQuotedJoinTableName()`
507
508## BC BREAK: Remove ability to merge detached entities
509
510Merge semantics was a poor fit for the PHP "share-nothing" architecture.
511In addition to that, merging caused multiple issues with data integrity
512in the managed entity graph, which was constantly spawning more edge-case
513bugs/scenarios.
514
515The method `UnitOfWork::merge()` has been removed. The method
516`EntityManager::merge()` will throw an exception on each call.
517
518## BC BREAK: Removed ability to partially flush/commit entity manager and unit of work
519
520The following methods don't accept a single entity or an array of entities anymore:
521
522* `Doctrine\ORM\EntityManager::flush()`
523* `Doctrine\ORM\Decorator\EntityManagerDecorator::flush()`
524* `Doctrine\ORM\UnitOfWork::commit()`
525
526The semantics of `flush()` and `commit()` will remain the same, but the change
527tracking will be performed on all entities managed by the unit of work, and not
528just on the provided entities, as the parameter is now completely ignored.
529
530## BC BREAK: Removed ability to partially clear entity manager and unit of work
531
532* Passing an argument other than `null` to `EntityManager::clear()` will raise
533 an exception.
534* The unit of work cannot be cleared partially anymore. Passing an argument to
535 `UnitOfWork::clear()` does not have any effect anymore; the unit of work is
536 cleared completely.
537* The method `EntityRepository::clear()` has been removed.
538* The methods `getEntityClass()` and `clearsAllEntities()` have been removed
539 from `OnClearEventArgs`.
540
541## BC BREAK: Remove support for Doctrine Cache
542
543The Doctrine Cache library is not supported anymore. The following methods
544have been removed from `Doctrine\ORM\Configuration`:
545
546* `getQueryCacheImpl()`
547* `setQueryCacheImpl()`
548* `getHydrationCacheImpl()`
549* `setHydrationCacheImpl()`
550* `getMetadataCacheImpl()`
551* `setMetadataCacheImpl()`
552
553The methods have been replaced by PSR-6 compatible counterparts
554(just strip the `Impl` suffix from the old name to get the new one).
555
556## BC BREAK: Remove `Doctrine\ORM\Configuration::newDefaultAnnotationDriver`
557
558This functionality has been moved to the new `ORMSetup` class. Call
559`Doctrine\ORM\ORMSetup::createDefaultAnnotationDriver()` to create
560a new annotation driver.
561
562## BC BREAK: Remove `Doctrine\ORM\Tools\Setup`
563
564In our effort to migrate from Doctrine Cache to PSR-6, the `Setup` class which
565accepted a Doctrine Cache instance in each method has been removed.
566
567The replacement is `Doctrine\ORM\ORMSetup` which accepts a PSR-6
568cache instead.
569
570## BC BREAK: Removed named queries
571
572All APIs related to named queries have been removed.
573
574## BC BREAK: Remove old cache accessors and mutators from query classes
575
576The following methods have been removed from `AbstractQuery`:
577
578* `setResultCacheDriver()`
579* `getResultCacheDriver()`
580* `useResultCache()`
581* `getResultCacheLifetime()`
582* `getResultCacheId()`
583
584The following methods have been removed from `Query`:
585
586* `setQueryCacheDriver()`
587* `getQueryCacheDriver()`
588
589## BC BREAK: Remove `Doctrine\ORM\Cache\MultiGetRegion`
590
591The interface has been merged into `Doctrine\ORM\Cache\Region`.
592
593## BC BREAK: Rename `AbstractIdGenerator::generate()` to `generateId()`
594
595* Implementations of `AbstractIdGenerator` have to implement the method
596 `generateId()`.
597* The method `generate()` has been removed from `AbstractIdGenerator`.
598
599## BC BREAK: Remove cache settings inspection
600
601Doctrine does not provide its own cache implementation anymore and relies on
602the PSR-6 standard instead. As a consequence, we cannot determine anymore
603whether a given cache adapter is suitable for a production environment.
604Because of that, functionality that aims to do so has been removed:
605
606* `Configuration::ensureProductionSettings()`
607* the `orm:ensure-production-settings` console command
608
609## BC BREAK: PSR-6-based second level cache
610
611The second level cache has been reworked to consume a PSR-6 cache. Using a
612Doctrine Cache instance is not supported anymore.
613
614* `DefaultCacheFactory`: The constructor expects a PSR-6 cache item pool as
615 second argument now.
616* `DefaultMultiGetRegion`: This class has been removed.
617* `DefaultRegion`:
618 * The constructor expects a PSR-6 cache item pool as second argument now.
619 * The protected `$cache` property is removed.
620 * The properties `$name` and `$lifetime` as well as the constant
621 `REGION_KEY_SEPARATOR` and the method `getCacheEntryKey()` are
622 `private` now.
623 * The method `getCache()` has been removed.
624
625
626## BC Break: Remove `Doctrine\ORM\Mapping\Driver\PHPDriver`
627
628Use `StaticPHPDriver` instead when you want to programmatically configure
629entity metadata.
630
631## BC BREAK: Remove `Doctrine\ORM\EntityManagerInterface#transactional()`
632
633This method has been replaced by `Doctrine\ORM\EntityManagerInterface#wrapInTransaction()`.
634
635## BC BREAK: Removed support for schema emulation.
636
637The ORM no longer attempts to emulate schemas on SQLite.
638
639## BC BREAK: Remove `Setup::registerAutoloadDirectory()`
640
641Use Composer's autoloader instead.
642
643## BC BREAK: Remove YAML mapping drivers.
644
645If your code relies on `YamlDriver` or `SimpleYamlDriver`, you **MUST** migrate to
646attribute, annotation or XML drivers instead.
647
648You can use the `orm:convert-mapping` command to convert your metadata mapping to XML
649_before_ upgrading to 3.0:
650
651```sh
652php doctrine orm:convert-mapping xml /path/to/mapping-path-converted-to-xml
653```
654
655## BC BREAK: Remove code generators and related console commands
656
657These console commands have been removed:
658
659* `orm:convert-d1-schema`
660* `orm:convert-mapping`
661* `orm:generate:entities`
662* `orm:generate-repositories`
663
664These classes have been deprecated:
665
666* `Doctrine\ORM\Tools\ConvertDoctrine1Schema`
667* `Doctrine\ORM\Tools\EntityGenerator`
668* `Doctrine\ORM\Tools\EntityRepositoryGenerator`
669
670The entire `Doctrine\ORM\Tools\Export` namespace has been removed as well.
671
672## BC BREAK: Removed `Doctrine\ORM\Version`
673
674Use Composer's runtime API if you _really_ need to check the version of the ORM package at runtime.
675
676## BC BREAK: EntityRepository::count() signature change
677
678The argument `$criteria` of `Doctrine\ORM\EntityRepository::count()` is now
679optional. Overrides in child classes should be made compatible.
680
681## BC BREAK: changes in exception hierarchy
682
683- `Doctrine\ORM\ORMException` has been removed
684- `Doctrine\ORM\Exception\ORMException` is now an interface
685
686## Variadic methods now use native variadics
687The following methods were using `func_get_args()` to simulate a variadic argument:
688- `Doctrine\ORM\Query\Expr#andX()`
689- `Doctrine\ORM\Query\Expr#orX()`
690- `Doctrine\ORM\QueryBuilder#select()`
691- `Doctrine\ORM\QueryBuilder#addSelect()`
692- `Doctrine\ORM\QueryBuilder#where()`
693- `Doctrine\ORM\QueryBuilder#andWhere()`
694- `Doctrine\ORM\QueryBuilder#orWhere()`
695- `Doctrine\ORM\QueryBuilder#groupBy()`
696- `Doctrine\ORM\QueryBuilder#andGroupBy()`
697- `Doctrine\ORM\QueryBuilder#having()`
698- `Doctrine\ORM\QueryBuilder#andHaving()`
699- `Doctrine\ORM\QueryBuilder#orHaving()`
700A variadic argument is now actually used in their signatures signature (`...$x`).
701Signatures of overridden methods should be changed accordingly
702
703## Minor BC BREAK: removed `Doctrine\ORM\EntityManagerInterface#copy()`
704
705Method `Doctrine\ORM\EntityManagerInterface#copy()` never got its implementation and is removed in 3.0.
706
707## BC BREAK: Removed classes related to UUID and TABLE generator strategies
708
709The following classes have been removed:
710- `Doctrine\ORM\Id\TableGenerator`
711- `Doctrine\ORM\Id\UuidGenerator`
712
713Using the `UUID` strategy for generating identifiers is not supported anymore.
714
715## BC BREAK: Removed `Query::iterate()`
716
717The deprecated method `Query::iterate()` has been removed along with the
718following classes and methods:
719
720- `AbstractHydrator::iterate()`
721- `AbstractHydrator::hydrateRow()`
722- `IterableResult`
723
724Use `toIterable()` instead.
725
726# Upgrade to 2.19
727
728## Deprecate calling `ClassMetadata::getAssociationMappedByTargetField()` with the owning side of an association
729
730Calling
731`Doctrine\ORM\Mapping\ClassMetadata::getAssociationMappedByTargetField()` with
732the owning side of an association returns `null`, which is undocumented, and
733wrong according to the phpdoc of the parent method.
734
735If you do not know whether you are on the owning or inverse side of an association,
736you can use `Doctrine\ORM\Mapping\ClassMetadata::isAssociationInverseSide()`
737to find out.
738
739## Deprecate `Doctrine\ORM\Query\Lexer::T_*` constants
740
741Use `Doctrine\ORM\Query\TokenType::T_*` instead.
742
743# Upgrade to 2.17
744
745## Deprecate annotations classes for named queries
746
747The following classes have been deprecated:
748
749* `Doctrine\ORM\Mapping\NamedNativeQueries`
750* `Doctrine\ORM\Mapping\NamedNativeQuery`
751* `Doctrine\ORM\Mapping\NamedQueries`
752* `Doctrine\ORM\Mapping\NamedQuery`
753
754## Deprecate `Doctrine\ORM\Query\Exec\AbstractSqlExecutor::_sqlStatements`
755
756Use `Doctrine\ORM\Query\Exec\AbstractSqlExecutor::sqlStatements` instead.
757
758## Undeprecate `Doctrine\ORM\Proxy\Autoloader`
759
760It will be a full-fledged class, no longer extending
761`Doctrine\Common\Proxy\Autoloader` in 3.0.x.
762
763## Deprecated: reliance on the non-optimal defaults that come with the `AUTO` identifier generation strategy
764
765When the `AUTO` identifier generation strategy was introduced, the best
766strategy at the time was selected for each database platform.
767A lot of time has passed since then, and with ORM 3.0.0 and DBAL 4.0.0, support
768for better strategies will be added.
769
770Because of that, it is now deprecated to rely on the historical defaults when
771they differ from what we will be recommended in the future.
772
773Instead, you should pick a strategy for each database platform you use, and it
774will be used when using `AUTO`. As of now, only PostgreSQL is affected by this.
775
776It is recommended that PostgreSQL users configure their existing and new
777applications to use `SEQUENCE` until `doctrine/dbal` 4.0.0 is released:
778
779```php
780use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
781use Doctrine\ORM\Configuration;
782
783assert($configuration instanceof Configuration);
784$configuration->setIdentityGenerationPreferences([
785 PostgreSQLPlatform::CLASS => ClassMetadata::GENERATOR_TYPE_SEQUENCE,
786]);
787```
788
789When DBAL 4 is released, `AUTO` will result in `IDENTITY`, and the above
790configuration should be removed to migrate to it.
791
792## Deprecate `EntityManagerInterface::getPartialReference()`
793
794This method does not have a replacement and will be removed in 3.0.
795
796## Deprecate not-enabling lazy-ghosts
797
798Not enabling lazy ghost objects is deprecated. In ORM 3.0, they will be always enabled.
799Ensure `Doctrine\ORM\Configuration::setLazyGhostObjectEnabled(true)` is called to enable them.
800
801# Upgrade to 2.16
802
803## Deprecated accepting duplicate IDs in the identity map
804
805For any given entity class and ID value, there should be only one object instance
806representing the entity.
807
808In https://github.com/doctrine/orm/pull/10785, a check was added that will guard this
809in the identity map. The most probable cause for violations of this rule are collisions
810of application-provided IDs.
811
812In ORM 2.16.0, the check was added by throwing an exception. In ORM 2.16.1, this will be
813changed to a deprecation notice. ORM 3.0 will make it an exception again. Use
814`\Doctrine\ORM\Configuration::setRejectIdCollisionInIdentityMap()` if you want to opt-in
815to the new mode.
816
817## Potential changes to the order in which `INSERT`s are executed
818
819In https://github.com/doctrine/orm/pull/10547, the commit order computation was improved
820to fix a series of bugs where a correct (working) commit order was previously not found.
821Also, the new computation may get away with fewer queries being executed: By inserting
822referred-to entities first and using their ID values for foreign key fields in subsequent
823`INSERT` statements, additional `UPDATE` statements that were previously necessary can be
824avoided.
825
826When using database-provided, auto-incrementing IDs, this may lead to IDs being assigned
827to entities in a different order than it was previously the case.
828
829## Deprecated returning post insert IDs from `EntityPersister::executeInserts()`
830
831Persisters implementing `\Doctrine\ORM\Persisters\Entity\EntityPersister` should no longer
832return an array of post insert IDs from their `::executeInserts()` method. Make the
833persister call `Doctrine\ORM\UnitOfWork::assignPostInsertId()` instead.
834
835## Changing the way how reflection-based mapping drivers report fields, deprecated the "old" mode
836
837In ORM 3.0, a change will be made regarding how the `AttributeDriver` reports field mappings.
838This change is necessary to be able to detect (and reject) some invalid mapping configurations.
839
840To avoid surprises during 2.x upgrades, the new mode is opt-in. It can be activated on the
841`AttributeDriver` and `AnnotationDriver` by setting the `$reportFieldsWhereDeclared`
842constructor parameter to `true`. It will cause `MappingException`s to be thrown when invalid
843configurations are detected.
844
845Not enabling the new mode will cause a deprecation notice to be raised. In ORM 3.0,
846only the new mode will be available.
847
848# Upgrade to 2.15
849
850## Deprecated configuring `JoinColumn` on the inverse side of one-to-one associations
851
852For one-to-one associations, the side using the `mappedBy` attribute is the inverse side.
853The owning side is the entity with the table containing the foreign key. Using `JoinColumn`
854configuration on the _inverse_ side now triggers a deprecation notice and will be an error
855in 3.0.
856
857## Deprecated overriding fields or associations not declared in mapped superclasses
858
859As stated in the documentation, fields and associations may only be overridden when being inherited
860from mapped superclasses. Overriding them for parent entity classes now triggers a deprecation notice
861and will be an error in 3.0.
862
863## Deprecated undeclared entity inheritance
864
865As soon as an entity class inherits from another entity class, inheritance has to
866be declared by adding the appropriate configuration for the root entity.
867
868## Deprecated stubs for "concrete table inheritance"
869
870This third way of mapping class inheritance was never implemented. Code stubs are
871now deprecated and will be removed in 3.0.
872
873* `\Doctrine\ORM\Mapping\ClassMetadataInfo::INHERITANCE_TYPE_TABLE_PER_CLASS` constant
874* `\Doctrine\ORM\Mapping\ClassMetadataInfo::isInheritanceTypeTablePerClass()` method
875* Using `TABLE_PER_CLASS` as the value for the `InheritanceType` attribute or annotation
876 or in XML configuration files.
877
878# Upgrade to 2.14
879
880## Deprecated `Doctrine\ORM\Persisters\Exception\UnrecognizedField::byName($field)` method.
881
882Use `Doctrine\ORM\Persisters\Exception\UnrecognizedField::byFullyQualifiedName($className, $field)` instead.
883
884## Deprecated constants of `Doctrine\ORM\Internal\CommitOrderCalculator`
885
886The following public constants have been deprecated:
887
888* `CommitOrderCalculator::NOT_VISITED`
889* `CommitOrderCalculator::IN_PROGRESS`
890* `CommitOrderCalculator::VISITED`
891
892These constants were used for internal purposes. Relying on them is discouraged.
893
894## Deprecated `Doctrine\ORM\Query\AST\InExpression`
895
896The AST parser will create a `InListExpression` or a `InSubselectExpression` when
897encountering an `IN ()` DQL expression instead of a generic `InExpression`.
898
899As a consequence, `SqlWalker::walkInExpression()` has been deprecated in favor of
900`SqlWalker::walkInListExpression()` and `SqlWalker::walkInSubselectExpression()`.
901
902## Deprecated constructing a `CacheKey` without `$hash`
903
904The `Doctrine\ORM\Cache\CacheKey` class has an explicit constructor now with
905an optional parameter `$hash`. That parameter will become mandatory in 3.0.
906
907## Deprecated `AttributeDriver::$entityAnnotationClasses`
908
909If you need to change the behavior of `AttributeDriver::isTransient()`,
910override that method instead.
911
912## Deprecated incomplete schema updates
913
914Using `orm:schema-tool:update` without passing the `--complete` flag is
915deprecated. Use schema asset filtering if you need to preserve assets not
916managed by DBAL.
917
918Likewise, calling `SchemaTool::updateSchema()` or
919`SchemaTool::getUpdateSchemaSql()` with a second argument is deprecated.
920
921## Deprecated annotation mapping driver.
922
923Please switch to one of the other mapping drivers. Native attributes which PHP
924supports since version 8.0 are probably your best option.
925
926As a consequence, the following methods are deprecated:
927- `ORMSetup::createAnnotationMetadataConfiguration`
928- `ORMSetup::createDefaultAnnotationDriver`
929
930The marker interface `Doctrine\ORM\Mapping\Annotation` is deprecated as well.
931All annotation/attribute classes implement
932`Doctrine\ORM\Mapping\MappingAttribute` now.
933
934## Deprecated `Doctrine\ORM\Proxy\Proxy` interface.
935
936Use `Doctrine\Persistence\Proxy` instead to check whether proxies are initialized.
937
938## Deprecated `Doctrine\ORM\Event\LifecycleEventArgs` class.
939
940It will be removed in 3.0. Use one of the dedicated event classes instead:
941
942* `Doctrine\ORM\Event\PrePersistEventArgs`
943* `Doctrine\ORM\Event\PreUpdateEventArgs`
944* `Doctrine\ORM\Event\PreRemoveEventArgs`
945* `Doctrine\ORM\Event\PostPersistEventArgs`
946* `Doctrine\ORM\Event\PostUpdateEventArgs`
947* `Doctrine\ORM\Event\PostRemoveEventArgs`
948* `Doctrine\ORM\Event\PostLoadEventArgs`
949
950# Upgrade to 2.13
951
952## Deprecated `EntityManager::create()`
953
954The constructor of `EntityManager` is now public and should be used instead of the `create()` method.
955However, the constructor expects a `Connection` while `create()` accepted an array with connection parameters.
956You can pass that array to DBAL's `Doctrine\DBAL\DriverManager::getConnection()` method to bootstrap the
957connection.
958
959## Deprecated `QueryBuilder` methods and constants.
960
9611. The `QueryBuilder::getState()` method has been deprecated as the builder state is an internal concern.
9622. Relying on the type of the query being built by using `QueryBuilder::getType()` has been deprecated.
963 If necessary, track the type of the query being built outside of the builder.
964
965The following `QueryBuilder` constants related to the above methods have been deprecated:
966
9671. `SELECT`,
9682. `DELETE`,
9693. `UPDATE`,
9704. `STATE_DIRTY`,
9715. `STATE_CLEAN`.
972
973## Deprecated omitting only the alias argument for `QueryBuilder::update` and `QueryBuilder::delete`
974
975When building an UPDATE or DELETE query and when passing a class/type to the function, the alias argument must not be omitted.
976
977### Before
978
979```php
980$qb = $em->createQueryBuilder()
981 ->delete('User u')
982 ->where('u.id = :user_id')
983 ->setParameter('user_id', 1);
984```
985
986### After
987
988```php
989$qb = $em->createQueryBuilder()
990 ->delete('User', 'u')
991 ->where('u.id = :user_id')
992 ->setParameter('user_id', 1);
993```
994
995## Deprecated using the `IDENTITY` identifier strategy on platform that do not support identity columns
996
997If identity columns are emulated with sequences on the platform you are using,
998you should switch to the `SEQUENCE` strategy.
999
1000## Deprecated passing `null` to `Doctrine\ORM\Query::setFirstResult()`
1001
1002`$query->setFirstResult(null);` is equivalent to `$query->setFirstResult(0)`.
1003
1004## Deprecated calling setters without arguments
1005
1006The following methods will require an argument in 3.0. Pass `null` instead of
1007omitting the argument.
1008
1009* `Doctrine\ORM\Event\OnClassMetadataNotFoundEventArgs::setFoundMetadata()`
1010* `Doctrine\ORM\AbstractQuery::setHydrationCacheProfile()`
1011* `Doctrine\ORM\AbstractQuery::setResultCache()`
1012* `Doctrine\ORM\AbstractQuery::setResultCacheProfile()`
1013
1014## Deprecated passing invalid fetch modes to `AbstractQuery::setFetchMode()`
1015
1016Calling `AbstractQuery::setFetchMode()` with anything else than
1017`Doctrine\ORM\Mapping::FETCH_EAGER` results in
1018`Doctrine\ORM\Mapping::FETCH_LAZY` being used. Relying on that behavior is
1019deprecated and will result in an exception in 3.0.
1020
1021## Deprecated `getEntityManager()` in `Doctrine\ORM\Event\OnClearEventArgs` and `Doctrine\ORM\Event\*FlushEventArgs`
1022
1023This method has been deprecated in:
1024
1025* `Doctrine\ORM\Event\OnClearEventArgs`
1026* `Doctrine\ORM\Event\OnFlushEventArgs`
1027* `Doctrine\ORM\Event\PostFlushEventArgs`
1028* `Doctrine\ORM\Event\PreFlushEventArgs`
1029
1030It will be removed in 3.0. Use `getObjectManager()` instead.
1031
1032## Prepare split of output walkers and tree walkers
1033
1034In 3.0, `SqlWalker` and its child classes won't implement the `TreeWalker`
1035interface anymore. Relying on that inheritance is deprecated.
1036
1037The following methods of the `TreeWalker` interface have been deprecated:
1038
1039* `setQueryComponent()`
1040* `walkSelectClause()`
1041* `walkFromClause()`
1042* `walkFunction()`
1043* `walkOrderByClause()`
1044* `walkOrderByItem()`
1045* `walkHavingClause()`
1046* `walkJoin()`
1047* `walkSelectExpression()`
1048* `walkQuantifiedExpression()`
1049* `walkSubselect()`
1050* `walkSubselectFromClause()`
1051* `walkSimpleSelectClause()`
1052* `walkSimpleSelectExpression()`
1053* `walkAggregateExpression()`
1054* `walkGroupByClause()`
1055* `walkGroupByItem()`
1056* `walkDeleteClause()`
1057* `walkUpdateClause()`
1058* `walkUpdateItem()`
1059* `walkWhereClause()`
1060* `walkConditionalExpression()`
1061* `walkConditionalTerm()`
1062* `walkConditionalFactor()`
1063* `walkConditionalPrimary()`
1064* `walkExistsExpression()`
1065* `walkCollectionMemberExpression()`
1066* `walkEmptyCollectionComparisonExpression()`
1067* `walkNullComparisonExpression()`
1068* `walkInExpression()`
1069* `walkInstanceOfExpression()`
1070* `walkLiteral()`
1071* `walkBetweenExpression()`
1072* `walkLikeExpression()`
1073* `walkStateFieldPathExpression()`
1074* `walkComparisonExpression()`
1075* `walkInputParameter()`
1076* `walkArithmeticExpression()`
1077* `walkArithmeticTerm()`
1078* `walkStringPrimary()`
1079* `walkArithmeticFactor()`
1080* `walkSimpleArithmeticExpression()`
1081* `walkPathExpression()`
1082* `walkResultVariable()`
1083* `getExecutor()`
1084
1085The following changes have been made to the abstract `TreeWalkerAdapter` class:
1086
1087* All implementations of now-deprecated `TreeWalker` methods have been
1088 deprecated as well.
1089* The method `setQueryComponent()` will become protected in 3.0. Calling it
1090 publicly is deprecated.
1091* The method `_getQueryComponents()` is deprecated, call `getQueryComponents()`
1092 instead.
1093
1094On the `TreeWalkerChain` class, all implementations of now-deprecated
1095`TreeWalker` methods have been deprecated as well. However, `SqlWalker` is
1096unaffected by those deprecations and will continue to implement all of those
1097methods.
1098
1099## Deprecated passing `null` to `Doctrine\ORM\Query::setDQL()`
1100
1101Doing `$query->setDQL(null);` achieves nothing.
1102
1103## Deprecated omitting second argument to `NamingStrategy::joinColumnName`
1104
1105When implementing `NamingStrategy`, it is deprecated to implement
1106`joinColumnName()` with only one argument.
1107
1108### Before
1109
1110```php
1111<?php
1112class MyStrategy implements NamingStrategy
1113{
1114 /**
1115 * @param string $propertyName A property name.
1116 */
1117 public function joinColumnName($propertyName): string
1118 {
1119 // …
1120 }
1121}
1122```
1123
1124### After
1125
1126For backward-compatibility reasons, the parameter has to be optional, but can
1127be documented as guaranteed to be a `class-string`.
1128
1129```php
1130<?php
1131class MyStrategy implements NamingStrategy
1132{
1133 /**
1134 * @param string $propertyName A property name.
1135 * @param class-string $className
1136 */
1137 public function joinColumnName($propertyName, $className = null): string
1138 {
1139 // …
1140 }
1141}
1142```
1143
1144## Deprecated methods related to named queries
1145
1146The following methods have been deprecated:
1147
1148- `Doctrine\ORM\Query\ResultSetMappingBuilder::addNamedNativeQueryMapping()`
1149- `Doctrine\ORM\Query\ResultSetMappingBuilder::addNamedNativeQueryResultClassMapping()`
1150- `Doctrine\ORM\Query\ResultSetMappingBuilder::addNamedNativeQueryResultSetMapping()`
1151- `Doctrine\ORM\Query\ResultSetMappingBuilder::addNamedNativeQueryEntityResultMapping()`
1152
1153## Deprecated classes related to Doctrine 1 and reverse engineering
1154
1155The following classes have been deprecated:
1156
1157- `Doctrine\ORM\Tools\ConvertDoctrine1Schema`
1158- `Doctrine\ORM\Tools\DisconnectedClassMetadataFactory`
1159
1160## Deprecate `ClassMetadataInfo` usage
1161
1162It is deprecated to pass `Doctrine\ORM\Mapping\ClassMetadataInfo` instances
1163that are not also instances of `Doctrine\ORM\ClassMetadata` to the following
1164methods:
1165
1166- `Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder::__construct()`
1167- `Doctrine\ORM\Mapping\Driver\DatabaseDriver::loadMetadataForClass()`
1168- `Doctrine\ORM\Tools\SchemaValidator::validateClass()`
1169
1170# Upgrade to 2.12
1171
1172## Deprecated the `doctrine` binary.
1173
1174The documentation explains how the console tools can be bootstrapped for
1175standalone usage.
1176
1177The method `ConsoleRunner::printCliConfigTemplate()` is deprecated because it
1178was only useful in the context of the `doctrine` binary.
1179
1180## Deprecate omitting `$class` argument to `ORMInvalidArgumentException::invalidIdentifierBindingEntity()`
1181
1182To make it easier to identify understand the cause for that exception, it is
1183deprecated to omit the class name when calling
1184`ORMInvalidArgumentException::invalidIdentifierBindingEntity()`.
1185
1186## Deprecate `Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper`
1187
1188Using a console helper to provide the ORM's console commands with one or
1189multiple entity managers had been deprecated with 2.9 already. This leaves
1190The `EntityManagerHelper` class with no purpose which is why it is now
1191deprecated too. Applications that still rely on the `em` console helper, can
1192easily recreate that class in their own codebase.
1193
1194## Deprecate custom repository classes that don't extend `EntityRepository`
1195
1196Although undocumented, it is currently possible to configure a custom repository
1197class that implements `ObjectRepository` but does not extend the
1198`EntityRepository` base class.
1199
1200This is now deprecated. Please extend `EntityRepository` instead.
1201
1202## Deprecated more APIs related to entity namespace aliases
1203
1204```diff
1205-$config = $entityManager->getConfiguration();
1206-$config->addEntityNamespace('CMS', 'My\App\Cms');
1207+use My\App\Cms\CmsUser;
1208
1209-$entityManager->getRepository('CMS:CmsUser');
1210+$entityManager->getRepository(CmsUser::class);
1211```
1212
1213## Deprecate `AttributeDriver::getReader()` and `AnnotationDriver::getReader()`
1214
1215That method was inherited from the abstract `AnnotationDriver` class of
1216`doctrine/persistence`, and does not seem to serve any purpose.
1217
1218## Un-deprecate `Doctrine\ORM\Proxy\Proxy`
1219
1220Because no forward-compatible new proxy solution had been implemented yet, the
1221current proxy mechanism is not considered deprecated anymore for the time
1222being. This applies to the following interfaces/classes:
1223
1224* `Doctrine\ORM\Proxy\Proxy`
1225* `Doctrine\ORM\Proxy\ProxyFactory`
1226
1227These methods have been un-deprecated:
1228
1229* `Doctrine\ORM\Configuration::getAutoGenerateProxyClasses()`
1230* `Doctrine\ORM\Configuration::getProxyDir()`
1231* `Doctrine\ORM\Configuration::getProxyNamespace()`
1232
1233Note that the `Doctrine\ORM\Proxy\Autoloader` remains deprecated and will be removed in 3.0.
1234
1235## Deprecate helper methods from `AbstractCollectionPersister`
1236
1237The following protected methods of
1238`Doctrine\ORM\Cache\Persister\Collection\AbstractCollectionPersister`
1239are not in use anymore and will be removed.
1240
1241* `evictCollectionCache()`
1242* `evictElementCache()`
1243
1244## Deprecate `Doctrine\ORM\Query\TreeWalkerChainIterator`
1245
1246This class won't have a replacement.
1247
1248## Deprecate `OnClearEventArgs::getEntityClass()` and `OnClearEventArgs::clearsAllEntities()`
1249
1250These methods will be removed in 3.0 along with the ability to partially clear
1251the entity manager.
1252
1253## Deprecate `Doctrine\ORM\Configuration::newDefaultAnnotationDriver`
1254
1255This functionality has been moved to the new `ORMSetup` class. Call
1256`Doctrine\ORM\ORMSetup::createDefaultAnnotationDriver()` to create
1257a new annotation driver.
1258
1259## Deprecate `Doctrine\ORM\Tools\Setup`
1260
1261In our effort to migrate from Doctrine Cache to PSR-6, the `Setup` class which
1262accepted a Doctrine Cache instance in each method has been deprecated.
1263
1264The replacement is `Doctrine\ORM\ORMSetup` which accepts a PSR-6
1265cache instead.
1266
1267## Deprecate `Doctrine\ORM\Cache\MultiGetRegion`
1268
1269The interface will be merged with `Doctrine\ORM\Cache\Region` in 3.0.
1270
1271# Upgrade to 2.11
1272
1273## Rename `AbstractIdGenerator::generate()` to `generateId()`
1274
1275Implementations of `AbstractIdGenerator` have to override the method
1276`generateId()` without calling the parent implementation. Not doing so is
1277deprecated. Calling `generate()` on any `AbstractIdGenerator` implementation
1278is deprecated.
1279
1280## PSR-6-based second level cache
1281
1282The second level cache has been reworked to consume a PSR-6 cache. Using a
1283Doctrine Cache instance is deprecated.
1284
1285* `DefaultCacheFactory`: The constructor expects a PSR-6 cache item pool as
1286 second argument now.
1287* `DefaultMultiGetRegion`: This class is deprecated in favor of `DefaultRegion`.
1288* `DefaultRegion`:
1289 * The constructor expects a PSR-6 cache item pool as second argument now.
1290 * The protected `$cache` property is deprecated.
1291 * The properties `$name` and `$lifetime` as well as the constant
1292 `REGION_KEY_SEPARATOR` and the method `getCacheEntryKey()` are flagged as
1293 `@internal` now. They all will become `private` in 3.0.
1294 * The method `getCache()` is deprecated without replacement.
1295
1296## Deprecated: `Doctrine\ORM\Mapping\Driver\PHPDriver`
1297
1298Use `StaticPHPDriver` instead when you want to programmatically configure
1299entity metadata.
1300
1301You can convert mappings with the `orm:convert-mapping` command or more simply
1302in this case, `include` the metadata file from the `loadMetadata` static method
1303used by the `StaticPHPDriver`.
1304
1305## Deprecated: `Setup::registerAutoloadDirectory()`
1306
1307Use Composer's autoloader instead.
1308
1309## Deprecated: `AbstractHydrator::hydrateRow()`
1310
1311Following the deprecation of the method `AbstractHydrator::iterate()`, the
1312method `hydrateRow()` has been deprecated as well.
1313
1314## Deprecate cache settings inspection
1315
1316Doctrine does not provide its own cache implementation anymore and relies on
1317the PSR-6 standard instead. As a consequence, we cannot determine anymore
1318whether a given cache adapter is suitable for a production environment.
1319Because of that, functionality that aims to do so has been deprecated:
1320
1321* `Configuration::ensureProductionSettings()`
1322* the `orm:ensure-production-settings` console command
1323
1324# Upgrade to 2.10
1325
1326## BC Break: `UnitOfWork` now relies on SPL object IDs, not hashes
1327
1328When calling the following methods, you are now supposed to use the result of
1329`spl_object_id()`, and not `spl_object_hash()`:
1330- `UnitOfWork::clearEntityChangeSet()`
1331- `UnitOfWork::setOriginalEntityProperty()`
1332
1333## BC Break: Removed `TABLE` id generator strategy
1334
1335The implementation was unfinished for 14 years.
1336It is now deprecated to rely on:
1337- `Doctrine\ORM\Id\TableGenerator`;
1338- `Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_TABLE`;
1339- `Doctrine\ORM\Mapping\ClassMetadata::$tableGeneratorDefinition`;
1340- or `Doctrine\ORM\Mapping\ClassMetadata::isIdGeneratorTable()`.
1341
1342## New method `Doctrine\ORM\EntityManagerInterface#wrapInTransaction($func)`
1343
1344Works the same as `Doctrine\ORM\EntityManagerInterface#transactional()` but returns any value returned from `$func` closure rather than just _non-empty value returned from the closure or true_.
1345
1346Because of BC policy, the method does not exist on the interface yet. This is the example of safe usage:
1347
1348```php
1349function foo(EntityManagerInterface $entityManager, callable $func) {
1350 if (method_exists($entityManager, 'wrapInTransaction')) {
1351 return $entityManager->wrapInTransaction($func);
1352 }
1353
1354 return $entityManager->transactional($func);
1355}
1356```
1357
1358`Doctrine\ORM\EntityManagerInterface#transactional()` has been deprecated.
1359
1360## Minor BC BREAK: some exception methods have been removed
1361
1362The following methods were not in use and are very unlikely to be used by
1363downstream packages or applications, and were consequently removed:
1364
1365- `ORMException::entityMissingForeignAssignedId`
1366- `ORMException::entityMissingAssignedIdForField`
1367- `ORMException::invalidFlushMode`
1368
1369## Deprecated: database-side UUID generation
1370
1371[DB-generated UUIDs are deprecated as of `doctrine/dbal` 2.8][DBAL deprecation].
1372As a consequence, using the `UUID` strategy for generating identifiers is deprecated as well.
1373Furthermore, relying on the following classes and methods is deprecated:
1374
1375- `Doctrine\ORM\Id\UuidGenerator`
1376- `Doctrine\ORM\Mapping\ClassMetadataInfo::isIdentifierUuid()`
1377
1378[DBAL deprecation]: https://github.com/doctrine/dbal/pull/3212
1379
1380## Minor BC BREAK: Custom hydrators and `toIterable()`
1381
1382The type declaration of the `$stmt` parameter of `AbstractHydrator::toIterable()` has been removed. This change might
1383break custom hydrator implementations that override this very method.
1384
1385Overriding this method is not recommended, which is why the method is documented as `@final` now.
1386
1387```diff
1388- public function toIterable(ResultStatement $stmt, ResultSetMapping $resultSetMapping, array $hints = []): iterable
1389+ public function toIterable($stmt, ResultSetMapping $resultSetMapping, array $hints = []): iterable
1390```
1391
1392## Deprecated: Entity Namespace Aliases
1393
1394Entity namespace aliases are deprecated, use the magic ::class constant to abbreviate full class names
1395in EntityManager, EntityRepository and DQL.
1396
1397```diff
1398- $entityManager->find('MyBundle:User', $id);
1399+ $entityManager->find(User::class, $id);
1400```
1401
1402# Upgrade to 2.9
1403
1404## Minor BC BREAK: Setup tool needs cache implementation
1405
1406With the deprecation of doctrine/cache, the setup tool might no longer work as expected without a different cache
1407implementation. To work around this:
1408* Install symfony/cache: `composer require symfony/cache`. This will keep previous behaviour without any changes
1409* Instantiate caches yourself: to use a different cache implementation, pass a cache instance when calling any
1410 configuration factory in the setup tool:
1411 ```diff
1412 - $config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode, $proxyDir);
1413 + $cache = \Doctrine\Common\Cache\Psr6\DoctrineProvider::wrap($anyPsr6Implementation);
1414 + $config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode, $proxyDir, $cache);
1415 ```
1416* As a quick workaround, you can lock the doctrine/cache dependency to work around this: `composer require doctrine/cache ^1.11`.
1417 Note that this is only recommended as a bandaid fix, as future versions of ORM will no longer work with doctrine/cache
1418 1.11.
1419
1420## Deprecated: doctrine/cache for metadata caching
1421
1422The `Doctrine\ORM\Configuration#setMetadataCacheImpl()` method is deprecated and should no longer be used. Please use
1423`Doctrine\ORM\Configuration#setMetadataCache()` with any PSR-6 cache adapter instead.
1424
1425## Removed: flushing metadata cache
1426
1427To support PSR-6 caches, the `--flush` option for the `orm:clear-cache:metadata` command is ignored. Metadata cache is
1428now always cleared regardless of the cache adapter being used.
1429
1430# Upgrade to 2.8
1431
1432## Minor BC BREAK: Failed commit now throw OptimisticLockException
1433
1434Method `Doctrine\ORM\UnitOfWork#commit()` can throw an OptimisticLockException when a commit silently fails and returns false
1435since `Doctrine\DBAL\Connection#commit()` signature changed from returning void to boolean
1436
1437## Deprecated: `Doctrine\ORM\AbstractQuery#iterate()`
1438
1439The method `Doctrine\ORM\AbstractQuery#iterate()` is deprecated in favor of `Doctrine\ORM\AbstractQuery#toIterable()`.
1440Note that `toIterable()` yields results of the query, unlike `iterate()` which yielded each result wrapped into an array.
1441
1442# Upgrade to 2.7
1443
1444## Added `Doctrine\ORM\AbstractQuery#enableResultCache()` and `Doctrine\ORM\AbstractQuery#disableResultCache()` methods
1445
1446Method `Doctrine\ORM\AbstractQuery#useResultCache()` which could be used for both enabling and disabling the cache
1447(depending on passed flag) was split into two.
1448
1449## Minor BC BREAK: paginator output walkers aren't be called anymore on sub-queries for queries without max results
1450
1451To optimize DB interaction, `Doctrine\ORM\Tools\Pagination\Paginator` no longer fetches identifiers to be able to
1452perform the pagination with join collections when max results isn't set in the query.
1453
1454## Minor BC BREAK: tables filtered with `schema_filter` are no longer created
1455
1456When generating schema diffs, if a source table is filtered out by a `schema_filter` expression, then a `CREATE TABLE` was
1457always generated, even if the table already existed. This has been changed in this release and the table will no longer
1458be created.
1459
1460## Deprecated number unaware `Doctrine\ORM\Mapping\UnderscoreNamingStrategy`
1461
1462In the last patch of the `v2.6.x` series, we fixed a bug that was not converting names properly when they had numbers
1463(e.g.: `base64Encoded` was wrongly converted to `base64encoded` instead of `base64_encoded`).
1464
1465In order to not break BC we've introduced a way to enable the fixed behavior using a boolean constructor argument. This
1466argument will be removed in 3.0 and the default behavior will be the fixed one.
1467
1468## Deprecated: `Doctrine\ORM\AbstractQuery#useResultCache()`
1469
1470Method `Doctrine\ORM\AbstractQuery#useResultCache()` is deprecated because it is split into `enableResultCache()`
1471and `disableResultCache()`. It will be removed in 3.0.
1472
1473## Deprecated code generators and related console commands
1474
1475These console commands have been deprecated:
1476
1477 * `orm:convert-mapping`
1478 * `orm:generate:entities`
1479 * `orm:generate-repositories`
1480
1481These classes have been deprecated:
1482
1483 * `Doctrine\ORM\Tools\EntityGenerator`
1484 * `Doctrine\ORM\Tools\EntityRepositoryGenerator`
1485
1486Whole Doctrine\ORM\Tools\Export namespace with all its members have been deprecated as well.
1487
1488## Deprecated `Doctrine\ORM\Proxy\Proxy` marker interface
1489
1490Proxy objects in Doctrine ORM 3.0 will no longer implement `Doctrine\ORM\Proxy\Proxy` nor
1491`Doctrine\Persistence\Proxy`: instead, they implement
1492`ProxyManager\Proxy\GhostObjectInterface`.
1493
1494These related classes have been deprecated:
1495
1496 * `Doctrine\ORM\Proxy\ProxyFactory`
1497 * `Doctrine\ORM\Proxy\Autoloader` - we suggest using the composer autoloader instead
1498
1499These methods have been deprecated:
1500
1501 * `Doctrine\ORM\Configuration#getAutoGenerateProxyClasses()`
1502 * `Doctrine\ORM\Configuration#getProxyDir()`
1503 * `Doctrine\ORM\Configuration#getProxyNamespace()`
1504
1505## Deprecated `Doctrine\ORM\Version`
1506
1507The `Doctrine\ORM\Version` class is now deprecated and will be removed in Doctrine ORM 3.0:
1508please refrain from checking the ORM version at runtime or use Composer's [runtime API](https://getcomposer.org/doc/07-runtime.md#knowing-whether-package-x-is-installed-in-version-y).
1509
1510## Deprecated `EntityManager#merge()` method
1511
1512Merge semantics was a poor fit for the PHP "share-nothing" architecture.
1513In addition to that, merging caused multiple issues with data integrity
1514in the managed entity graph, which was constantly spawning more edge-case bugs/scenarios.
1515
1516The following API methods were therefore deprecated:
1517
1518* `EntityManager#merge()`
1519* `UnitOfWork#merge()`
1520
1521An alternative to `EntityManager#merge()` will not be provided by ORM 3.0, since the merging
1522semantics should be part of the business domain rather than the persistence domain of an
1523application. If your application relies heavily on CRUD-alike interactions and/or `PATCH`
1524restful operations, you should look at alternatives such as [JMSSerializer](https://github.com/schmittjoh/serializer).
1525
1526## Extending `EntityManager` is deprecated
1527
1528Final keyword will be added to the `EntityManager::class` in Doctrine ORM 3.0 in order to ensure that EntityManager
1529 is not used as valid extension point. Valid extension point should be EntityManagerInterface.
1530
1531## Deprecated `EntityManager#clear($entityName)`
1532
1533If your code relies on clearing a single entity type via `EntityManager#clear($entityName)`,
1534the signature has been changed to `EntityManager#clear()`.
1535
1536The main reason is that partial clears caused multiple issues with data integrity
1537in the managed entity graph, which was constantly spawning more edge-case bugs/scenarios.
1538
1539## Deprecated `EntityManager#flush($entity)` and `EntityManager#flush($entities)`
1540
1541If your code relies on single entity flushing optimisations via
1542`EntityManager#flush($entity)`, the signature has been changed to
1543`EntityManager#flush()`.
1544
1545Said API was affected by multiple data integrity bugs due to the fact
1546that change tracking was being restricted upon a subset of the managed
1547entities. The ORM cannot support committing subsets of the managed
1548entities while also guaranteeing data integrity, therefore this
1549utility was removed.
1550
1551The `flush()` semantics will remain the same, but the change tracking will be performed
1552on all entities managed by the unit of work, and not just on the provided
1553`$entity` or `$entities`, as the parameter is now completely ignored.
1554
1555The same applies to `UnitOfWork#commit($entity)`, which will simply be
1556`UnitOfWork#commit()`.
1557
1558If you would still like to perform batching operations over small `UnitOfWork`
1559instances, it is suggested to follow these paths instead:
1560
1561 * eagerly use `EntityManager#clear()` in conjunction with a specific second level
1562 cache configuration (see http://docs.doctrine-project.org/projects/doctrine-orm/en/stable/reference/second-level-cache.html)
1563 * use an explicit change tracking policy (see http://docs.doctrine-project.org/projects/doctrine-orm/en/stable/reference/change-tracking-policies.html)
1564
1565## Deprecated `YAML` mapping drivers.
1566
1567If your code relies on `YamlDriver` or `SimpleYamlDriver`, you **MUST** change to
1568annotation or XML drivers instead.
1569
1570## Deprecated: `Doctrine\ORM\EntityManagerInterface#copy()`
1571
1572Method `Doctrine\ORM\EntityManagerInterface#copy()` never got its implementation and is deprecated.
1573It will be removed in 3.0.
1574
1575# Upgrade to 2.6
1576
1577## Added `Doctrine\ORM\EntityRepository::count()` method
1578
1579`Doctrine\ORM\EntityRepository::count()` has been added. This new method has different
1580signature than `Countable::count()` (required parameter) and therefore are not compatible.
1581If your repository implemented the `Countable` interface, you will have to use
1582`$repository->count([])` instead and not implement `Countable` interface anymore.
1583
1584## Minor BC BREAK: `Doctrine\ORM\Tools\Console\ConsoleRunner` is now final
1585
1586Since it's just an utilitarian class and should not be inherited.
1587
1588## Minor BC BREAK: removed `Doctrine\ORM\Query\QueryException::associationPathInverseSideNotSupported()`
1589
1590Method `Doctrine\ORM\Query\QueryException::associationPathInverseSideNotSupported()`
1591now has a required parameter `$pathExpr`.
1592
1593## Minor BC BREAK: removed `Doctrine\ORM\Query\Parser#isInternalFunction()`
1594
1595Method `Doctrine\ORM\Query\Parser#isInternalFunction()` was removed because
1596the distinction between internal function and user defined DQL was removed.
1597[#6500](https://github.com/doctrine/orm/pull/6500)
1598
1599## Minor BC BREAK: removed `Doctrine\ORM\ORMException#overwriteInternalDQLFunctionNotAllowed()`
1600
1601Method `Doctrine\ORM\Query\Parser#overwriteInternalDQLFunctionNotAllowed()` was
1602removed because of the choice to allow users to overwrite internal functions, ie
1603`AVG`, `SUM`, `COUNT`, `MIN` and `MAX`. [#6500](https://github.com/doctrine/orm/pull/6500)
1604
1605## PHP 7.1 is now required
1606
1607Doctrine 2.6 now requires PHP 7.1 or newer.
1608
1609As a consequence, automatic cache setup in Doctrine\ORM\Tools\Setup::create*Configuration() was changed:
1610- APCu extension (ext-apcu) will now be used instead of abandoned APC (ext-apc).
1611- Memcached extension (ext-memcached) will be used instead of obsolete Memcache (ext-memcache).
1612- XCache support was dropped as it doesn't work with PHP 7.
1613
1614# Upgrade to 2.5
1615
1616## Minor BC BREAK: removed `Doctrine\ORM\Query\SqlWalker#walkCaseExpression()`
1617
1618Method `Doctrine\ORM\Query\SqlWalker#walkCaseExpression()` was unused and part
1619of the internal API of the ORM, so it was removed. [#5600](https://github.com/doctrine/orm/pull/5600).
1620
1621## Minor BC BREAK: removed $className parameter on `AbstractEntityInheritancePersister#getSelectJoinColumnSQL()`
1622
1623As `$className` parameter was not used in the method, it was safely removed.
1624
1625## Minor BC BREAK: query cache key time is now a float
1626
1627As of 2.5.5, the `QueryCacheEntry#time` property will contain a float value
1628instead of an integer in order to have more precision and also to be consistent
1629with the `TimestampCacheEntry#time`.
1630
1631## Minor BC BREAK: discriminator map must now include all non-transient classes
1632
1633It is now required that you declare the root of an inheritance in the
1634discriminator map.
1635
1636When declaring an inheritance map, it was previously possible to skip the root
1637of the inheritance in the discriminator map. This was actually a validation
1638mistake by Doctrine2 and led to problems when trying to persist instances of
1639that class.
1640
1641If you don't plan to persist instances some classes in your inheritance, then
1642either:
1643
1644 - make those classes `abstract`
1645 - map those classes as `MappedSuperclass`
1646
1647## Minor BC BREAK: ``EntityManagerInterface`` instead of ``EntityManager`` in type-hints
1648
1649As of 2.5, classes requiring the ``EntityManager`` in any method signature will now require
1650an ``EntityManagerInterface`` instead.
1651If you are extending any of the following classes, then you need to check following
1652signatures:
1653
1654- ``Doctrine\ORM\Tools\DebugUnitOfWorkListener#dumpIdentityMap(EntityManagerInterface $em)``
1655- ``Doctrine\ORM\Mapping\ClassMetadataFactory#setEntityManager(EntityManagerInterface $em)``
1656
1657## Minor BC BREAK: Custom Hydrators API change
1658
1659As of 2.5, `AbstractHydrator` does not enforce the usage of cache as part of
1660API, and now provides you a clean API for column information through the method
1661`hydrateColumnInfo($column)`.
1662Cache variable being passed around by reference is no longer needed since
1663Hydrators are per query instantiated since Doctrine 2.4.
1664
1665## Minor BC BREAK: Entity based ``EntityManager#clear()`` calls follow cascade detach
1666
1667Whenever ``EntityManager#clear()`` method gets called with a given entity class
1668name, until 2.4, it was only detaching the specific requested entity.
1669As of 2.5, ``EntityManager`` will follow configured cascades, providing a better
1670memory management since associations will be garbage collected, optimizing
1671resources consumption on long running jobs.
1672
1673## BC BREAK: NamingStrategy interface changes
1674
16751. A new method ``embeddedFieldToColumnName($propertyName, $embeddedColumnName)``
1676
1677This method generates the column name for fields of embedded objects. If you implement your custom NamingStrategy, you
1678now also need to implement this new method.
1679
16802. A change to method ``joinColumnName()`` to include the $className
1681
1682## Updates on entities scheduled for deletion are no longer processed
1683
1684In Doctrine 2.4, if you modified properties of an entity scheduled for deletion, UnitOfWork would
1685produce an UPDATE statement to be executed right before the DELETE statement. The entity in question
1686was therefore present in ``UnitOfWork#entityUpdates``, which means that ``preUpdate`` and ``postUpdate``
1687listeners were (quite pointlessly) called. In ``preFlush`` listeners, it used to be possible to undo
1688the scheduled deletion for updated entities (by calling ``persist()`` if the entity was found in both
1689``entityUpdates`` and ``entityDeletions``). This does not work any longer, because the entire changeset
1690calculation logic is optimized away.
1691
1692## Minor BC BREAK: Default lock mode changed from LockMode::NONE to null in method signatures
1693
1694A misconception concerning default lock mode values in method signatures lead to unexpected behaviour
1695in SQL statements on SQL Server. With a default lock mode of ``LockMode::NONE`` throughout the
1696method signatures in ORM, the table lock hint ``WITH (NOLOCK)`` was appended to all locking related
1697queries by default. This could result in unpredictable results because an explicit ``WITH (NOLOCK)``
1698table hint tells SQL Server to run a specific query in transaction isolation level READ UNCOMMITTED
1699instead of the default READ COMMITTED transaction isolation level.
1700Therefore there now is a distinction between ``LockMode::NONE`` and ``null`` to be able to tell
1701Doctrine whether to add table lock hints to queries by intention or not. To achieve this, the following
1702method signatures have been changed to declare ``$lockMode = null`` instead of ``$lockMode = LockMode::NONE``:
1703
1704- ``Doctrine\ORM\Cache\Persister\AbstractEntityPersister#getSelectSQL()``
1705- ``Doctrine\ORM\Cache\Persister\AbstractEntityPersister#load()``
1706- ``Doctrine\ORM\Cache\Persister\AbstractEntityPersister#refresh()``
1707- ``Doctrine\ORM\Decorator\EntityManagerDecorator#find()``
1708- ``Doctrine\ORM\EntityManager#find()``
1709- ``Doctrine\ORM\EntityRepository#find()``
1710- ``Doctrine\ORM\Persisters\BasicEntityPersister#getSelectSQL()``
1711- ``Doctrine\ORM\Persisters\BasicEntityPersister#load()``
1712- ``Doctrine\ORM\Persisters\BasicEntityPersister#refresh()``
1713- ``Doctrine\ORM\Persisters\EntityPersister#getSelectSQL()``
1714- ``Doctrine\ORM\Persisters\EntityPersister#load()``
1715- ``Doctrine\ORM\Persisters\EntityPersister#refresh()``
1716- ``Doctrine\ORM\Persisters\JoinedSubclassPersister#getSelectSQL()``
1717
1718You should update signatures for these methods if you have subclassed one of the above classes.
1719Please also check the calling code of these methods in your application and update if necessary.
1720
1721**Note:**
1722This in fact is really a minor BC BREAK and should not have any affect on database vendors
1723other than SQL Server because it is the only one that supports and therefore cares about
1724``LockMode::NONE``. It's really just a FIX for SQL Server environments using ORM.
1725
1726## Minor BC BREAK: `__clone` method not called anymore when entities are instantiated via metadata API
1727
1728As of PHP 5.6, instantiation of new entities is deferred to the
1729[`doctrine/instantiator`](https://github.com/doctrine/instantiator) library, which will avoid calling `__clone`
1730or any public API on instantiated objects.
1731
1732## BC BREAK: `Doctrine\ORM\Repository\DefaultRepositoryFactory` is now `final`
1733
1734Please implement the `Doctrine\ORM\Repository\RepositoryFactory` interface instead of extending
1735the `Doctrine\ORM\Repository\DefaultRepositoryFactory`.
1736
1737## BC BREAK: New object expression DQL queries now respects user provided aliasing and not return consumed fields
1738
1739When executing DQL queries with new object expressions, instead of returning DTOs numerically indexes, it will now respect user provided aliases. Consider the following query:
1740
1741 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
1742
1743Previously, your result would be similar to this:
1744
1745 array(
1746 0=>array(
1747 0=>{UserDTO object},
1748 1=>{AddressDTO object},
1749 2=>{u.id scalar},
1750 3=>{u.name scalar},
1751 4=>{a.street scalar},
1752 5=>{a.postalCode scalar},
1753 'addressId'=>{a.id scalar},
1754 ),
1755 ...
1756 )
1757
1758From now on, the resultset will look like this:
1759
1760 array(
1761 0=>array(
1762 'user'=>{UserDTO object},
1763 'address'=>{AddressDTO object},
1764 'addressId'=>{a.id scalar}
1765 ),
1766 ...
1767 )
1768
1769## Minor BC BREAK: added second parameter $indexBy in EntityRepository#createQueryBuilder method signature
1770
1771Added way to access the underlying QueryBuilder#from() method's 'indexBy' parameter when using EntityRepository#createQueryBuilder()
1772
1773# Upgrade to 2.4
1774
1775## BC BREAK: Compatibility Bugfix in PersistentCollection#matching()
1776
1777In Doctrine 2.3 it was possible to use the new ``matching($criteria)``
1778functionality by adding constraints for assocations based on ID:
1779
1780 Criteria::expr()->eq('association', $assocation->getId());
1781
1782This functionality does not work on InMemory collections however, because
1783in memory criteria compares object values based on reference.
1784As of 2.4 the above code will throw an exception. You need to change
1785offending code to pass the ``$assocation`` reference directly:
1786
1787 Criteria::expr()->eq('association', $assocation);
1788
1789## Composer is now the default autoloader
1790
1791The test suite now runs with composer autoloading. Support for PEAR, and tarball autoloading is deprecated.
1792Support for GIT submodules is removed.
1793
1794## OnFlush and PostFlush event always called
1795
1796Before 2.4 the postFlush and onFlush events were only called when there were
1797actually entities that changed. Now these events are called no matter if there
1798are entities in the UoW or changes are found.
1799
1800## Parenthesis are now considered in arithmetic expression
1801
1802Before 2.4 parenthesis are not considered in arithmetic primary expression.
1803That's conceptually wrong, since it might result in wrong values. For example:
1804
1805The DQL:
1806
1807 SELECT 100 / ( 2 * 2 ) FROM MyEntity
1808
1809Before 2.4 it generates the SQL:
1810
1811 SELECT 100 / 2 * 2 FROM my_entity
1812
1813Now parenthesis are considered, the previous DQL will generate:
1814
1815 SELECT 100 / (2 * 2) FROM my_entity
1816
1817# Upgrade to 2.3
1818
1819## Auto Discriminator Map breaks userland implementations with Listener
1820
1821The new feature to detect discriminator maps automatically when none
1822are provided breaks userland implementations doing this with a
1823listener in ``loadClassMetadata`` event.
1824
1825## EntityManager#find() not calls EntityRepository#find() anymore
1826
1827Previous to 2.3, calling ``EntityManager#find()`` would be delegated to
1828``EntityRepository#find()``. This has lead to some unexpected behavior in the
1829core of Doctrine when people have overwritten the find method in their
1830repositories. That is why this behavior has been reversed in 2.3, and
1831``EntityRepository#find()`` calls ``EntityManager#find()`` instead.
1832
1833## EntityGenerator add*() method generation
1834
1835When generating an add*() method for a collection the EntityGenerator will now not
1836use the Type-Hint to get the singular for the collection name, but use the field-name
1837and strip a trailing "s" character if there is one.
1838
1839## Merge copies non persisted properties too
1840
1841When merging an entity in UoW not only mapped properties are copied, but also others.
1842
1843## Query, QueryBuilder and NativeQuery parameters *BC break*
1844
1845From now on, parameters in queries is an ArrayCollection instead of a simple array.
1846This affects heavily the usage of setParameters(), because it will not append anymore
1847parameters to query, but will actually override the already defined ones.
1848Whenever you are retrieving a parameter (ie. $query->getParameter(1)), you will
1849receive an instance of Query\Parameter, which contains the methods "getName",
1850"getValue" and "getType". Parameters are also only converted to when necessary, and
1851not when they are set.
1852
1853Also, related functions were affected:
1854
1855* execute($parameters, $hydrationMode) the argument $parameters can be either an key=>value array or an ArrayCollection instance
1856* iterate($parameters, $hydrationMode) the argument $parameters can be either an key=>value array or an ArrayCollection instance
1857* setParameters($parameters) the argument $parameters can be either an key=>value array or an ArrayCollection instance
1858* getParameters() now returns ArrayCollection instead of array
1859* getParameter($key) now returns Parameter instance instead of parameter value
1860
1861## Query TreeWalker method renamed
1862
1863Internal changes were made to DQL and SQL generation. If you have implemented your own TreeWalker,
1864you probably need to update it. The method walkJoinVariableDeclaration is now named walkJoin.
1865
1866## New methods in TreeWalker interface *BC break*
1867
1868Two methods getQueryComponents() and setQueryComponent() were added to the TreeWalker interface and all its implementations
1869including TreeWalkerAdapter, TreeWalkerChain and SqlWalker. If you have your own implementation not inheriting from one of the
1870above you must implement these new methods.
1871
1872## Metadata Drivers
1873
1874Metadata drivers have been rewritten to reuse code from `Doctrine\Persistence`. Anyone who is using the
1875`Doctrine\ORM\Mapping\Driver\Driver` interface should instead refer to
1876`Doctrine\Persistence\Mapping\Driver\MappingDriver`. Same applies to
1877`Doctrine\ORM\Mapping\Driver\AbstractFileDriver`: you should now refer to
1878`Doctrine\Persistence\Mapping\Driver\FileDriver`.
1879
1880Also, following mapping drivers have been deprecated, please use their replacements in Doctrine\Common as listed:
1881
1882 * `Doctrine\ORM\Mapping\Driver\DriverChain` => `Doctrine\Persistence\Mapping\Driver\MappingDriverChain`
1883 * `Doctrine\ORM\Mapping\Driver\PHPDriver` => `Doctrine\Persistence\Mapping\Driver\PHPDriver`
1884 * `Doctrine\ORM\Mapping\Driver\StaticPHPDriver` => `Doctrine\Persistence\Mapping\Driver\StaticPHPDriver`
1885
1886# Upgrade to 2.2
1887
1888## ResultCache implementation rewritten
1889
1890The result cache is completely rewritten and now works on the database result level, not inside the ORM AbstractQuery
1891anymore. This means that for result cached queries the hydration will now always be performed again, regardless of
1892the hydration mode. Affected areas are:
1893
18941. Fixes the problem that entities coming from the result cache were not registered in the UnitOfWork
1895 leading to problems during EntityManager#flush. Calls to EntityManager#merge are not necessary anymore.
18962. Affects the array hydrator which now includes the overhead of hydration compared to caching the final result.
1897
1898The API is backwards compatible however most of the getter methods on the `AbstractQuery` object are now
1899deprecated in favor of calling AbstractQuery#getQueryCacheProfile(). This method returns a `Doctrine\DBAL\Cache\QueryCacheProfile`
1900instance with access to result cache driver, lifetime and cache key.
1901
1902
1903## EntityManager#getPartialReference() creates read-only entity
1904
1905Entities returned from EntityManager#getPartialReference() are now marked as read-only if they
1906haven't been in the identity map before. This means objects of this kind never lead to changes
1907in the UnitOfWork.
1908
1909
1910## Fields omitted in a partial DQL query or a native query are never updated
1911
1912Fields of an entity that are not returned from a partial DQL Query or native SQL query
1913will never be updated through an UPDATE statement.
1914
1915
1916## Removed support for onUpdate in @JoinColumn
1917
1918The onUpdate foreign key handling makes absolutely no sense in an ORM. Additionally Oracle doesn't even support it. Support for it is removed.
1919
1920
1921## Changes in Annotation Handling
1922
1923There have been some changes to the annotation handling in Common 2.2 again, that affect how people with old configurations
1924from 2.0 have to configure the annotation driver if they don't use `Configuration::newDefaultAnnotationDriver()`:
1925
1926 // Register the ORM Annotations in the AnnotationRegistry
1927 AnnotationRegistry::registerFile('path/to/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php');
1928
1929 $reader = new \Doctrine\Common\Annotations\SimpleAnnotationReader();
1930 $reader->addNamespace('Doctrine\ORM\Mapping');
1931 $reader = new \Doctrine\Common\Annotations\CachedReader($reader, new ArrayCache());
1932
1933 $driver = new AnnotationDriver($reader, (array)$paths);
1934
1935 $config->setMetadataDriverImpl($driver);
1936
1937
1938## Scalar mappings can now be omitted from DQL result
1939
1940You are now allowed to mark scalar SELECT expressions as HIDDEN an they are not hydrated anymore.
1941Example:
1942
1943SELECT u, SUM(a.id) AS HIDDEN numArticles FROM User u LEFT JOIN u.Articles a ORDER BY numArticles DESC HAVING numArticles > 10
1944
1945Your result will be a collection of Users, and not an array with key 0 as User object instance and "numArticles" as the number of articles per user
1946
1947
1948## Map entities as scalars in DQL result
1949
1950When hydrating to array or even a mixed result in object hydrator, previously you had the 0 index holding you entity instance.
1951You are now allowed to alias this, providing more flexibility for you code.
1952Example:
1953
1954SELECT u AS user FROM User u
1955
1956Will now return a collection of arrays with index "user" pointing to the User object instance.
1957
1958
1959## Performance optimizations
1960
1961Thousands of lines were completely reviewed and optimized for best performance.
1962Removed redundancy and improved code readability made now internal Doctrine code easier to understand.
1963Also, Doctrine 2.2 now is around 10-15% faster than 2.1.
1964
1965## EntityManager#find(null)
1966
1967Previously EntityManager#find(null) returned null. It now throws an exception.
1968
1969# Upgrade to 2.1
1970
1971## Interface for EntityRepository
1972
1973The EntityRepository now has an interface Doctrine\Persistence\ObjectRepository. This means that your classes that override EntityRepository and extend find(), findOneBy() or findBy() must be adjusted to follow this interface.
1974
1975## AnnotationReader changes
1976
1977The annotation reader was heavily refactored between 2.0 and 2.1-RC1. In theory the operation of the new reader should be backwards compatible, but it has to be setup differently to work that way:
1978
1979 // new call to the AnnotationRegistry
1980 \Doctrine\Common\Annotations\AnnotationRegistry::registerFile('/doctrine-src/src/Mapping/Driver/DoctrineAnnotations.php');
1981
1982 $reader = new \Doctrine\Common\Annotations\AnnotationReader();
1983 $reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\');
1984 // new code necessary starting here
1985 $reader->setIgnoreNotImportedAnnotations(true);
1986 $reader->setEnableParsePhpImports(false);
1987 $reader = new \Doctrine\Common\Annotations\CachedReader(
1988 new \Doctrine\Common\Annotations\IndexedReader($reader), new ArrayCache()
1989 );
1990
1991This is already done inside the ``$config->newDefaultAnnotationDriver``, so everything should automatically work if you are using this method. You can verify if everything still works by executing a console command such as schema-validate that loads all metadata into memory.
1992
1993# Update from 2.0-BETA3 to 2.0-BETA4
1994
1995## XML Driver <change-tracking-policy /> element demoted to attribute
1996
1997We changed how the XML Driver allows to define the change-tracking-policy. The working case is now:
1998
1999 <entity change-tracking-policy="DEFERRED_IMPLICT" />
2000
2001# Update from 2.0-BETA2 to 2.0-BETA3
2002
2003## Serialization of Uninitialized Proxies
2004
2005As of Beta3 you can now serialize uninitialized proxies, an exception will only be thrown when
2006trying to access methods on the unserialized proxy as long as it has not been re-attached to the
2007EntityManager using `EntityManager#merge()`. See this example:
2008
2009 $proxy = $em->getReference('User', 1);
2010
2011 $serializedProxy = serialize($proxy);
2012 $detachedProxy = unserialized($serializedProxy);
2013
2014 echo $em->contains($detachedProxy); // FALSE
2015
2016 try {
2017 $detachedProxy->getId(); // uninitialized detached proxy
2018 } catch(Exception $e) {
2019
2020 }
2021 $attachedProxy = $em->merge($detachedProxy);
2022 echo $attackedProxy->getId(); // works!
2023
2024## Changed SQL implementation of Postgres and Oracle DateTime types
2025
2026The DBAL Type "datetime" included the Timezone Offset in both Postgres and Oracle. As of this version they are now
2027generated without Timezone (TIMESTAMP WITHOUT TIME ZONE instead of TIMESTAMP WITH TIME ZONE).
2028See [this comment to Ticket DBAL-22](http://www.doctrine-project.org/jira/browse/DBAL-22?focusedCommentId=13396&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_13396)
2029for more details as well as migration issues for PostgreSQL and Oracle.
2030
2031Both Postgres and Oracle will throw Exceptions during hydration of Objects with "DateTime" fields unless migration steps are taken!
2032
2033## Removed multi-dot/deep-path expressions in DQL
2034
2035The support for implicit joins in DQL through the multi-dot/Deep Path Expressions
2036was dropped. For example:
2037
2038 SELECT u FROM User u WHERE u.group.name = ?1
2039
2040See the "u.group.id" here is using multi dots (deep expression) to walk
2041through the graph of objects and properties. Internally the DQL parser
2042would rewrite these queries to:
2043
2044 SELECT u FROM User u JOIN u.group g WHERE g.name = ?1
2045
2046This explicit notation will be the only supported notation as of now. The internal
2047handling of multi-dots in the DQL Parser was very complex, error prone in edge cases
2048and required special treatment for several features we added. Additionally
2049it had edge cases that could not be solved without making the DQL Parser
2050even much more complex. For this reason we will drop the support for the
2051deep path expressions to increase maintainability and overall performance
2052of the DQL parsing process. This will benefit any DQL query being parsed,
2053even those not using deep path expressions.
2054
2055Note that the generated SQL of both notations is exactly the same! You
2056don't loose anything through this.
2057
2058## Default Allocation Size for Sequences
2059
2060The default allocation size for sequences has been changed from 10 to 1. This step was made
2061to not cause confusion with users and also because it is partly some kind of premature optimization.
2062
2063# Update from 2.0-BETA1 to 2.0-BETA2
2064
2065There are no backwards incompatible changes in this release.
2066
2067# Upgrade from 2.0-ALPHA4 to 2.0-BETA1
2068
2069## EntityRepository deprecates access to protected variables
2070
2071Instead of accessing protected variables for the EntityManager in
2072a custom EntityRepository it is now required to use the getter methods
2073for all the three instance variables:
2074
2075* `$this->_em` now accessible through `$this->getEntityManager()`
2076* `$this->_class` now accessible through `$this->getClassMetadata()`
2077* `$this->_entityName` now accessible through `$this->getEntityName()`
2078
2079Important: For Beta 2 the protected visibility of these three properties will be
2080changed to private!
2081
2082## Console migrated to Symfony Console
2083
2084The Doctrine CLI has been replaced by Symfony Console Configuration
2085
2086Instead of having to specify:
2087
2088 [php]
2089 $cliConfig = new CliConfiguration();
2090 $cliConfig->setAttribute('em', $entityManager);
2091
2092You now have to configure the script like:
2093
2094 [php]
2095 $helperSet = new \Symfony\Components\Console\Helper\HelperSet(array(
2096 'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
2097 'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
2098 ));
2099
2100## Console: No need for Mapping Paths anymore
2101
2102In previous versions you had to specify the --from and --from-path options
2103to show where your mapping paths are from the console. However this information
2104is already known from the Mapping Driver configuration, so the requirement
2105for this options were dropped.
2106
2107Instead for each console command all the entities are loaded and to
2108restrict the operation to one or more sub-groups you can use the --filter flag.
2109
2110## AnnotationDriver is not a default mapping driver anymore
2111
2112In conjunction with the recent changes to Console we realized that the
2113annotations driver being a default metadata driver lead to lots of glue
2114code in the console components to detect where entities lie and how to load
2115them for batch updates like SchemaTool and other commands. However the
2116annotations driver being a default driver does not really help that much
2117anyways.
2118
2119Therefore we decided to break backwards compatibility in this issue and drop
2120the support for Annotations as Default Driver and require our users to
2121specify the driver explicitly (which allows us to ask for the path to all
2122entities).
2123
2124If you are using the annotations metadata driver as default driver, you
2125have to add the following lines to your bootstrap code:
2126
2127 $driverImpl = $config->newDefaultAnnotationDriver(array(__DIR__."/Entities"));
2128 $config->setMetadataDriverImpl($driverImpl);
2129
2130You have to specify the path to your entities as either string of a single
2131path or array of multiple paths
2132to your entities. This information will be used by all console commands to
2133access all entities.
2134
2135Xml and Yaml Drivers work as before!
2136
2137
2138## New inversedBy attribute
2139
2140It is now *mandatory* that the owning side of a bidirectional association specifies the
2141'inversedBy' attribute that points to the name of the field on the inverse side that completes
2142the association. Example:
2143
2144 [php]
2145 // BEFORE (ALPHA4 AND EARLIER)
2146 class User
2147 {
2148 //...
2149 /** @OneToOne(targetEntity="Address", mappedBy="user") */
2150 private $address;
2151 //...
2152 }
2153 class Address
2154 {
2155 //...
2156 /** @OneToOne(targetEntity="User") */
2157 private $user;
2158 //...
2159 }
2160
2161 // SINCE BETA1
2162 // User class DOES NOT CHANGE
2163 class Address
2164 {
2165 //...
2166 /** @OneToOne(targetEntity="User", inversedBy="address") */
2167 private $user;
2168 //...
2169 }
2170
2171Thus, the inversedBy attribute is the counterpart to the mappedBy attribute. This change
2172was necessary to enable some simplifications and further performance improvements. We
2173apologize for the inconvenience.
2174
2175## Default Property for Field Mappings
2176
2177The "default" option for database column defaults has been removed. If desired, database column defaults can
2178be implemented by using the columnDefinition attribute of the @Column annotation (or the appropriate XML and YAML equivalents).
2179Prefer PHP default values, if possible.
2180
2181## Selecting Partial Objects
2182
2183Querying for partial objects now has a new syntax. The old syntax to query for partial objects
2184now has a different meaning. This is best illustrated by an example. If you previously
2185had a DQL query like this:
2186
2187 [sql]
2188 SELECT u.id, u.name FROM User u
2189
2190Since BETA1, simple state field path expressions in the select clause are used to select
2191object fields as plain scalar values (something that was not possible before).
2192To achieve the same result as previously (that is, a partial object with only id and name populated)
2193you need to use the following, explicit syntax:
2194
2195 [sql]
2196 SELECT PARTIAL u.{id,name} FROM User u
2197
2198## XML Mapping Driver
2199
2200The 'inheritance-type' attribute changed to take last bit of ClassMetadata constant names, i.e.
2201NONE, SINGLE_TABLE, INHERITANCE_TYPE_JOINED
2202
2203## YAML Mapping Driver
2204
2205The way to specify lifecycle callbacks in YAML Mapping driver was changed to allow for multiple callbacks
2206per event. The Old syntax ways:
2207
2208 [yaml]
2209 lifecycleCallbacks:
2210 doStuffOnPrePersist: prePersist
2211 doStuffOnPostPersist: postPersist
2212
2213The new syntax is:
2214
2215 [yaml]
2216 lifecycleCallbacks:
2217 prePersist: [ doStuffOnPrePersist, doOtherStuffOnPrePersistToo ]
2218 postPersist: [ doStuffOnPostPersist ]
2219
2220## PreUpdate Event Listeners
2221
2222Event Listeners listening to the 'preUpdate' event can only affect the primitive values of entity changesets
2223by using the API on the `PreUpdateEventArgs` instance passed to the preUpdate listener method. Any changes
2224to the state of the entitys properties won't affect the database UPDATE statement anymore. This gives drastic
2225performance benefits for the preUpdate event.
2226
2227## Collection API
2228
2229The Collection interface in the Common package has been updated with some missing methods
2230that were present only on the default implementation, ArrayCollection. Custom collection
2231implementations need to be updated to adhere to the updated interface.
2232
2233# Upgrade from 2.0-ALPHA3 to 2.0-ALPHA4
2234
2235## CLI Controller changes
2236
2237CLI main object changed its name and namespace. Renamed from Doctrine\ORM\Tools\Cli to Doctrine\Common\Cli\CliController.
2238Doctrine\Common\Cli\CliController now only deals with namespaces. Ready to go, Core, Dbal and Orm are available and you can subscribe new tasks by retrieving the namespace and including new task. Example:
2239
2240 [php]
2241 $cli->getNamespace('Core')->addTask('my-example', '\MyProject\Tools\Cli\Tasks\MyExampleTask');
2242
2243
2244## CLI Tasks documentation
2245
2246Tasks have implemented a new way to build documentation. Although it is still possible to define the help manually by extending the basicHelp and extendedHelp, they are now optional.
2247With new required method AbstractTask::buildDocumentation, its implementation defines the TaskDocumentation instance (accessible through AbstractTask::getDocumentation()), basicHelp and extendedHelp are now not necessary to be implemented.
2248
2249## Changes in Method Signatures
2250
2251 * A bunch of Methods on both Doctrine\DBAL\Platforms\AbstractPlatform and Doctrine\DBAL\Schema\AbstractSchemaManager
2252 have changed quite significantly by adopting the new Schema instance objects.
2253
2254## Renamed Methods
2255
2256 * Doctrine\ORM\AbstractQuery::setExpireResultCache() -> expireResultCache()
2257 * Doctrine\ORM\Query::setExpireQueryCache() -> expireQueryCache()
2258
2259## SchemaTool Changes
2260
2261 * "doctrine schema-tool --drop" now always drops the complete database instead of
2262 only those tables defined by the current database model. The previous method had
2263 problems when foreign keys of orphaned tables pointed to tables that were scheduled
2264 for deletion.
2265 * Use "doctrine schema-tool --update" to get a save incremental update for your
2266 database schema without deleting any unused tables, sequences or foreign keys.
2267 * Use "doctrine schema-tool --complete-update" to do a full incremental update of
2268 your schema.
2269# Upgrade from 2.0-ALPHA2 to 2.0-ALPHA3
2270
2271This section details the changes made to Doctrine 2.0-ALPHA3 to make it easier for you
2272to upgrade your projects to use this version.
2273
2274## CLI Changes
2275
2276The $args variable used in the cli-config.php for configuring the Doctrine CLI has been renamed to $globalArguments.
2277
2278## Proxy class changes
2279
2280You are now required to make supply some minimalist configuration with regards to proxy objects. That involves 2 new configuration options. First, the directory where generated proxy classes should be placed needs to be specified. Secondly, you need to configure the namespace used for proxy classes. The following snippet shows an example:
2281
2282 [php]
2283 // step 1: configure directory for proxy classes
2284 // $config instanceof Doctrine\ORM\Configuration
2285 $config->setProxyDir('/path/to/myproject/lib/MyProject/Generated/Proxies');
2286 $config->setProxyNamespace('MyProject\Generated\Proxies');
2287
2288Note that proxy classes behave exactly like any other classes when it comes to class loading. Therefore you need to make sure the proxy classes can be loaded by some class loader. If you place the generated proxy classes in a namespace and directory under your projects class files, like in the example above, it would be sufficient to register the MyProject namespace on a class loader. Since the proxy classes are contained in that namespace and adhere to the standards for class loading, no additional work is required.
2289Generating the proxy classes into a namespace within your class library is the recommended setup.
2290
2291Entities with initialized proxy objects can now be serialized and unserialized properly from within the same application.
2292
2293For more details refer to the Configuration section of the manual.
2294
2295## Removed allowPartialObjects configuration option
2296
2297The allowPartialObjects configuration option together with the `Configuration#getAllowPartialObjects` and `Configuration#setAllowPartialObjects` methods have been removed.
2298The new behavior is as if the option were set to FALSE all the time, basically disallowing partial objects globally. However, you can still use the `Query::HINT_FORCE_PARTIAL_LOAD` query hint to force a query to return partial objects for optimization purposes.
2299
2300## Renamed Methods
2301
2302* Doctrine\ORM\Configuration#getCacheDir() to getProxyDir()
2303* Doctrine\ORM\Configuration#setCacheDir($dir) to setProxyDir($dir)