Compare commits

...

111 Commits

Author SHA1 Message Date
Alexander M. Turek 827cb0c10b Address DBAL 3.4 deprecations (#9969) 2022-08-07 18:11:43 +02:00
Vincent Langlet 4d19c0ea71 Improve phpdoc for ClassMetadataInfo (#9965) 2022-08-07 16:00:01 +00:00
Alexander M. Turek 17cfb944f2 Merge branch '2.12.x' into 2.13.x
* 2.12.x:
  Fix build (#9964)
  fix: class normalisation test (#9966)
2022-08-07 17:39:22 +02:00
Romain Canon 33f4db8405 Support native enum hydration when using NEW operator (#9936)
Using the `NEW` operator with the query builder now properly converts
scalar values to native enums inside data transfer objects.
2022-08-04 00:33:46 +02:00
Alexander M. Turek fa63a395cc Merge branch '2.12.x' into 2.13.x
* 2.12.x:
  Update branch info in README and .doctrine-project.json (#9943)
2022-08-02 22:35:33 +02:00
Alexander M. Turek 2ec2c585b0 Deprecate QueryBuilder APIs exposing its internal state (#9945)
Co-authored-by: Sergei Morozov <morozov@tut.by>
2022-08-01 11:42:24 +02:00
Alexander M. Turek cd95b2a9e5 Merge branch '2.12.x' into 2.13.x
* 2.12.x:
  Psalm 4.25.0, PHPStan 1.8.2 (#9941)
  Use a more precise phpdoc for ClassMetadataInfo::versionField than mixed (#9937)
2022-07-28 19:38:58 +02:00
Grégoire Paris 38a9a1c795 Stop passing event manager to constructor (#9938)
Co-authored-by: Alexander M. Turek <me@derrabus.de>
2022-07-28 16:47:04 +00:00
Grégoire Paris 2ebe18a822 Merge pull request #9915 from nicolas-grekas/pub-em 2022-07-28 14:55:34 +02:00
Nicolas Grekas 518d7f2ef1 Make EntityManager @final and its constructor public 2022-07-27 17:15:40 +02:00
Alexander M. Turek 7684cea8ef Add helper function TreeWalkerAdapter::getMetadataForDqlAlias() (#9932) 2022-07-25 20:54:31 +02:00
Alexander M. Turek 5085dbe94b Merge 2.12.x into 2.13.x (#9931) 2022-07-25 18:49:29 +02:00
Grégoire Paris 2da28703e3 Merge pull request #9903 from glaszig/fix/dump-sql
schema tool: remove useless text from --dump-sql output
2022-07-19 23:13:51 +02:00
glaszig 20cec8ed79 schema tool: remove useless text from --dump-sql output
the description and semantics of the `--dump-sql` switch
indicate and sql dump. without that useless line

  The following SQL statements will be executed:

the output can actually be used to generate a plain
dump.sql file that can be fed into sql command-
consuming programs.

resolves #8263 and #7186.
2022-07-19 19:33:48 +00:00
Grégoire Paris c125a856d0 Merge pull request #9914 from greg0ire/fix-build
Avoid supportsCreateDropDatabase()
2022-07-18 23:00:38 +02:00
Grégoire Paris d7db596cb4 Avoid supportsCreateDropDatabase()
It has been deprecated.
2022-07-18 22:42:13 +02:00
Grégoire Paris 3a9aa5b8c6 Merge pull request #9910 from doctrine/2.12.x
Merge 2.12.x up into 2.13.x
2022-07-18 21:31:50 +02:00
Grégoire Paris 61d405162f Merge pull request #9906 from franmomu/deprecate_lifecycleevent
Deprecate `LifecycleEventArgs`
2022-07-17 17:35:37 +02:00
Fran Moreno b0f15e070d Deprecate LifecycleEventArgs
Use LifecycleEventArgs from doctrine/persistence instead.
2022-07-17 12:06:10 +02:00
Grégoire Paris fbb7e24594 Merge pull request #9895 from greg0ire/avoid-sql-assertions
Avoid SQL assertions
2022-07-14 19:09:32 +02:00
Grégoire Paris 888a4a8eff Avoid SQL assertions
doctrine/dbal is the component responsible for generating the queries.
Let us make the test suite more robust by asserting that things work
from a functional point of view.
2022-07-12 08:01:19 +02:00
Grégoire Paris 48b4f63f61 Merge pull request #9893 from greg0ire/2.13.x
Merge 2.12.x up into 2.13.x
2022-07-10 23:18:39 +02:00
Grégoire Paris 4a62b661a5 Merge remote-tracking branch 'origin/2.12.x' into 2.13.x 2022-07-10 23:07:44 +02:00
Alexander M. Turek 1538d70bb9 Merge branch '2.12.x' into 2.13.x
* 2.12.x:
  PHPStan 1.8.0 (#9887)
  Fix typo in AbstractQuery
  ObjectHydrator: defer initialization of potentially empty collections
  Migrate more usages of SchemaTool::createSchema()
  preUpdate: Add restriction that changed field needs to be in computed changeset (#9871)
2022-07-08 13:54:43 +02:00
Grégoire Paris 68405f3e5b Merge pull request #9876 from franmomu/extend_event_manager_args
Change parent classes in some events
2022-07-04 19:21:56 +02:00
Fran Moreno eea53397c5 Change parent classes
*FlushEventArgs classes should extend ManagerEventArgs from
doctrine/persistence to be able to use ManagerEventArgs for any
persistance implementation.

OnClearEventArgs should extend from OnClearEventArgs from
doctrine/persistence.
2022-07-02 14:27:36 +02:00
Alexander M. Turek dc8ddfd3e6 Merge branch '2.12.x' into 2.13.x
* 2.12.x:
  Psalm 4.24.0, PHPStan 1.7.15 (#9865)
  PHP CodeSniffer 3.7.1, PHPStan 1.7.14 (#9858)
2022-06-28 13:35:26 +02:00
Hans Mackowiak b931a59ebc Deprecate omitting the alias in QueryBuilder (#9765)
… methods update() and delete()

Co-authored-by: Alexander M. Turek <me@derrabus.de>
2022-06-17 10:33:11 +02:00
Alexander M. Turek d15eef9051 Merge release 2.12.3 into 2.13.x (#9853) 2022-06-17 10:22:16 +02:00
Grégoire Paris 5ccb59fa02 Merge pull request #9839 from morozov/list-tables
Use proper API for introspection of tables
2022-06-11 22:41:41 +02:00
Sergei Morozov 2e927970ca Use proper API for introspection of tables 2022-06-11 12:13:25 -07:00
Grégoire Paris 0366a5796f Merge pull request #9837 from greg0ire/address-getdbplatform-deprecation
Address deprecation of getDatabasePlatform()
2022-06-10 20:14:06 +02:00
Grégoire Paris 93f7e78a14 Address deprecation of getDatabasePlatform() 2022-06-10 19:57:50 +02:00
Grégoire Paris d99e64c05e Merge pull request #9833 from greg0ire/deprecate-sequence-based-ig 2022-06-10 10:09:33 +02:00
Grégoire Paris 9efeefb913 Merge pull request #9826 from greg0ire/improve-phpdoc-configuration
Improve phpdoc for Configuration
2022-06-09 23:53:12 +02:00
Grégoire Paris 3f8430459c Deprecate reliance on sequence-emulated identity columns
Sequence-based identity values have been deprecated.
2022-06-09 23:46:50 +02:00
Grégoire Paris 5f12b8f7de Remove uneeded rule form baseline 2022-06-09 08:13:54 +02:00
Grégoire Paris f949b9d212 Improve phpdoc for Configuration 2022-06-09 08:09:41 +02:00
Grégoire Paris 2bc0be6fa9 Merge remote-tracking branch 'origin/2.12.x' into 2.13.x 2022-06-09 07:47:32 +02:00
Alexander M. Turek ddede4064c Merge 2.12.x into 2.13.x (#9811) 2022-06-03 13:22:41 +02:00
Grégoire Paris 1d02289481 Merge pull request #9809 from greg0ire/disallow-null-setFirstResult
Deprecate passing null to Query::setFirstResult()
2022-06-03 07:51:04 +02:00
Alexander M. Turek 4bd0f974ab Remove calls to deprecated MockBuilder::setMethods() (#9808) 2022-06-02 23:48:47 +02:00
Grégoire Paris d0c582ca48 Deprecate passing null to Query::setFirstResult()
The argument is cast to an integer, so the user might as well pass 0
instead, and we can require an integer.
2022-06-02 22:29:01 +02:00
Alexander M. Turek cc6cc26f18 Rename Abstract*Test to *TestCase (#9806) 2022-06-02 16:33:33 +02:00
Grégoire Paris deb5f49413 Merge pull request #9804 from greg0ire/2.13.x
Merge 2.12.x up into 2.13.x
2022-06-02 07:14:42 +02:00
Grégoire Paris 52ce39f595 Merge pull request #9801 from greg0ire/widen-types
Widen types
2022-06-02 07:13:58 +02:00
Grégoire Paris f84ecb2842 Merge pull request #9794 from VincentLanglet/associationMapping
Add type for AssociationMapping
2022-06-01 23:37:00 +02:00
Grégoire Paris b2fedaef9e Merge remote-tracking branch 'origin/2.12.x' into 2.13.x 2022-06-01 22:49:10 +02:00
Grégoire Paris 6fb88e1496 Widen return type
This type is so complex that it is not going to bring much value to the
consumer of this method. Let us widen it to mixed.
2022-06-01 19:56:25 +02:00
Sergei Morozov 3ac5f119aa Merge pull request #9799 from morozov/sqlite-fk
Prep work for enabling support for foreign keys on SQLite
2022-06-01 06:19:47 -07:00
Sergei Morozov 01fb82b497 Prep work for enabling support for foreign keys on SQLite 2022-05-30 18:45:43 -07:00
Alexander M. Turek 4f1072e1ac Add missing import (#9796) 2022-05-31 00:42:03 +02:00
Alexander M. Turek a559563682 Deprecate calling setters without arguments (#9791) 2022-05-30 20:39:06 +02:00
Vincent Langlet 0f9cc194ae Update baseline 2022-05-29 20:27:26 +02:00
Vincent Langlet 2513a1e2b1 Fix 2022-05-29 20:16:12 +02:00
Vincent Langlet 4230214ced Add type for AssociationMapping 2022-05-29 13:17:04 +02:00
Alexander M. Turek fb1f258736 Move duplicate fixture into dedicated file (#9789) 2022-05-27 15:08:21 +02:00
Alexander M. Turek e66fbc434d MockTreeWalker should be an SqlWalker (#9790) 2022-05-27 00:15:30 +02:00
Grégoire Paris 0f6f752887 Merge pull request #9777 from greg0ire/improve-phpdoc-abstract-query
Make phpdoc more precise for AbstractQuery
2022-05-24 20:42:40 +02:00
Grégoire Paris c1dd1cfc2c Make phpdoc more precise 2022-05-24 20:42:10 +02:00
Grégoire Paris 3684d236f6 Deprecate setting fetch mode to random integers 2022-05-24 20:42:08 +02:00
Alexander M. Turek bba6c696f5 Prepare split of output walkers and tree walkers (#9786) 2022-05-24 18:34:40 +00:00
Alexander M. Turek e02e6f481b Merge branch '2.12.x' into 2.13.x
* 2.12.x:
  PHPStan 1.7.0 (#9785)
2022-05-24 00:43:35 +02:00
Grégoire Paris 507bc514ce Merge pull request #9784 from greg0ire/deprecate-no-op
Deprecate passing null to Query::setDQL()
2022-05-23 22:31:50 +02:00
Grégoire Paris 1ae5de5409 Deprecate passing null to Query::setDQL()
It is a no-op.
2022-05-23 22:11:16 +02:00
Alexander M. Turek 82508956fe Kill call_user_func(_array) (#9780) 2022-05-23 16:28:32 +02:00
Alexander M. Turek a131878814 Merge branch '2.12.x' into 2.13.x
* 2.12.x:
  Fix wrong types for AbstractQuery and child classes (#9774)
  Document callable as possible
  Add use statement (#9769)
2022-05-23 11:29:26 +02:00
Grégoire Paris 5601c2ce4b Merge pull request #9775 from greg0ire/no-override
Remove override phpdoc tag
2022-05-23 07:48:01 +02:00
Grégoire Paris 1141fe106f Remove override phpdoc tag
Given how little occurrences there are, signalling method overrides with
this tag is probably not something we do everywhere. Besides, it does
not seem to be standard.

See https://docs.phpdoc.org/3.0/guide/references/phpdoc/tags/index.html#tag-reference
2022-05-22 16:28:41 +02:00
Grégoire Paris 779f9c36fa Merge pull request #9766 from greg0ire/non-nullable-arg-ns
Document future argument better
2022-05-18 08:00:17 +02:00
Grégoire Paris 0908f92629 Document future argument better
That argument is always provided, so the tests should provide it and the
commented out argument should reflect the future.
2022-05-17 12:09:31 +02:00
Grégoire Paris 24badd60fb Merge pull request #9761 from greg0ire/fix-phpdoc-ns
Fix phpdoc and tests for NamingStrategy
2022-05-16 22:00:41 +02:00
Sergei Morozov f2d794f8bc Merge pull request #9762 from morozov/schema-manager-database-platform
Do not call AbstractSchemaManager::getDatabasePlatform()
2022-05-16 08:31:45 -07:00
Sergei Morozov 7311f77dfe Do not call AbstractSchemaManager::getDatabasePlatform() 2022-05-15 19:25:51 -07:00
Grégoire Paris 16afa45abf Make tests more realistic
These tests were using the fact that some arguments of some methods of
the naming strategy interface are optional or nullable for now to avoid
providing some. In practice, these arguments are always provided, and
that should also be the case in tests.
2022-05-14 17:31:45 +02:00
Grégoire Paris 8b4d25e94f Handle self-refencing entities
When computing a foreign key column name, the referenced column name
may be null in the case of a self referencing entity with join columns
defined in the mapping.
2022-05-14 16:56:19 +02:00
Grégoire Paris 70087782e8 Merge pull request #9756 from greg0ire/more-precise-phpdoc-ns
Document types as they are passed
2022-05-12 09:05:51 +02:00
Grégoire Paris dbc5a818e0 Document types as they are passed
Some arguments have been added afterwards which was a BC break for
implementing classes. I do not think they should have been introduced as
optional.
2022-05-11 21:36:44 +02:00
Alexander M. Turek 31a9c9c49b Update Psalm baseline (#9751) 2022-05-10 16:00:54 +02:00
Alexander M. Turek 125afb8e39 Merge branch '2.12.x' into 2.13.x
* 2.12.x:
  Omit version number in README (#9749)
2022-05-10 15:08:24 +02:00
Grégoire Paris 2c30fe6e5b Merge pull request #9748 from doctrine/2.12.x
Merge 2.12.x up into 2.13.x
2022-05-10 08:21:34 +02:00
Grégoire Paris 6757bdf8c6 Deprecate omitting second argument to joinColumnName() (#9747)
* fix headings

* Deprecate omitting second argument to joinColumnName()
2022-05-10 00:37:44 +02:00
Sergei Morozov 636712a928 Merge pull request #9737 from morozov/dbal-4-compatibility
Improve compatibility with DBAL 4 for MySQL, MariaDB and PostgreSQL
2022-05-07 07:42:14 -07:00
Sergei Morozov 0aa91c7140 Pass sequence name to AbstractPlatform::getDropSequenceSQL()
See https://github.com/doctrine/dbal/pull/4797
2022-05-06 19:15:06 -07:00
Sergei Morozov c2f3831b85 Specify length for string columns
See https://github.com/doctrine/dbal/pull/3586
2022-05-06 19:15:06 -07:00
Sergei Morozov 2af52f6a18 Inherit parent column length regardless of the type
See https://github.com/doctrine/dbal/pull/3586
2022-05-06 19:15:05 -07:00
Sergei Morozov 0a79ddf344 Cast column length to int in XML annotation driver
See https://github.com/doctrine/dbal/pull/3511
2022-05-06 19:15:05 -07:00
Sergei Morozov 165c8bd6dd Do not use AbstractSchemaManager::dropAndCreateTable()
See https://github.com/doctrine/dbal/pull/4933
2022-05-06 19:15:03 -07:00
Sergei Morozov e6bda4afda Merge pull request #9730 from morozov/dbal-4-compatibility
Forward compatibility with DBAL 4
2022-05-05 14:06:25 -07:00
Sergei Morozov 51b4e02873 Obtain database platform from the connection, not from the driver
See https://github.com/doctrine/dbal/pull/4764
2022-05-05 11:30:36 -07:00
Sergei Morozov 1915dcd1e8 Use zero as the default query offset
See https://github.com/doctrine/dbal/pull/3574
2022-05-05 11:30:35 -07:00
Sergei Morozov 480d99b107 Use getStringTypeDeclarationSQL() instead of getVarcharTypeDeclarationSQL()
See https://github.com/doctrine/dbal/pull/3586
2022-05-05 11:30:35 -07:00
Sergei Morozov c6661caaed Do not extend a type with a different PHP return type
See https://github.com/doctrine/dbal/pull/5043
2022-05-05 11:30:34 -07:00
Sergei Morozov 9e27370f15 Drop and create test database manually
See https://github.com/doctrine/dbal/pull/4933
2022-05-05 11:30:32 -07:00
Sergei Morozov 1a3fbcb145 Lookup type name in the registry
See https://github.com/doctrine/dbal/pull/5208
2022-05-05 09:32:38 -07:00
Sergei Morozov c950e72628 Do not use null column definition 2022-05-05 09:32:37 -07:00
Alexander M. Turek 05560f260c Merge release 2.12.2 into 2.13.x (#9725) 2022-05-03 02:15:35 +02:00
Ruud Kamphuis d7d6b9d2c7 Allow setting column options like charset and collation everywhere (#9655)
This makes it possible to set custom options on the following:
* `JoinTable`
* `JoinColumn`
* `InverseJoinColumn`
2022-05-02 19:01:24 +02:00
Alexander M. Turek a02642e3e6 Merge branch '2.12.x' into 2.13.x
* 2.12.x:
  Psalm 4.23, PHPStan 1.6.3 (#9718)
2022-05-02 11:09:12 +02:00
Grégoire Paris b4da0ece41 Merge pull request #9704 from greg0ire/reference-cmi-less-and-less
Reference ClassMetadataInfo less and less
2022-05-01 22:06:19 +02:00
Sergei Morozov 3980d58b80 Merge pull request #9710 from morozov/2.13.x
Merge 2.12.x into 2.13.x
2022-05-01 12:46:13 -07:00
Sergei Morozov 10cbb24649 Merge branch '2.12.x' into 2.13.x 2022-05-01 12:24:28 -07:00
Grégoire Paris 476a02075f Deprecate classes and methods removed in 3.0 2022-04-30 19:47:20 +02:00
Grégoire Paris 98e10906f8 Change class metadata type declarations
There is a guarantee in the call sites that we are only passing
ClassMetadata instances.
2022-04-30 19:47:20 +02:00
Grégoire Paris 7241b4d2e0 Reference constants from ClassMetadata 2022-04-30 19:47:20 +02:00
Grégoire Paris b8db858784 Deprecate not passing ClassMetadata instances 2022-04-30 19:47:20 +02:00
Grégoire Paris d8f3198ef8 Merge pull request #9693 from doctrine/2.12.x
Merge 2.12.x up into 2.13.x
2022-04-29 08:13:20 +02:00
Alexander M. Turek 825e9641fd Merge branch '2.12.x' into 2.13.x
* 2.12.x:
  PHPStan 1.6.1 (#9688)
  Drop SymfonyStyle[listing] for sqls (#9679)
2022-04-27 09:53:50 +02:00
Alexander M. Turek 5fbe5ebef4 Merge 2.12.x into 2.13.x (#9684) 2022-04-26 11:32:14 +02:00
Grégoire Paris f4585b954f Merge pull request #6728 from greg0ire/validate_xml_against_xsd
Validate XML mapping against XSD file
2022-04-25 23:04:26 +02:00
Grégoire Paris ab3a255440 Validate XML mapping against XSD file
Co-Authored-By: Axel Venet <avenet@wamiz.com>
Co-authored-by: Luís Cobucci <lcobucci@gmail.com>
2022-04-25 22:55:00 +02:00
360 changed files with 3884 additions and 2194 deletions
+217
View File
@@ -1,3 +1,220 @@
# Upgrade to 2.13
## Deprecated `QueryBuilder` methods and constants.
1. The `QueryBuilder::getState()` method has been deprecated as the builder state is an internal concern.
2. Relying on the type of the query being built by using `QueryBuilder::getType()` has been deprecated.
If necessary, track the type of the query being built outside of the builder.
The following `QueryBuilder` constants related to the above methods have been deprecated:
1. `SELECT`,
2. `DELETE`,
3. `UPDATE`,
4. `STATE_DIRTY`,
5. `STATE_CLEAN`.
## Deprecated omitting only the alias argument for `QueryBuilder::update` and `QueryBuilder::delete`
When building an UPDATE or DELETE query and when passing a class/type to the function, the alias argument must not be omitted.
### Before
```php
$qb = $em->createQueryBuilder()
->delete('User u')
->where('u.id = :user_id')
->setParameter('user_id', 1);
```
### After
```php
$qb = $em->createQueryBuilder()
->delete('User', 'u')
->where('u.id = :user_id')
->setParameter('user_id', 1);
```
## Deprecated using the `IDENTITY` identifier strategy on platform that do not support identity columns
If identity columns are emulated with sequences on the platform you are using,
you should switch to the `SEQUENCE` strategy.
## Deprecated passing `null` to `Doctrine\ORM\Query::setFirstResult()`
`$query->setFirstResult(null);` is equivalent to `$query->setFirstResult(0)`.
## Deprecated calling setters without arguments
The following methods will require an argument in 3.0. Pass `null` instead of
omitting the argument.
* `Doctrine\ORM\Event\OnClassMetadataNotFoundEventArgs::setFoundMetadata()`
* `Doctrine\ORM\AbstractQuery::setHydrationCacheProfile()`
* `Doctrine\ORM\AbstractQuery::setResultCache()`
* `Doctrine\ORM\AbstractQuery::setResultCacheProfile()`
## Deprecated passing invalid fetch modes to `AbstractQuery::setFetchMode()`
Calling `AbstractQuery::setFetchMode()` with anything else than
`Doctrine\ORM\Mapping::FETCH_EAGER` results in
`Doctrine\ORM\Mapping::FETCH_LAZY` being used. Relying on that behavior is
deprecated and will result in an exception in 3.0.
## Deprecated `getEntityManager()` in `Doctrine\ORM\Event\OnClearEventArgs` and `Doctrine\ORM\Event\*FlushEventArgs`
This method has been deprecated in:
* `Doctrine\ORM\Event\OnClearEventArgs`
* `Doctrine\ORM\Event\OnFlushEventArgs`
* `Doctrine\ORM\Event\PostFlushEventArgs`
* `Doctrine\ORM\Event\PreFlushEventArgs`
It will be removed in 3.0. Use `getObjectManager()` instead.
## Deprecated `Doctrine\ORM\Event\LifecycleEventArgs` class
It will be removed in 3.0. Use `Doctrine\Persistence\Event\LifecycleEventArgs` instead.
## Prepare split of output walkers and tree walkers
In 3.0, `SqlWalker` and its child classes won't implement the `TreeWalker`
interface anymore. Relying on that inheritance is deprecated.
The following methods of the `TreeWalker` interface have been deprecated:
* `setQueryComponent()`
* `walkSelectClause()`
* `walkFromClause()`
* `walkFunction()`
* `walkOrderByClause()`
* `walkOrderByItem()`
* `walkHavingClause()`
* `walkJoin()`
* `walkSelectExpression()`
* `walkQuantifiedExpression()`
* `walkSubselect()`
* `walkSubselectFromClause()`
* `walkSimpleSelectClause()`
* `walkSimpleSelectExpression()`
* `walkAggregateExpression()`
* `walkGroupByClause()`
* `walkGroupByItem()`
* `walkDeleteClause()`
* `walkUpdateClause()`
* `walkUpdateItem()`
* `walkWhereClause()`
* `walkConditionalExpression()`
* `walkConditionalTerm()`
* `walkConditionalFactor()`
* `walkConditionalPrimary()`
* `walkExistsExpression()`
* `walkCollectionMemberExpression()`
* `walkEmptyCollectionComparisonExpression()`
* `walkNullComparisonExpression()`
* `walkInExpression()`
* `walkInstanceOfExpression()`
* `walkLiteral()`
* `walkBetweenExpression()`
* `walkLikeExpression()`
* `walkStateFieldPathExpression()`
* `walkComparisonExpression()`
* `walkInputParameter()`
* `walkArithmeticExpression()`
* `walkArithmeticTerm()`
* `walkStringPrimary()`
* `walkArithmeticFactor()`
* `walkSimpleArithmeticExpression()`
* `walkPathExpression()`
* `walkResultVariable()`
* `getExecutor()`
The following changes have been made to the abstract `TreeWalkerAdapter` class:
* All implementations of now-deprecated `TreeWalker` methods have been
deprecated as well.
* The method `setQueryComponent()` will become protected in 3.0. Calling it
publicly is deprecated.
* The method `_getQueryComponents()` is deprecated, call `getQueryComponents()`
instead.
On the `TreeWalkerChain` class, all implementations of now-deprecated
`TreeWalker` methods have been deprecated as well. However, `SqlWalker` is
unaffected by those deprecations and will continue to implement all of those
methods.
## Deprecated passing `null` to `Doctrine\ORM\Query::setDQL()`
Doing `$query->setDQL(null);` achieves nothing.
## Deprecated omitting second argument to `NamingStrategy::joinColumnName`
When implementing `NamingStrategy`, it is deprecated to implement
`joinColumnName()` with only one argument.
### Before
```php
<?php
class MyStrategy implements NamingStrategy
{
/**
* @param string $propertyName A property name.
*/
public function joinColumnName($propertyName): string
{
// …
}
}
```
### After
For backward-compatibility reasons, the parameter has to be optional, but can
be documented as guaranteed to be a `class-string`.
```php
<?php
class MyStrategy implements NamingStrategy
{
/**
* @param string $propertyName A property name.
* @param class-string $className
*/
public function joinColumnName($propertyName, $className = null): string
{
// …
}
}
```
## Deprecated methods related to named queries
The following methods have been deprecated:
- `Doctrine\ORM\Query\ResultSetMappingBuilder::addNamedNativeQueryMapping()`
- `Doctrine\ORM\Query\ResultSetMappingBuilder::addNamedNativeQueryResultClassMapping()`
- `Doctrine\ORM\Query\ResultSetMappingBuilder::addNamedNativQueryResultSetMapping()`
- `Doctrine\ORM\Query\ResultSetMappingBuilder::addNamedNativQueryEntityResultMapping()`
## Deprecated classes related to Doctrine 1 and reverse engineering
The following classes have been deprecated:
- `Doctrine\ORM\Tools\ConvertDoctrine1Schema`
- `Doctrine\ORM\Tools\DisconnectedClassMetadataFactory`
## Deprecate `ClassMetadataInfo` usage
It is deprecated to pass `Doctrine\ORM\Mapping\ClassMetadataInfo` instances
that are not also instances of `Doctrine\ORM\ClassMetadata` to the following
methods:
- `Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder::__construct()`
- `Doctrine\ORM\Mapping\Driver\DatabaseDriver::loadMetadataForClass()`
- `Doctrine\ORM\Tools\SchemaValidator::validateClass()`
# Upgrade to 2.12
## Deprecated the `doctrine` binary.
+1
View File
@@ -54,6 +54,7 @@
"doctrine/annotations": "<1.13 || >= 2.0"
},
"suggest": {
"ext-dom": "Provides support for XSD validation for XML mapping files",
"symfony/cache": "Provides cache support for Setup Tool with doctrine/cache 2.0",
"symfony/yaml": "If you want to use YAML Metadata Mapping Driver"
},
@@ -87,12 +87,12 @@ Such an interface could look like this:
* @return \Zend_View_Helper_Interface
*/
public function setView(\Zend_View_Interface $view);
/**
* @return \Zend_View_Interface
*/
public function getView();
/**
* Renders this strategy. This method will be called when the user
* displays the site.
@@ -100,7 +100,7 @@ Such an interface could look like this:
* @return string
*/
public function renderFrontend();
/**
* Renders the backend of this block. This method will be called when
* a user tries to reconfigure this block instance.
@@ -118,21 +118,21 @@ Such an interface could look like this:
* @return array
*/
public function getRequiredPanelTypes();
/**
* Determines whether a Block is able to use a given type or not
* @param string $typeName The typename
* @return boolean
*/
public function canUsePanelType($typeName);
public function setBlockEntity(AbstractBlock $block);
public function getBlockEntity();
}
As you can see, we have a method "setBlockEntity" which ties a potential strategy to an object of type AbstractBlock. This type will simply define the basic behaviour of our blocks and could potentially look something like this:
.. code-block:: php
<?php
@@ -177,7 +177,7 @@ As you can see, we have a method "setBlockEntity" which ties a potential strateg
public function getStrategyClassName() {
return $this->strategyClassName;
}
/**
* Returns the instantiated strategy
*
@@ -186,7 +186,7 @@ As you can see, we have a method "setBlockEntity" which ties a potential strateg
public function getStrategyInstance() {
return $this->strategyInstance;
}
/**
* Sets the strategy this block / panel should work as. Make sure that you've used
* this method before persisting the block!
@@ -213,28 +213,29 @@ This might look like this:
.. code-block:: php
<?php
use \Doctrine\ORM,
\Doctrine\Common;
use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\Events;
use Doctrine\Persistence\Event\LifecycleEventArgs;
/**
* The BlockStrategyEventListener will initialize a strategy after the
* block itself was loaded.
*/
class BlockStrategyEventListener implements Common\EventSubscriber {
class BlockStrategyEventListener implements EventSubscriber {
protected $view;
public function __construct(\Zend_View_Interface $view) {
$this->view = $view;
}
public function getSubscribedEvents() {
return array(ORM\Events::postLoad);
return array(Events::postLoad);
}
public function postLoad(ORM\Event\LifecycleEventArgs $args) {
$blockItem = $args->getEntity();
public function postLoad(LifecycleEventArgs $args) {
$blockItem = $args->getObject();
// Both blocks and panels are instances of Block\AbstractBlock
if ($blockItem instanceof Block\AbstractBlock) {
$strategy = $blockItem->getStrategyClassName();
@@ -207,6 +207,8 @@ Optional parameters:
- ``comment``: The comment of the column in the schema (might not
be supported by all vendors).
- ``charset``: The charset of the column (only supported by Mysql, PostgreSQL, Sqlite and SQLServer).
- ``collation``: The collation of the column (only supported by Mysql, PostgreSQL, Sqlite and SQLServer).
- ``check``: Adds a check constraint type to the column (might not
@@ -681,6 +683,8 @@ Optional parameters:
"columnDefinition" attribute on :ref:`#[Column] <attrref_column>` also sets
the related ``#[JoinColumn]``'s columnDefinition. This is necessary to
make foreign keys work.
- **options**:
See "options" attribute on :ref:`#[Column] <attrref_column>`.
Example:
+2 -2
View File
@@ -756,7 +756,7 @@ An entity listener is a lifecycle listener class used for an entity.
.. configuration-block::
.. code-block:: attribute
<?php
namespace MyProject\Entity;
use App\EventListener\UserListener;
@@ -830,9 +830,9 @@ you need to map the listener method using the event type mapping:
.. code-block:: php
<?php
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\PreUpdateEventArgs;
use Doctrine\ORM\Event\PreFlushEventArgs;
use Doctrine\Persistence\Event\LifecycleEventArgs;
class UserListener
{
+42 -9
View File
@@ -32,6 +32,8 @@ use function array_map;
use function array_shift;
use function assert;
use function count;
use function func_num_args;
use function in_array;
use function is_array;
use function is_numeric;
use function is_object;
@@ -325,7 +327,7 @@ abstract class AbstractQuery
/**
* Gets a query parameter.
*
* @param mixed $key The key (index or name) of the bound parameter.
* @param int|string $key The key (index or name) of the bound parameter.
*
* @return Parameter|null The value of the bound parameter, or NULL if not available.
*/
@@ -401,8 +403,7 @@ abstract class AbstractQuery
*
* @param mixed $value
*
* @return mixed[]|string|int|float|bool|object|null
* @psalm-return array|scalar|object|null
* @return mixed
*
* @throws ORMInvalidArgumentException
*/
@@ -547,6 +548,15 @@ abstract class AbstractQuery
public function setHydrationCacheProfile(?QueryCacheProfile $profile = null)
{
if ($profile === null) {
if (func_num_args() < 1) {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9791',
'Calling %s without arguments is deprecated, pass null instead.',
__METHOD__
);
}
$this->_hydrationCacheProfile = null;
return $this;
@@ -591,6 +601,15 @@ abstract class AbstractQuery
public function setResultCacheProfile(?QueryCacheProfile $profile = null)
{
if ($profile === null) {
if (func_num_args() < 1) {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9791',
'Calling %s without arguments is deprecated, pass null instead.',
__METHOD__
);
}
$this->_queryCacheProfile = null;
return $this;
@@ -645,6 +664,15 @@ abstract class AbstractQuery
public function setResultCache(?CacheItemPoolInterface $resultCache = null)
{
if ($resultCache === null) {
if (func_num_args() < 1) {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9791',
'Calling %s without arguments is deprecated, pass null instead.',
__METHOD__
);
}
if ($this->_queryCacheProfile) {
$this->_queryCacheProfile = new QueryCacheProfile($this->_queryCacheProfile->getLifetime(), $this->_queryCacheProfile->getCacheKey());
}
@@ -817,17 +845,22 @@ abstract class AbstractQuery
/**
* Change the default fetch mode of an association for this query.
*
* $fetchMode can be one of ClassMetadata::FETCH_EAGER or ClassMetadata::FETCH_LAZY
*
* @param string $class
* @param string $assocName
* @param int $fetchMode
* @param class-string $class
* @param string $assocName
* @param int $fetchMode
* @psalm-param Mapping\ClassMetadata::FETCH_EAGER|Mapping\ClassMetadata::FETCH_LAZY $fetchMode
*
* @return $this
*/
public function setFetchMode($class, $assocName, $fetchMode)
{
if ($fetchMode !== Mapping\ClassMetadata::FETCH_EAGER) {
if (! in_array($fetchMode, [Mapping\ClassMetadata::FETCH_EAGER, Mapping\ClassMetadata::FETCH_LAZY], true)) {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9777',
'Calling %s() with something else than ClassMetadata::FETCH_EAGER or ClassMetadata::FETCH_LAZY is deprecated.',
__METHOD__
);
$fetchMode = Mapping\ClassMetadata::FETCH_LAZY;
}
+13 -8
View File
@@ -37,6 +37,7 @@ use Doctrine\ORM\Mapping\EntityListenerResolver;
use Doctrine\ORM\Mapping\NamingStrategy;
use Doctrine\ORM\Mapping\QuoteStrategy;
use Doctrine\ORM\Proxy\ProxyFactory;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Filter\SQLFilter;
use Doctrine\ORM\Query\ResultSetMapping;
use Doctrine\ORM\Repository\DefaultRepositoryFactory;
@@ -103,6 +104,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Sets the strategy for automatically generating proxy classes.
*
* @param bool|int $autoGenerate Possible values are constants of Doctrine\Common\Proxy\AbstractProxyFactory.
* @psalm-param bool|AutogenerateMode $autoGenerate
* True is converted to AUTOGENERATE_ALWAYS, false to AUTOGENERATE_NEVER.
*
* @return void
@@ -592,8 +594,9 @@ class Configuration extends \Doctrine\DBAL\Configuration
*
* DQL function names are case-insensitive.
*
* @param string $name Function name.
* @param string|callable $className Class name or a callable that returns the function.
* @param string $name Function name.
* @param class-string|callable $className Class name or a callable that returns the function.
* @psalm-param class-string<FunctionNode>|callable(string):FunctionNode $className
*
* @return void
*/
@@ -608,7 +611,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
* @param string $name
*
* @return string|callable|null
* @psalm-return class-string|callable|null
* @psalm-return class-string<FunctionNode>|callable(string):FunctionNode|null
*/
public function getCustomStringFunction($name)
{
@@ -625,7 +628,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
*
* Any previously added string functions are discarded.
*
* @psalm-param array<string, class-string|callable> $functions The map of custom DQL string functions.
* @psalm-param array<string, class-string<FunctionNode>|callable(string):FunctionNode> $functions The map of custom
* DQL string functions.
*
* @return void
*/
@@ -643,8 +647,9 @@ class Configuration extends \Doctrine\DBAL\Configuration
*
* DQL function names are case-insensitive.
*
* @param string $name Function name.
* @param string|callable $className Class name or a callable that returns the function.
* @param string $name Function name.
* @param class-string|callable $className Class name or a callable that returns the function.
* @psalm-param class-string<FunctionNode>|callable(string):FunctionNode $className
*
* @return void
*/
@@ -697,7 +702,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
*
* @param string $name Function name.
* @param string|callable $className Class name or a callable that returns the function.
* @psalm-param class-string|callable $className
* @psalm-param class-string<FunctionNode>|callable(string):FunctionNode $className
*
* @return void
*/
@@ -730,7 +735,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Any previously added date/time functions are discarded.
*
* @param array $functions The map of custom DQL date/time functions.
* @psalm-param array<string, string> $functions
* @psalm-param array<string, class-string<FunctionNode>|callable(string):FunctionNode> $functions
*
* @return void
*/
+11 -10
View File
@@ -35,7 +35,6 @@ use InvalidArgumentException;
use Throwable;
use function array_keys;
use function call_user_func;
use function class_exists;
use function get_debug_type;
use function gettype;
@@ -71,8 +70,10 @@ use function strpos;
* is not a valid extension point for the EntityManager. Instead you
* should take a look at the {@see \Doctrine\ORM\Decorator\EntityManagerDecorator}
* and wrap your entity manager in a decorator.
*
* @final
*/
/* final */class EntityManager implements EntityManagerInterface
class EntityManager implements EntityManagerInterface
{
/**
* The used Configuration.
@@ -155,11 +156,15 @@ use function strpos;
* Creates a new EntityManager that operates on the given database connection
* and uses the given Configuration and EventManager implementations.
*/
protected function __construct(Connection $conn, Configuration $config, EventManager $eventManager)
public function __construct(Connection $conn, Configuration $config)
{
if (! $config->getMetadataDriverImpl()) {
throw MissingMappingDriverImplementation::create();
}
$this->conn = $conn;
$this->config = $config;
$this->eventManager = $eventManager;
$this->eventManager = $conn->getEventManager();
$metadataFactoryClassName = $config->getClassMetadataFactoryName();
@@ -242,7 +247,7 @@ use function strpos;
$this->conn->beginTransaction();
try {
$return = call_user_func($func, $this);
$return = $func($this);
$this->flush();
$this->conn->commit();
@@ -959,13 +964,9 @@ use function strpos;
*/
public static function create($connection, Configuration $config, ?EventManager $eventManager = null)
{
if (! $config->getMetadataDriverImpl()) {
throw MissingMappingDriverImplementation::create();
}
$connection = static::createConnection($connection, $config, $eventManager);
return new EntityManager($connection, $config, $connection->getEventManager());
return new EntityManager($connection, $config);
}
/**
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Doctrine\ORM\Event;
use Doctrine\Deprecations\Deprecation;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\Event\LifecycleEventArgs as BaseLifecycleEventArgs;
@@ -11,27 +12,63 @@ use Doctrine\Persistence\Event\LifecycleEventArgs as BaseLifecycleEventArgs;
* Lifecycle Events are triggered by the UnitOfWork during lifecycle transitions
* of entities.
*
* @deprecated This class will be removed in ORM 3.0. Use "\Doctrine\Persistence\Event\LifecycleEventArgs" instead.
*
* @extends BaseLifecycleEventArgs<EntityManagerInterface>
*/
class LifecycleEventArgs extends BaseLifecycleEventArgs
{
/**
* @param object $object
*/
public function __construct($object, EntityManagerInterface $objectManager)
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/orm',
'https://github.com/doctrine/orm/issues/9875',
'The %s class is deprecated and will be removed in ORM 3.0. Use %s instead.',
self::class,
BaseLifecycleEventArgs::class
);
parent::__construct($object, $objectManager);
}
/**
* Retrieves associated Entity.
*
* @deprecated 2.13. Use {@see getObject} instead.
*
* @return object
*/
public function getEntity()
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/issues/9875',
'Method %s() is deprecated and will be removed in Doctrine ORM 3.0. Use getObjectManager() instead.',
__METHOD__
);
return $this->getObject();
}
/**
* Retrieves associated EntityManager.
*
* @deprecated 2.13. Use {@see getObjectManager} instead.
*
* @return EntityManagerInterface
*/
public function getEntityManager()
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/issues/9875',
'Method %s() is deprecated and will be removed in Doctrine ORM 3.0. Use getObjectManager() instead.',
__METHOD__
);
return $this->getObjectManager();
}
}
@@ -4,11 +4,14 @@ declare(strict_types=1);
namespace Doctrine\ORM\Event;
use Doctrine\Deprecations\Deprecation;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\Event\ManagerEventArgs;
use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\Persistence\ObjectManager;
use function func_num_args;
/**
* Class that holds event arguments for a `onClassMetadataNotFound` event.
*
@@ -41,6 +44,15 @@ class OnClassMetadataNotFoundEventArgs extends ManagerEventArgs
*/
public function setFoundMetadata(?ClassMetadata $classMetadata = null)
{
if (func_num_args() < 1) {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9791',
'Calling %s without arguments is deprecated, pass null instead.',
__METHOD__
);
}
$this->foundMetadata = $classMetadata;
}
+17 -7
View File
@@ -4,19 +4,19 @@ declare(strict_types=1);
namespace Doctrine\ORM\Event;
use Doctrine\Common\EventArgs;
use Doctrine\Deprecations\Deprecation;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\Event\OnClearEventArgs as BaseOnClearEventArgs;
/**
* Provides event arguments for the onClear event.
*
* @link www.doctrine-project.org
*
* @extends BaseOnClearEventArgs<EntityManagerInterface>
*/
class OnClearEventArgs extends EventArgs
class OnClearEventArgs extends BaseOnClearEventArgs
{
/** @var EntityManagerInterface */
private $em;
/** @var string|null */
private $entityClass;
@@ -25,18 +25,28 @@ class OnClearEventArgs extends EventArgs
*/
public function __construct(EntityManagerInterface $em, $entityClass = null)
{
$this->em = $em;
parent::__construct($em);
$this->entityClass = $entityClass;
}
/**
* Retrieves associated EntityManager.
*
* @deprecated 2.13. Use {@see getObjectManager} instead.
*
* @return EntityManagerInterface
*/
public function getEntityManager()
{
return $this->em;
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/issues/9875',
'Method %s() is deprecated and will be removed in Doctrine ORM 3.0. Use getObjectManager() instead.',
__METHOD__
);
return $this->getObjectManager();
}
/**
+15 -11
View File
@@ -4,31 +4,35 @@ declare(strict_types=1);
namespace Doctrine\ORM\Event;
use Doctrine\Common\EventArgs;
use Doctrine\Deprecations\Deprecation;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\Event\ManagerEventArgs;
/**
* Provides event arguments for the preFlush event.
*
* @link www.doctrine-project.org
*
* @extends ManagerEventArgs<EntityManagerInterface>
*/
class OnFlushEventArgs extends EventArgs
class OnFlushEventArgs extends ManagerEventArgs
{
/** @var EntityManagerInterface */
private $em;
public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
}
/**
* Retrieve associated EntityManager.
*
* @deprecated 2.13. Use {@see getObjectManager} instead.
*
* @return EntityManagerInterface
*/
public function getEntityManager()
{
return $this->em;
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/issues/9875',
'Method %s() is deprecated and will be removed in Doctrine ORM 3.0. Use getObjectManager() instead.',
__METHOD__
);
return $this->getObjectManager();
}
}
+15 -11
View File
@@ -4,31 +4,35 @@ declare(strict_types=1);
namespace Doctrine\ORM\Event;
use Doctrine\Common\EventArgs;
use Doctrine\Deprecations\Deprecation;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\Event\ManagerEventArgs;
/**
* Provides event arguments for the postFlush event.
*
* @link www.doctrine-project.org
*
* @extends ManagerEventArgs<EntityManagerInterface>
*/
class PostFlushEventArgs extends EventArgs
class PostFlushEventArgs extends ManagerEventArgs
{
/** @var EntityManagerInterface */
private $em;
public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
}
/**
* Retrieves associated EntityManager.
*
* @deprecated 2.13. Use {@see getObjectManager} instead.
*
* @return EntityManagerInterface
*/
public function getEntityManager()
{
return $this->em;
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/issues/9875',
'Method %s() is deprecated and will be removed in Doctrine ORM 3.0. Use getObjectManager() instead.',
__METHOD__
);
return $this->getObjectManager();
}
}
+15 -11
View File
@@ -4,29 +4,33 @@ declare(strict_types=1);
namespace Doctrine\ORM\Event;
use Doctrine\Common\EventArgs;
use Doctrine\Deprecations\Deprecation;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\Event\ManagerEventArgs;
/**
* Provides event arguments for the preFlush event.
*
* @link www.doctrine-project.com
*
* @extends ManagerEventArgs<EntityManagerInterface>
*/
class PreFlushEventArgs extends EventArgs
class PreFlushEventArgs extends ManagerEventArgs
{
/** @var EntityManagerInterface */
private $em;
public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
}
/**
* @deprecated 2.13. Use {@see getObjectManager} instead.
*
* @return EntityManagerInterface
*/
public function getEntityManager()
{
return $this->em;
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/issues/9875',
'Method %s() is deprecated and will be removed in Doctrine ORM 3.0. Use getObjectManager() instead.',
__METHOD__
);
return $this->getObjectManager();
}
}
@@ -108,7 +108,7 @@ class PreUpdateEventArgs extends LifecycleEventArgs
throw new InvalidArgumentException(sprintf(
'Field "%s" is not a valid field of the entity "%s" in PreUpdateEventArgs.',
$field,
get_debug_type($this->getEntity())
get_debug_type($this->getObject())
));
}
}
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Doctrine\ORM\Id;
use Doctrine\Deprecations\Deprecation;
use Doctrine\ORM\EntityManagerInterface;
/**
@@ -27,6 +28,15 @@ class BigIntegerIdentityGenerator extends AbstractIdGenerator
*/
public function __construct($sequenceName = null)
{
if ($sequenceName !== null) {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/issues/8850',
'Passing a sequence name to the IdentityGenerator is deprecated in favor of using %s. $sequenceName will be removed in ORM 3.0',
SequenceGenerator::class
);
}
$this->sequenceName = $sequenceName;
}
+10
View File
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Doctrine\ORM\Id;
use Doctrine\Deprecations\Deprecation;
use Doctrine\ORM\EntityManagerInterface;
/**
@@ -27,6 +28,15 @@ class IdentityGenerator extends AbstractIdGenerator
*/
public function __construct($sequenceName = null)
{
if ($sequenceName !== null) {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/issues/8850',
'Passing a sequence name to the IdentityGenerator is deprecated in favor of using %s. $sequenceName will be removed in ORM 3.0',
SequenceGenerator::class
);
}
$this->sequenceName = $sequenceName;
}
@@ -423,6 +423,10 @@ abstract class AbstractHydrator
$type = $cacheKeyInfo['type'];
$value = $type->convertToPHPValue($value, $this->_platform);
if ($value !== null && isset($cacheKeyInfo['enumType'])) {
$value = $this->buildEnum($value, $cacheKeyInfo['enumType']);
}
$rowData['newObjects'][$objIndex]['class'] = $cacheKeyInfo['class'];
$rowData['newObjects'][$objIndex]['args'][$argIndex] = $value;
break;
@@ -431,16 +435,8 @@ abstract class AbstractHydrator
$type = $cacheKeyInfo['type'];
$value = $type->convertToPHPValue($value, $this->_platform);
// Reimplement ReflectionEnumProperty code
if ($value !== null && isset($cacheKeyInfo['enumType'])) {
$enumType = $cacheKeyInfo['enumType'];
if (is_array($value)) {
$value = array_map(static function ($value) use ($enumType): BackedEnum {
return $enumType::from($value);
}, $value);
} else {
$value = $enumType::from($value);
}
$value = $this->buildEnum($value, $cacheKeyInfo['enumType']);
}
$rowData['scalars'][$fieldName] = $value;
@@ -580,6 +576,7 @@ abstract class AbstractHydrator
'argIndex' => $mapping['argIndex'],
'objIndex' => $mapping['objIndex'],
'class' => new ReflectionClass($mapping['className']),
'enumType' => $this->_rsm->enumMappings[$key] ?? null,
];
case isset($this->_rsm->scalarMappings[$key], $this->_hints[LimitSubqueryWalker::FORCE_DBAL_TYPE_CONVERSION]):
@@ -688,4 +685,21 @@ abstract class AbstractHydrator
$this->_em->getUnitOfWork()->registerManaged($entity, $id, $data);
}
/**
* @param mixed $value
* @param class-string<BackedEnum> $enumType
*
* @return BackedEnum|array<BackedEnum>
*/
private function buildEnum($value, string $enumType)
{
if (is_array($value)) {
return array_map(static function ($value) use ($enumType): BackedEnum {
return $enumType::from($value);
}, $value);
}
return $enumType::from($value);
}
}
@@ -4,9 +4,12 @@ declare(strict_types=1);
namespace Doctrine\ORM\Mapping\Builder;
use Doctrine\Deprecations\Deprecation;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use function get_class;
/**
* Builder Object for ClassMetadata
*
@@ -19,6 +22,17 @@ class ClassMetadataBuilder
public function __construct(ClassMetadataInfo $cm)
{
if (! $cm instanceof ClassMetadata) {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/249',
'Passing an instance of %s to %s is deprecated, please pass a ClassMetadata instance instead.',
get_class($cm),
__METHOD__,
ClassMetadata::class
);
}
$this->cm = $cm;
}
@@ -33,6 +33,7 @@ use function class_exists;
use function count;
use function end;
use function explode;
use function get_class;
use function in_array;
use function is_subclass_of;
use function str_contains;
@@ -225,7 +226,7 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
$this->evm->dispatchEvent(Events::loadClassMetadata, $eventArgs);
}
if ($class->changeTrackingPolicy === ClassMetadataInfo::CHANGETRACKING_NOTIFY) {
if ($class->changeTrackingPolicy === ClassMetadata::CHANGETRACKING_NOTIFY) {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/issues/8383',
@@ -558,6 +559,18 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
// Platforms that do not have native IDENTITY support need a sequence to emulate this behaviour.
if ($this->getTargetPlatform()->usesSequenceEmulatedIdentityColumns()) {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/issues/8850',
<<<'DEPRECATION'
Context: Loading metadata for class %s
Problem: Using the IDENTITY generator strategy with platform "%s" is deprecated and will not be possible in Doctrine ORM 3.0.
Solution: Use the SEQUENCE generator strategy instead.
DEPRECATION
,
$class->name,
get_class($this->getTargetPlatform())
);
$columnName = $class->getSingleIdentifierColumnName();
$quoted = isset($class->fieldMappings[$fieldName]['quoted']) || isset($class->table['quoted']);
$sequencePrefix = $class->getSequencePrefix($this->getTargetPlatform());
+52 -7
View File
@@ -97,6 +97,51 @@ use const PHP_VERSION_ID;
* declaredField?: string,
* options?: array<string, mixed>
* }
* @psalm-type JoinColumnData = array{
* name: string,
* referencedColumnName: string,
* unique?: bool,
* quoted?: bool,
* fieldName?: string,
* onDelete?: string,
* columnDefinition?: string,
* nullable?: bool,
* }
* @psalm-type AssociationMapping = array{
* cache?: array,
* cascade: array<string>,
* declared?: class-string,
* fetch: mixed,
* fieldName: string,
* id?: bool,
* inherited?: class-string,
* indexBy?: string,
* inversedBy: string|null,
* isCascadeRemove: bool,
* isCascadePersist: bool,
* isCascadeRefresh: bool,
* isCascadeMerge: bool,
* isCascadeDetach: bool,
* isOnDeleteCascade?: bool,
* isOwningSide: bool,
* joinColumns?: array<JoinColumnData>,
* joinColumnFieldNames?: array<string, string>,
* joinTable?: array,
* joinTableColumns?: list<mixed>,
* mappedBy: string|null,
* orderBy?: array,
* originalClass?: class-string,
* originalField?: string,
* orphanRemoval?: bool,
* relationToSourceKeyColumns?: array,
* relationToTargetKeyColumns?: array,
* sourceEntity: class-string,
* sourceToTargetKeyColumns?: array<string, string>,
* targetEntity: class-string,
* targetToSourceKeyColumns?: array<string, string>,
* type: int,
* unique?: bool,
* }
*/
class ClassMetadataInfo implements ClassMetadata
{
@@ -621,7 +666,7 @@ class ClassMetadataInfo implements ClassMetadata
* )
* </pre>
*
* @psalm-var array<string, array<string, mixed>>
* @psalm-var array<string, AssociationMapping>
*/
public $associationMappings = [];
@@ -1383,7 +1428,7 @@ class ClassMetadataInfo implements ClassMetadata
* the object model.
*
* @return mixed[] The mapping.
* @psalm-return array<string, mixed>
* @psalm-return AssociationMapping
*
* @throws MappingException
*/
@@ -1399,7 +1444,7 @@ class ClassMetadataInfo implements ClassMetadata
/**
* Gets all association mappings of the class.
*
* @psalm-return array<string, array<string, mixed>>
* @psalm-return array<string, AssociationMapping>
*/
public function getAssociationMappings()
{
@@ -1875,9 +1920,9 @@ class ClassMetadataInfo implements ClassMetadata
* originalClass: class-string,
* joinColumns?: array{0: array{name: string, referencedColumnName: string}}|mixed,
* id?: mixed,
* sourceToTargetKeyColumns?: array,
* joinColumnFieldNames?: array,
* targetToSourceKeyColumns?: array<array-key>,
* sourceToTargetKeyColumns?: array<string, string>,
* joinColumnFieldNames?: array<string, string>,
* targetToSourceKeyColumns?: array<string, string>,
* orphanRemoval: bool
* }
*
@@ -2762,7 +2807,7 @@ class ClassMetadataInfo implements ClassMetadata
* Adds an association mapping without completing/validating it.
* This is mainly used to add inherited association mappings to derived classes.
*
* @psalm-param array<string, mixed> $mapping
* @psalm-param AssociationMapping $mapping
*
* @return void
*
@@ -54,6 +54,9 @@ class DefaultNamingStrategy implements NamingStrategy
/**
* {@inheritdoc}
*
* @param string $propertyName
* @param class-string $className
*/
public function joinColumnName($propertyName, $className = null)
{
@@ -613,6 +613,10 @@ class AnnotationDriver extends CompatibilityAnnotationDriver
'schema' => $joinTableAnnot->schema,
];
if ($joinTableAnnot->options) {
$joinTable['options'] = $joinTableAnnot->options;
}
foreach ($joinTableAnnot->joinColumns as $joinColumn) {
$joinTable['joinColumns'][] = $this->joinColumnToArray($joinColumn);
}
@@ -738,12 +742,13 @@ class AnnotationDriver extends CompatibilityAnnotationDriver
* nullable: bool,
* onDelete: mixed,
* columnDefinition: string|null,
* referencedColumnName: string
* referencedColumnName: string,
* options?: array<string, mixed>
* }
*/
private function joinColumnToArray(Mapping\JoinColumn $joinColumn): array
{
return [
$mapping = [
'name' => $joinColumn->name,
'unique' => $joinColumn->unique,
'nullable' => $joinColumn->nullable,
@@ -751,6 +756,12 @@ class AnnotationDriver extends CompatibilityAnnotationDriver
'columnDefinition' => $joinColumn->columnDefinition,
'referencedColumnName' => $joinColumn->referencedColumnName,
];
if ($joinColumn->options) {
$mapping['options'] = $joinColumn->options;
}
return $mapping;
}
/**
@@ -415,6 +415,10 @@ class AttributeDriver extends CompatibilityAnnotationDriver
'name' => $joinTableAttribute->name,
'schema' => $joinTableAttribute->schema,
];
if ($joinTableAttribute->options) {
$joinTable['options'] = $joinTableAttribute->options;
}
}
foreach ($this->reader->getPropertyAnnotationCollection($property, Mapping\JoinColumn::class) as $joinColumn) {
@@ -653,12 +657,13 @@ class AttributeDriver extends CompatibilityAnnotationDriver
* nullable: bool,
* onDelete: mixed,
* columnDefinition: string|null,
* referencedColumnName: string
* referencedColumnName: string,
* options?: array<string, mixed>
* }
*/
private function joinColumnToArray($joinColumn): array
{
return [
$mapping = [
'name' => $joinColumn->name,
'unique' => $joinColumn->unique,
'nullable' => $joinColumn->nullable,
@@ -666,6 +671,12 @@ class AttributeDriver extends CompatibilityAnnotationDriver
'columnDefinition' => $joinColumn->columnDefinition,
'referencedColumnName' => $joinColumn->referencedColumnName,
];
if ($joinColumn->options) {
$mapping['options'] = $joinColumn->options;
}
return $mapping;
}
/**
@@ -6,10 +6,11 @@ namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Types;
use Doctrine\Deprecations\Deprecation;
use Doctrine\Inflector\Inflector;
use Doctrine\Inflector\InflectorFactory;
use Doctrine\ORM\Mapping\ClassMetadata;
@@ -22,8 +23,10 @@ use InvalidArgumentException;
use function array_diff;
use function array_keys;
use function array_merge;
use function assert;
use function count;
use function current;
use function get_class;
use function in_array;
use function preg_replace;
use function sort;
@@ -36,6 +39,20 @@ use function strtolower;
*/
class DatabaseDriver implements MappingDriver
{
/**
* Replacement for {@see Types::ARRAY}.
*
* To be removed as soon as support for DBAL 3 is dropped.
*/
private const ARRAY = 'array';
/**
* Replacement for {@see Types::OBJECT}.
*
* To be removed as soon as support for DBAL 3 is dropped.
*/
private const OBJECT = 'object';
/**
* Replacement for {@see Types::JSON_ARRAY}.
*
@@ -175,6 +192,17 @@ class DatabaseDriver implements MappingDriver
*/
public function loadMetadataForClass($className, PersistenceClassMetadata $metadata)
{
if (! $metadata instanceof ClassMetadata) {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/249',
'Passing an instance of %s to %s is deprecated, please pass a ClassMetadata instance instead.',
get_class($metadata),
__METHOD__,
ClassMetadata::class
);
}
$this->reverseEngineerMappingFromDatabase();
if (! isset($this->classToTableNames[$className])) {
@@ -266,18 +294,11 @@ class DatabaseDriver implements MappingDriver
return;
}
$tables = [];
foreach ($this->_sm->listTableNames() as $tableName) {
$tables[$tableName] = $this->_sm->listTableDetails($tableName);
}
$this->tables = $this->manyToManyTables = $this->classToTableNames = [];
foreach ($tables as $tableName => $table) {
$foreignKeys = $this->_sm->getDatabasePlatform()->supportsForeignKeyConstraints()
? $table->getForeignKeys()
: [];
foreach ($this->_sm->listTables() as $table) {
$tableName = $table->getName();
$foreignKeys = $table->getForeignKeys();
$allForeignKeyColumns = [];
@@ -287,7 +308,7 @@ class DatabaseDriver implements MappingDriver
if (! $table->hasPrimaryKey()) {
throw new MappingException(
'Table ' . $table->getName() . ' has no primary key. Doctrine does not ' .
'Table ' . $tableName . ' has no primary key. Doctrine does not ' .
"support reverse engineering from tables that don't have a primary key."
);
}
@@ -341,7 +362,7 @@ class DatabaseDriver implements MappingDriver
$tableName = $metadata->table['name'];
$columns = $this->tables[$tableName]->getColumns();
$primaryKeys = $this->getTablePrimaryKeys($this->tables[$tableName]);
$foreignKeys = $this->getTableForeignKeys($this->tables[$tableName]);
$foreignKeys = $this->tables[$tableName]->getForeignKeys();
$allForeignKeys = [];
foreach ($foreignKeys as $foreignKey) {
@@ -368,7 +389,7 @@ class DatabaseDriver implements MappingDriver
// We need to check for the columns here, because we might have associations as id as well.
if ($ids && count($primaryKeys) === 1) {
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_AUTO);
}
foreach ($fieldMappings as $fieldMapping) {
@@ -401,17 +422,17 @@ class DatabaseDriver implements MappingDriver
$fieldMapping = [
'fieldName' => $this->getFieldNameForColumn($tableName, $column->getName(), false),
'columnName' => $column->getName(),
'type' => $column->getType()->getName(),
'type' => Type::getTypeRegistry()->lookupName($column->getType()),
'nullable' => ! $column->getNotnull(),
];
// Type specific elements
switch ($fieldMapping['type']) {
case Types::ARRAY:
case self::ARRAY:
case Types::BLOB:
case Types::GUID:
case self::JSON_ARRAY:
case Types::OBJECT:
case self::OBJECT:
case Types::SIMPLE_ARRAY:
case Types::STRING:
case Types::TEXT:
@@ -454,9 +475,11 @@ class DatabaseDriver implements MappingDriver
*/
private function buildToOneAssociationMappings(ClassMetadataInfo $metadata)
{
assert($this->tables !== null);
$tableName = $metadata->table['name'];
$primaryKeys = $this->getTablePrimaryKeys($this->tables[$tableName]);
$foreignKeys = $this->getTableForeignKeys($this->tables[$tableName]);
$foreignKeys = $this->tables[$tableName]->getForeignKeys();
foreach ($foreignKeys as $foreignKey) {
$foreignTableName = $foreignKey->getForeignTableName();
@@ -492,19 +515,6 @@ class DatabaseDriver implements MappingDriver
}
}
/**
* Retrieve schema table definition foreign keys.
*
* @return ForeignKeyConstraint[]
* @psalm-return array<string, ForeignKeyConstraint>
*/
private function getTableForeignKeys(Table $table): array
{
return $this->_sm->getDatabasePlatform()->supportsForeignKeyConstraints()
? $table->getForeignKeys()
: [];
}
/**
* Retrieve schema table definition primary keys.
*
+66 -4
View File
@@ -5,11 +5,13 @@ declare(strict_types=1);
namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\Common\Collections\Criteria;
use Doctrine\Deprecations\Deprecation;
use Doctrine\ORM\Mapping\Builder\EntityListenerBuilder;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\MappingException;
use Doctrine\Persistence\Mapping\ClassMetadata as PersistenceClassMetadata;
use Doctrine\Persistence\Mapping\Driver\FileDriver;
use DOMDocument;
use InvalidArgumentException;
use LogicException;
use SimpleXMLElement;
@@ -22,6 +24,9 @@ use function explode;
use function extension_loaded;
use function file_get_contents;
use function in_array;
use function libxml_clear_errors;
use function libxml_get_errors;
use function libxml_use_internal_errors;
use function simplexml_load_string;
use function sprintf;
use function str_replace;
@@ -36,10 +41,13 @@ class XmlDriver extends FileDriver
{
public const DEFAULT_FILE_EXTENSION = '.dcm.xml';
/** @var bool */
private $isXsdValidationEnabled;
/**
* {@inheritDoc}
*/
public function __construct($locator, $fileExtension = self::DEFAULT_FILE_EXTENSION)
public function __construct($locator, $fileExtension = self::DEFAULT_FILE_EXTENSION, bool $isXsdValidationEnabled = false)
{
if (! extension_loaded('simplexml')) {
throw new LogicException(sprintf(
@@ -48,6 +56,25 @@ class XmlDriver extends FileDriver
));
}
if (! $isXsdValidationEnabled) {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/6728',
sprintf(
'Using XML mapping driver with XSD validation disabled is deprecated'
. ' and will not be supported in Doctrine ORM 3.0.'
)
);
}
if ($isXsdValidationEnabled && ! extension_loaded('dom')) {
throw new LogicException(sprintf(
'XSD validation cannot be enabled because the DOM extension is missing.'
));
}
$this->isXsdValidationEnabled = $isXsdValidationEnabled;
parent::__construct($locator, $fileExtension);
}
@@ -181,7 +208,7 @@ class XmlDriver extends FileDriver
[
'name' => isset($discrColumn['name']) ? (string) $discrColumn['name'] : null,
'type' => isset($discrColumn['type']) ? (string) $discrColumn['type'] : 'string',
'length' => isset($discrColumn['length']) ? (string) $discrColumn['length'] : 255,
'length' => isset($discrColumn['length']) ? (int) $discrColumn['length'] : 255,
'columnDefinition' => isset($discrColumn['column-definition']) ? (string) $discrColumn['column-definition'] : null,
]
);
@@ -356,7 +383,7 @@ class XmlDriver extends FileDriver
}
if (isset($idElement['length'])) {
$mapping['length'] = (string) $idElement['length'];
$mapping['length'] = (int) $idElement['length'];
}
if (isset($idElement['column'])) {
@@ -589,6 +616,10 @@ class XmlDriver extends FileDriver
$joinTable['schema'] = (string) $joinTableElement['schema'];
}
if (isset($joinTableElement->options)) {
$joinTable['options'] = $this->parseOptions($joinTableElement->options->children());
}
foreach ($joinTableElement->{'join-columns'}->{'join-column'} as $joinColumnElement) {
$joinTable['joinColumns'][] = $this->joinColumnToArray($joinColumnElement);
}
@@ -668,6 +699,10 @@ class XmlDriver extends FileDriver
'schema' => (string) $joinTableElement['schema'],
];
if (isset($joinTableElement->options)) {
$joinTable['options'] = $this->parseOptions($joinTableElement->options->children());
}
if (isset($joinTableElement->{'join-columns'})) {
foreach ($joinTableElement->{'join-columns'}->{'join-column'} as $joinColumnElement) {
$joinTable['joinColumns'][] = $this->joinColumnToArray($joinColumnElement);
@@ -772,7 +807,8 @@ class XmlDriver extends FileDriver
* unique?: bool,
* nullable?: bool,
* onDelete?: string,
* columnDefinition?: string
* columnDefinition?: string,
* options?: mixed[]
* }
*/
private function joinColumnToArray(SimpleXMLElement $joinColumnElement): array
@@ -798,6 +834,10 @@ class XmlDriver extends FileDriver
$joinColumn['columnDefinition'] = (string) $joinColumnElement['column-definition'];
}
if (isset($joinColumnElement['options'])) {
$joinColumn['options'] = $this->parseOptions($joinColumnElement['options']->children());
}
return $joinColumn;
}
@@ -940,6 +980,7 @@ class XmlDriver extends FileDriver
*/
protected function loadMappingFile($file)
{
$this->validateMapping($file);
$result = [];
// Note: we do not use `simplexml_load_file()` because of https://bugs.php.net/bug.php?id=62577
$xmlElement = simplexml_load_string(file_get_contents($file));
@@ -967,6 +1008,27 @@ class XmlDriver extends FileDriver
return $result;
}
private function validateMapping(string $file): void
{
if (! $this->isXsdValidationEnabled) {
return;
}
$backedUpErrorSetting = libxml_use_internal_errors(true);
try {
$document = new DOMDocument();
$document->load($file);
if (! $document->schemaValidate(__DIR__ . '/../../../../../doctrine-mapping.xsd')) {
throw MappingException::fromLibXmlErrors(libxml_get_errors());
}
} finally {
libxml_clear_errors();
libxml_use_internal_errors($backedUpErrorSetting);
}
}
/**
* @param mixed $element
*
@@ -35,6 +35,12 @@ final class InverseJoinColumn implements Annotation
*/
public $fieldName;
/** @var array<string, mixed> */
public $options = [];
/**
* @param array<string, mixed> $options
*/
public function __construct(
?string $name = null,
string $referencedColumnName = 'id',
@@ -42,7 +48,8 @@ final class InverseJoinColumn implements Annotation
bool $nullable = true,
$onDelete = null,
?string $columnDefinition = null,
?string $fieldName = null
?string $fieldName = null,
array $options = []
) {
$this->name = $name;
$this->referencedColumnName = $referencedColumnName;
@@ -51,5 +58,6 @@ final class InverseJoinColumn implements Annotation
$this->onDelete = $onDelete;
$this->columnDefinition = $columnDefinition;
$this->fieldName = $fieldName;
$this->options = $options;
}
}
+9 -1
View File
@@ -40,6 +40,12 @@ final class JoinColumn implements Annotation
*/
public $fieldName;
/** @var array<string, mixed> */
public $options = [];
/**
* @param array<string, mixed> $options
*/
public function __construct(
?string $name = null,
string $referencedColumnName = 'id',
@@ -47,7 +53,8 @@ final class JoinColumn implements Annotation
bool $nullable = true,
$onDelete = null,
?string $columnDefinition = null,
?string $fieldName = null
?string $fieldName = null,
array $options = []
) {
$this->name = $name;
$this->referencedColumnName = $referencedColumnName;
@@ -56,5 +63,6 @@ final class JoinColumn implements Annotation
$this->onDelete = $onDelete;
$this->columnDefinition = $columnDefinition;
$this->fieldName = $fieldName;
$this->options = $options;
}
}
+9 -1
View File
@@ -27,11 +27,18 @@ final class JoinTable implements Annotation
/** @var array<\Doctrine\ORM\Mapping\JoinColumn> */
public $inverseJoinColumns = [];
/** @var array<string, mixed> */
public $options = [];
/**
* @param array<string, mixed> $options
*/
public function __construct(
?string $name = null,
?string $schema = null,
$joinColumns = [],
$inverseJoinColumns = []
$inverseJoinColumns = [],
array $options = []
) {
$this->name = $name;
$this->schema = $schema;
@@ -39,5 +46,6 @@ final class JoinTable implements Annotation
$this->inverseJoinColumns = $inverseJoinColumns instanceof JoinColumn
? [$inverseJoinColumns]
: $inverseJoinColumns;
$this->options = $options;
}
}
@@ -6,6 +6,7 @@ namespace Doctrine\ORM\Mapping;
use BackedEnum;
use Doctrine\ORM\Exception\ORMException;
use LibXMLError;
use ReflectionException;
use ValueError;
@@ -17,6 +18,8 @@ use function get_parent_class;
use function implode;
use function sprintf;
use const PHP_EOL;
/**
* A MappingException indicates that something is wrong with the mapping setup.
*/
@@ -1000,4 +1003,21 @@ EXCEPTION
$enumType
), 0, $previous);
}
/**
* @param LibXMLError[] $errors
*/
public static function fromLibXmlErrors(array $errors): self
{
$formatter = static function (LibXMLError $error): string {
return sprintf(
'libxml error: %s in %s at line %d',
$error->message,
$error->file,
$error->line
);
};
return new self(implode(PHP_EOL, array_map($formatter, $errors)));
}
}
+22 -14
View File
@@ -14,7 +14,7 @@ interface NamingStrategy
/**
* Returns a table name for an entity class.
*
* @param string $className The fully-qualified class name.
* @param class-string $className
*
* @return string A table name.
*/
@@ -23,8 +23,8 @@ interface NamingStrategy
/**
* Returns a column name for a property.
*
* @param string $propertyName A property name.
* @param string|null $className The fully-qualified class name.
* @param string $propertyName A property name.
* @param class-string $className The fully-qualified class name.
*
* @return string A column name.
*/
@@ -33,14 +33,19 @@ interface NamingStrategy
/**
* Returns a column name for an embedded property.
*
* @param string $propertyName
* @param string $embeddedColumnName
* @param string $className
* @param string $embeddedClassName
* @param string $propertyName
* @param string $embeddedColumnName
* @param class-string $className
* @param class-string $embeddedClassName
*
* @return string
*/
public function embeddedFieldToColumnName($propertyName, $embeddedColumnName, $className = null, $embeddedClassName = null);
public function embeddedFieldToColumnName(
$propertyName,
$embeddedColumnName,
$className = null,
$embeddedClassName = null
);
/**
* Returns the default reference column name.
@@ -56,14 +61,14 @@ interface NamingStrategy
*
* @return string A join column name.
*/
public function joinColumnName($propertyName);
public function joinColumnName($propertyName/*, string $className */);
/**
* Returns a join table name.
*
* @param string $sourceEntity The source entity.
* @param string $targetEntity The target entity.
* @param string|null $propertyName A property name.
* @param class-string $sourceEntity The source entity.
* @param class-string $targetEntity The target entity.
* @param string $propertyName A property name.
*
* @return string A join table name.
*/
@@ -72,8 +77,11 @@ interface NamingStrategy
/**
* Returns the foreign key column name for the given parameters.
*
* @param string $entityName An entity.
* @param string|null $referencedColumnName A property.
* @param class-string $entityName An entity.
* @param string|null $referencedColumnName A property name or null in
* case of a self-referencing
* entity with join columns
* defined in the mapping
*
* @return string A join column name.
*/
@@ -12,7 +12,6 @@ use function array_combine;
use function array_filter;
use function array_map;
use function array_merge;
use function call_user_func_array;
/**
* Utility class to retrieve all reflection instance properties of a given class, including
@@ -45,10 +44,9 @@ final class ReflectionPropertiesGetter
return $this->properties[$className];
}
return $this->properties[$className] = call_user_func_array(
'array_merge',
return $this->properties[$className] = array_merge(
// first merge because `array_merge` expects >= 1 params
array_merge(
...array_merge(
[[]],
array_map(
[$this, 'getClassProperties'],
@@ -112,6 +112,9 @@ class UnderscoreNamingStrategy implements NamingStrategy
/**
* {@inheritdoc}
*
* @param string $propertyName
* @param class-string $className
*/
public function joinColumnName($propertyName, $className = null)
{
-2
View File
@@ -33,8 +33,6 @@ final class NativeQuery extends AbstractQuery
/**
* Gets the SQL query.
*
* @override
*/
public function getSQL(): string
{
+3 -2
View File
@@ -101,10 +101,11 @@ final class ORMSetup
array $paths,
bool $isDevMode = false,
?string $proxyDir = null,
?CacheItemPoolInterface $cache = null
?CacheItemPoolInterface $cache = null,
bool $isXsdValidationEnabled = false
): Configuration {
$config = self::createConfiguration($isDevMode, $proxyDir, $cache);
$config->setMetadataDriverImpl(new XmlDriver($paths));
$config->setMetadataDriverImpl(new XmlDriver($paths, XmlDriver::DEFAULT_FILE_EXTENSION, $isXsdValidationEnabled));
return $config;
}
@@ -764,10 +764,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
{
$limit = $criteria->getMaxResults();
$offset = $criteria->getFirstResult();
if ($limit !== null || $offset !== null) {
return $this->platform->modifyLimitQuery('', $limit, $offset ?? 0);
}
return '';
return $this->platform->modifyLimitQuery('', $limit, $offset ?? 0);
}
}
@@ -73,8 +73,6 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
* @param string $fieldName
*
* @return string
*
* @override
*/
public function getOwningTable($fieldName)
{
+26 -11
View File
@@ -33,6 +33,7 @@ use function assert;
use function count;
use function get_debug_type;
use function in_array;
use function is_int;
use function ksort;
use function md5;
use function method_exists;
@@ -119,6 +120,7 @@ final class Query extends AbstractQuery
* The current state of this query.
*
* @var int
* @psalm-var self::STATE_*
*/
private $_state = self::STATE_DIRTY;
@@ -146,9 +148,9 @@ final class Query extends AbstractQuery
/**
* The first result to return (the "offset").
*
* @var int|null
* @var int
*/
private $firstResult = null;
private $firstResult = 0;
/**
* The maximum number of results to return (the "limit").
@@ -189,8 +191,6 @@ final class Query extends AbstractQuery
* Gets the SQL query/queries that correspond to this DQL query.
*
* @return list<string>|string The built sql query or an array of all sql queries.
*
* @override
*/
public function getSQL()
{
@@ -582,9 +582,6 @@ final class Query extends AbstractQuery
return $this->expireQueryCache;
}
/**
* @override
*/
public function free(): void
{
parent::free();
@@ -600,11 +597,20 @@ final class Query extends AbstractQuery
*/
public function setDQL($dqlQuery): self
{
if ($dqlQuery !== null) {
$this->dql = $dqlQuery;
$this->_state = self::STATE_DIRTY;
if ($dqlQuery === null) {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9784',
'Calling %s with null is deprecated and will result in a TypeError in Doctrine 3.0',
__METHOD__
);
return $this;
}
$this->dql = $dqlQuery;
$this->_state = self::STATE_DIRTY;
return $this;
}
@@ -625,6 +631,7 @@ final class Query extends AbstractQuery
* @see AbstractQuery::STATE_DIRTY
*
* @return int The query state.
* @psalm-return self::STATE_* The query state.
*/
public function getState(): int
{
@@ -650,7 +657,15 @@ final class Query extends AbstractQuery
*/
public function setFirstResult($firstResult): self
{
if ($firstResult !== null) {
if (! is_int($firstResult)) {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9809',
'Calling %s with %s is deprecated and will result in a TypeError in Doctrine 3.0. Pass an integer.',
__METHOD__,
get_debug_type($firstResult)
);
$firstResult = (int) $firstResult;
}
@@ -20,7 +20,6 @@ class AbsFunction extends FunctionNode
public $simpleArithmeticExpression;
/**
* @override
* @inheritdoc
*/
public function getSql(SqlWalker $sqlWalker)
@@ -31,7 +30,6 @@ class AbsFunction extends FunctionNode
}
/**
* @override
* @inheritdoc
*/
public function parse(Parser $parser)
@@ -23,7 +23,6 @@ class BitAndFunction extends FunctionNode
public $secondArithmetic;
/**
* @override
* @inheritdoc
*/
public function getSql(SqlWalker $sqlWalker)
@@ -37,7 +36,6 @@ class BitAndFunction extends FunctionNode
}
/**
* @override
* @inheritdoc
*/
public function parse(Parser $parser)
@@ -23,7 +23,6 @@ class BitOrFunction extends FunctionNode
public $secondArithmetic;
/**
* @override
* @inheritdoc
*/
public function getSql(SqlWalker $sqlWalker)
@@ -37,7 +36,6 @@ class BitOrFunction extends FunctionNode
}
/**
* @override
* @inheritdoc
*/
public function parse(Parser $parser)
@@ -26,7 +26,6 @@ class ConcatFunction extends FunctionNode
public $concatExpressions = [];
/**
* @override
* @inheritdoc
*/
public function getSql(SqlWalker $sqlWalker)
@@ -43,7 +42,6 @@ class ConcatFunction extends FunctionNode
}
/**
* @override
* @inheritdoc
*/
public function parse(Parser $parser)
@@ -16,7 +16,6 @@ use Doctrine\ORM\Query\SqlWalker;
class CurrentDateFunction extends FunctionNode
{
/**
* @override
* @inheritdoc
*/
public function getSql(SqlWalker $sqlWalker)
@@ -25,7 +24,6 @@ class CurrentDateFunction extends FunctionNode
}
/**
* @override
* @inheritdoc
*/
public function parse(Parser $parser)
@@ -16,7 +16,6 @@ use Doctrine\ORM\Query\SqlWalker;
class CurrentTimeFunction extends FunctionNode
{
/**
* @override
* @inheritdoc
*/
public function getSql(SqlWalker $sqlWalker)
@@ -25,7 +24,6 @@ class CurrentTimeFunction extends FunctionNode
}
/**
* @override
* @inheritdoc
*/
public function parse(Parser $parser)
@@ -16,7 +16,6 @@ use Doctrine\ORM\Query\SqlWalker;
class CurrentTimestampFunction extends FunctionNode
{
/**
* @override
* @inheritdoc
*/
public function getSql(SqlWalker $sqlWalker)
@@ -25,7 +24,6 @@ class CurrentTimestampFunction extends FunctionNode
}
/**
* @override
* @inheritdoc
*/
public function parse(Parser $parser)
@@ -29,7 +29,6 @@ class DateAddFunction extends FunctionNode
public $unit = null;
/**
* @override
* @inheritdoc
*/
public function getSql(SqlWalker $sqlWalker)
@@ -85,7 +84,6 @@ class DateAddFunction extends FunctionNode
}
/**
* @override
* @inheritdoc
*/
public function parse(Parser $parser)
@@ -23,7 +23,6 @@ class DateDiffFunction extends FunctionNode
public $date2;
/**
* @override
* @inheritdoc
*/
public function getSql(SqlWalker $sqlWalker)
@@ -35,7 +34,6 @@ class DateDiffFunction extends FunctionNode
}
/**
* @override
* @inheritdoc
*/
public function parse(Parser $parser)
@@ -17,7 +17,6 @@ use function strtolower;
class DateSubFunction extends DateAddFunction
{
/**
* @override
* @inheritdoc
*/
public function getSql(SqlWalker $sqlWalker)
@@ -12,6 +12,8 @@ use Doctrine\ORM\Query\SqlWalker;
* Abstract Function Node.
*
* @link www.doctrine-project.org
*
* @psalm-consistent-constructor
*/
abstract class FunctionNode extends Node
{
@@ -23,7 +23,6 @@ class LengthFunction extends FunctionNode implements TypedExpression
public $stringPrimary;
/**
* @override
* @inheritdoc
*/
public function getSql(SqlWalker $sqlWalker)
@@ -34,7 +33,6 @@ class LengthFunction extends FunctionNode implements TypedExpression
}
/**
* @override
* @inheritdoc
*/
public function parse(Parser $parser)
@@ -27,7 +27,6 @@ class LocateFunction extends FunctionNode
public $simpleArithmeticExpression = false;
/**
* @override
* @inheritdoc
*/
public function getSql(SqlWalker $sqlWalker)
@@ -49,7 +48,6 @@ class LocateFunction extends FunctionNode
}
/**
* @override
* @inheritdoc
*/
public function parse(Parser $parser)
@@ -22,7 +22,6 @@ class LowerFunction extends FunctionNode
public $stringPrimary;
/**
* @override
* @inheritdoc
*/
public function getSql(SqlWalker $sqlWalker)
@@ -34,7 +33,6 @@ class LowerFunction extends FunctionNode
}
/**
* @override
* @inheritdoc
*/
public function parse(Parser $parser)
@@ -23,7 +23,6 @@ class ModFunction extends FunctionNode
public $secondSimpleArithmeticExpression;
/**
* @override
* @inheritdoc
*/
public function getSql(SqlWalker $sqlWalker)
@@ -35,7 +34,6 @@ class ModFunction extends FunctionNode
}
/**
* @override
* @inheritdoc
*/
public function parse(Parser $parser)
@@ -23,7 +23,6 @@ class SizeFunction extends FunctionNode
public $collectionPathExpression;
/**
* @override
* @inheritdoc
* @todo If the collection being counted is already joined, the SQL can be simpler (more efficient).
*/
@@ -104,7 +103,6 @@ class SizeFunction extends FunctionNode
}
/**
* @override
* @inheritdoc
*/
public function parse(Parser $parser)
@@ -22,7 +22,6 @@ class SqrtFunction extends FunctionNode
public $simpleArithmeticExpression;
/**
* @override
* @inheritdoc
*/
public function getSql(SqlWalker $sqlWalker)
@@ -34,7 +33,6 @@ class SqrtFunction extends FunctionNode
}
/**
* @override
* @inheritdoc
*/
public function parse(Parser $parser)
@@ -27,7 +27,6 @@ class SubstringFunction extends FunctionNode
public $secondSimpleArithmeticExpression = null;
/**
* @override
* @inheritdoc
*/
public function getSql(SqlWalker $sqlWalker)
@@ -45,7 +44,6 @@ class SubstringFunction extends FunctionNode
}
/**
* @override
* @inheritdoc
*/
public function parse(Parser $parser)
@@ -22,7 +22,6 @@ class UpperFunction extends FunctionNode
public $stringPrimary;
/**
* @override
* @inheritdoc
*/
public function getSql(SqlWalker $sqlWalker)
@@ -34,7 +33,6 @@ class UpperFunction extends FunctionNode
}
/**
* @override
* @inheritdoc
*/
public function parse(Parser $parser)
+3 -4
View File
@@ -67,7 +67,6 @@ use ReflectionClass;
use function array_intersect;
use function array_search;
use function assert;
use function call_user_func;
use function class_exists;
use function count;
use function explode;
@@ -3563,7 +3562,7 @@ class Parser
$function = is_string($functionClass)
? new $functionClass($functionName)
: call_user_func($functionClass, $functionName);
: $functionClass($functionName);
$function->parse($this);
@@ -3604,7 +3603,7 @@ class Parser
$function = is_string($functionClass)
? new $functionClass($functionName)
: call_user_func($functionClass, $functionName);
: $functionClass($functionName);
$function->parse($this);
@@ -3646,7 +3645,7 @@ class Parser
$function = is_string($functionClass)
? new $functionClass($functionName)
: call_user_func($functionClass, $functionName);
: $functionClass($functionName);
$function->parse($this);
@@ -7,6 +7,7 @@ namespace Doctrine\ORM\Query;
use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Internal\SQLResultCasing;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\MappingException;
use Doctrine\ORM\Utility\PersisterHelper;
@@ -156,7 +157,7 @@ class ResultSetMappingBuilder extends ResultSetMapping
}
foreach ($classMetadata->associationMappings as $associationMapping) {
if ($associationMapping['isOwningSide'] && $associationMapping['type'] & ClassMetadataInfo::TO_ONE) {
if ($associationMapping['isOwningSide'] && $associationMapping['type'] & ClassMetadata::TO_ONE) {
$targetClass = $this->em->getClassMetadata($associationMapping['targetEntity']);
$isIdentifier = isset($associationMapping['id']) && $associationMapping['id'] === true;
@@ -178,7 +179,7 @@ class ResultSetMappingBuilder extends ResultSetMapping
}
}
private function isInheritanceSupported(ClassMetadataInfo $classMetadata): bool
private function isInheritanceSupported(ClassMetadata $classMetadata): bool
{
if (
$classMetadata->isInheritanceTypeSingleTable()
@@ -246,7 +247,7 @@ class ResultSetMappingBuilder extends ResultSetMapping
}
foreach ($class->associationMappings as $associationMapping) {
if ($associationMapping['isOwningSide'] && $associationMapping['type'] & ClassMetadataInfo::TO_ONE) {
if ($associationMapping['isOwningSide'] && $associationMapping['type'] & ClassMetadata::TO_ONE) {
foreach ($associationMapping['joinColumns'] as $joinColumn) {
$columnName = $joinColumn['name'];
$columnAlias[$columnName] = $this->getColumnAlias($columnName, $mode, $customRenameColumns);
@@ -260,6 +261,8 @@ class ResultSetMappingBuilder extends ResultSetMapping
/**
* Adds the mappings of the results of native SQL queries to the result set.
*
* @deprecated This method is deprecated and will be removed in Doctrine ORM 3.0.
*
* @param mixed[] $queryMapping
*
* @return ResultSetMappingBuilder
@@ -276,6 +279,8 @@ class ResultSetMappingBuilder extends ResultSetMapping
/**
* Adds the class mapping of the results of native SQL queries to the result set.
*
* @deprecated This method is deprecated and will be removed in Doctrine ORM 3.0.
*
* @param string $resultClassName
*
* @return $this
@@ -304,7 +309,7 @@ class ResultSetMappingBuilder extends ResultSetMapping
}
foreach ($classMetadata->associationMappings as $associationMapping) {
if ($associationMapping['isOwningSide'] && $associationMapping['type'] & ClassMetadataInfo::TO_ONE) {
if ($associationMapping['isOwningSide'] && $associationMapping['type'] & ClassMetadata::TO_ONE) {
$targetClass = $this->em->getClassMetadata($associationMapping['targetEntity']);
foreach ($associationMapping['joinColumns'] as $joinColumn) {
@@ -322,6 +327,8 @@ class ResultSetMappingBuilder extends ResultSetMapping
/**
* Adds the result set mapping of the results of native SQL queries to the result set.
*
* @deprecated This method is deprecated and will be removed in Doctrine ORM 3.0.
*
* @param string $resultSetMappingName
*
* @return $this
@@ -375,6 +382,8 @@ class ResultSetMappingBuilder extends ResultSetMapping
/**
* Adds the entity result mapping of the results of native SQL queries to the result set.
*
* @deprecated This method is deprecated and will be removed in Doctrine ORM 3.0.
*
* @param mixed[] $entityMapping
* @param string $alias
*
+247 -58
View File
@@ -11,7 +11,6 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\QuoteStrategy;
use Doctrine\ORM\OptimisticLockException;
use Doctrine\ORM\Query;
@@ -41,8 +40,7 @@ use function strtoupper;
use function trim;
/**
* The SqlWalker is a TreeWalker that walks over a DQL AST and constructs
* the corresponding SQL.
* The SqlWalker walks over a DQL AST and constructs the corresponding SQL.
*
* @psalm-import-type QueryComponent from Parser
* @psalm-consistent-constructor
@@ -243,7 +241,9 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Returns internal queryComponents array.
*
* @return array<string, QueryComponent>
*/
public function getQueryComponents()
{
@@ -251,7 +251,12 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Sets or overrides a query component for a given dql alias.
*
* @param string $dqlAlias The DQL alias.
* @psalm-param QueryComponent $queryComponent
*
* @return void
*/
public function setQueryComponent($dqlAlias, array $queryComponent)
{
@@ -265,7 +270,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Gets an executor that can be used to execute the result of this walker.
*
* @param AST\DeleteStatement|AST\UpdateStatement|AST\SelectStatement $AST
*
* @return Exec\AbstractSqlExecutor
*/
public function getExecutor($AST)
{
@@ -526,7 +535,9 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a SelectStatement AST node, thereby generating the appropriate SQL.
*
* @return string
*/
public function walkSelectStatement(AST\SelectStatement $AST)
{
@@ -554,9 +565,7 @@ class SqlWalker implements TreeWalker
$sql .= ' ORDER BY ' . $orderBySql;
}
if ($limit !== null || $offset !== null) {
$sql = $this->platform->modifyLimitQuery($sql, $limit, $offset ?? 0);
}
$sql = $this->platform->modifyLimitQuery($sql, $limit, $offset ?? 0);
if ($lockMode === LockMode::NONE) {
return $sql;
@@ -584,7 +593,9 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down an UpdateStatement AST node, thereby generating the appropriate SQL.
*
* @return string
*/
public function walkUpdateStatement(AST\UpdateStatement $AST)
{
@@ -596,7 +607,9 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a DeleteStatement AST node, thereby generating the appropriate SQL.
*
* @return string
*/
public function walkDeleteStatement(AST\DeleteStatement $AST)
{
@@ -651,7 +664,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a PathExpression AST node, thereby generating the appropriate SQL.
*
* @param AST\PathExpression $pathExpr
*
* @return string
*/
public function walkPathExpression($pathExpr)
{
@@ -708,7 +725,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a SelectClause AST node, thereby generating the appropriate SQL.
*
* @param AST\SelectClause $selectClause
*
* @return string
*/
public function walkSelectClause($selectClause)
{
@@ -824,7 +845,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a FromClause AST node, thereby generating the appropriate SQL.
*
* @param AST\FromClause $fromClause
*
* @return string
*/
public function walkFromClause($fromClause)
{
@@ -1128,7 +1153,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a FunctionNode AST node, thereby generating the appropriate SQL.
*
* @param AST\Functions\FunctionNode $function
*
* @return string
*/
public function walkFunction($function)
{
@@ -1136,7 +1165,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down an OrderByClause AST node, thereby generating the appropriate SQL.
*
* @param AST\OrderByClause $orderByClause
*
* @return string
*/
public function walkOrderByClause($orderByClause)
{
@@ -1151,7 +1184,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down an OrderByItem AST node, thereby generating the appropriate SQL.
*
* @param AST\OrderByItem $orderByItem
*
* @return string
*/
public function walkOrderByItem($orderByItem)
{
@@ -1171,7 +1208,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a HavingClause AST node, thereby generating the appropriate SQL.
*
* @param AST\HavingClause $havingClause
*
* @return string The SQL.
*/
public function walkHavingClause($havingClause)
{
@@ -1179,7 +1220,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a Join AST node and creates the corresponding SQL.
*
* @param AST\Join $join
*
* @return string
*/
public function walkJoin($join)
{
@@ -1317,7 +1362,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a SelectExpression AST node and generates the corresponding SQL.
*
* @param AST\SelectExpression $selectExpression
*
* @return string
*/
public function walkSelectExpression($selectExpression)
{
@@ -1397,7 +1446,7 @@ class SqlWalker implements TreeWalker
break;
}
$this->rsm->addScalarResult($columnAlias, $resultAlias, $expr->getReturnType()->getName());
$this->rsm->addScalarResult($columnAlias, $resultAlias, Type::getTypeRegistry()->lookupName($expr->getReturnType()));
break;
@@ -1513,7 +1562,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a QuantifiedExpression AST node, thereby generating the appropriate SQL.
*
* @param AST\QuantifiedExpression $qExpr
*
* @return string
*/
public function walkQuantifiedExpression($qExpr)
{
@@ -1521,7 +1574,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a Subselect AST node, thereby generating the appropriate SQL.
*
* @param AST\Subselect $subselect
*
* @return string
*/
public function walkSubselect($subselect)
{
@@ -1546,7 +1603,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a SubselectFromClause AST node, thereby generating the appropriate SQL.
*
* @param AST\SubselectFromClause $subselectFromClause
*
* @return string
*/
public function walkSubselectFromClause($subselectFromClause)
{
@@ -1561,7 +1622,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a SimpleSelectClause AST node, thereby generating the appropriate SQL.
*
* @param AST\SimpleSelectClause $simpleSelectClause
*
* @return string
*/
public function walkSimpleSelectClause($simpleSelectClause)
{
@@ -1617,6 +1682,11 @@ class SqlWalker implements TreeWalker
}
$sqlSelectExpressions[] = $col . ' AS ' . $columnAlias;
if (! empty($fieldMapping['enumType'])) {
$this->rsm->addEnumResult($columnAlias, $fieldMapping['enumType']);
}
break;
case $e instanceof AST\Literal:
@@ -1652,7 +1722,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a SimpleSelectExpression AST node, thereby generating the appropriate SQL.
*
* @param AST\SimpleSelectExpression $simpleSelectExpression
*
* @return string
*/
public function walkSimpleSelectExpression($simpleSelectExpression)
{
@@ -1703,7 +1777,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down an AggregateExpression AST node, thereby generating the appropriate SQL.
*
* @param AST\AggregateExpression $aggExpression
*
* @return string
*/
public function walkAggregateExpression($aggExpression)
{
@@ -1712,7 +1790,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a GroupByClause AST node, thereby generating the appropriate SQL.
*
* @param AST\GroupByClause $groupByClause
*
* @return string
*/
public function walkGroupByClause($groupByClause)
{
@@ -1726,7 +1808,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a GroupByItem AST node, thereby generating the appropriate SQL.
*
* @param AST\PathExpression|string $groupByItem
*
* @return string
*/
public function walkGroupByItem($groupByItem)
{
@@ -1761,7 +1847,7 @@ class SqlWalker implements TreeWalker
}
foreach ($this->getMetadataForDqlAlias($groupByItem)->associationMappings as $mapping) {
if ($mapping['isOwningSide'] && $mapping['type'] & ClassMetadataInfo::TO_ONE) {
if ($mapping['isOwningSide'] && $mapping['type'] & ClassMetadata::TO_ONE) {
$item = new AST\PathExpression(AST\PathExpression::TYPE_SINGLE_VALUED_ASSOCIATION, $groupByItem, $mapping['fieldName']);
$item->type = AST\PathExpression::TYPE_SINGLE_VALUED_ASSOCIATION;
@@ -1773,7 +1859,9 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a DeleteClause AST node, thereby generating the appropriate SQL.
*
* @return string
*/
public function walkDeleteClause(AST\DeleteClause $deleteClause)
{
@@ -1788,7 +1876,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down an UpdateClause AST node, thereby generating the appropriate SQL.
*
* @param AST\UpdateClause $updateClause
*
* @return string
*/
public function walkUpdateClause($updateClause)
{
@@ -1803,7 +1895,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down an UpdateItem AST node, thereby generating the appropriate SQL.
*
* @param AST\UpdateItem $updateItem
*
* @return string
*/
public function walkUpdateItem($updateItem)
{
@@ -1833,7 +1929,12 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a WhereClause AST node, thereby generating the appropriate SQL.
* WhereClause or not, the appropriate discriminator sql is added.
*
* @param AST\WhereClause $whereClause
*
* @return string
*/
public function walkWhereClause($whereClause)
{
@@ -1873,7 +1974,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walk down a ConditionalExpression AST node, thereby generating the appropriate SQL.
*
* @param AST\ConditionalExpression $condExpr
*
* @return string
*/
public function walkConditionalExpression($condExpr)
{
@@ -1887,7 +1992,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a ConditionalTerm AST node, thereby generating the appropriate SQL.
*
* @param AST\ConditionalTerm $condTerm
*
* @return string
*/
public function walkConditionalTerm($condTerm)
{
@@ -1901,7 +2010,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a ConditionalFactor AST node, thereby generating the appropriate SQL.
*
* @param AST\ConditionalFactor $factor
*
* @return string The SQL.
*/
public function walkConditionalFactor($factor)
{
@@ -1913,7 +2026,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a ConditionalPrimary AST node, thereby generating the appropriate SQL.
*
* @param AST\ConditionalPrimary $primary
*
* @return string
*/
public function walkConditionalPrimary($primary)
{
@@ -1929,7 +2046,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down an ExistsExpression AST node, thereby generating the appropriate SQL.
*
* @param AST\ExistsExpression $existsExpr
*
* @return string
*/
public function walkExistsExpression($existsExpr)
{
@@ -1941,7 +2062,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a CollectionMemberExpression AST node, thereby generating the appropriate SQL.
*
* @param AST\CollectionMemberExpression $collMemberExpr
*
* @return string
*/
public function walkCollectionMemberExpression($collMemberExpr)
{
@@ -2038,7 +2163,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down an EmptyCollectionComparisonExpression AST node, thereby generating the appropriate SQL.
*
* @param AST\EmptyCollectionComparisonExpression $emptyCollCompExpr
*
* @return string
*/
public function walkEmptyCollectionComparisonExpression($emptyCollCompExpr)
{
@@ -2049,7 +2178,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a NullComparisonExpression AST node, thereby generating the appropriate SQL.
*
* @param AST\NullComparisonExpression $nullCompExpr
*
* @return string
*/
public function walkNullComparisonExpression($nullCompExpr)
{
@@ -2070,7 +2203,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down an InExpression AST node, thereby generating the appropriate SQL.
*
* @param AST\InExpression $inExpr
*
* @return string
*/
public function walkInExpression($inExpr)
{
@@ -2086,7 +2223,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down an InstanceOfExpression AST node, thereby generating the appropriate SQL.
*
* @param AST\InstanceOfExpression $instanceOfExpr
*
* @return string
*
* @throws QueryException
*/
@@ -2124,7 +2265,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a literal that represents an AST node, thereby generating the appropriate SQL.
*
* @param AST\Literal $literal
*
* @return string
*/
public function walkLiteral($literal)
{
@@ -2144,7 +2289,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a BetweenExpression AST node, thereby generating the appropriate SQL.
*
* @param AST\BetweenExpression $betweenExpr
*
* @return string
*/
public function walkBetweenExpression($betweenExpr)
{
@@ -2161,7 +2310,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a LikeExpression AST node, thereby generating the appropriate SQL.
*
* @param AST\LikeExpression $likeExpr
*
* @return string
*/
public function walkLikeExpression($likeExpr)
{
@@ -2196,7 +2349,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a StateFieldPathExpression AST node, thereby generating the appropriate SQL.
*
* @param AST\PathExpression $stateFieldPathExpression
*
* @return string
*/
public function walkStateFieldPathExpression($stateFieldPathExpression)
{
@@ -2204,7 +2361,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a ComparisonExpression AST node, thereby generating the appropriate SQL.
*
* @param AST\ComparisonExpression $compExpr
*
* @return string
*/
public function walkComparisonExpression($compExpr)
{
@@ -2226,7 +2387,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down an InputParameter AST node, thereby generating the appropriate SQL.
*
* @param AST\InputParameter $inputParam
*
* @return string
*/
public function walkInputParameter($inputParam)
{
@@ -2245,7 +2410,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down an ArithmeticExpression AST node, thereby generating the appropriate SQL.
*
* @param AST\ArithmeticExpression $arithmeticExpr
*
* @return string
*/
public function walkArithmeticExpression($arithmeticExpr)
{
@@ -2255,7 +2424,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down an SimpleArithmeticExpression AST node, thereby generating the appropriate SQL.
*
* @param AST\SimpleArithmeticExpression $simpleArithmeticExpr
*
* @return string
*/
public function walkSimpleArithmeticExpression($simpleArithmeticExpr)
{
@@ -2267,7 +2440,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down an ArithmeticTerm AST node, thereby generating the appropriate SQL.
*
* @param mixed $term
*
* @return string
*/
public function walkArithmeticTerm($term)
{
@@ -2287,7 +2464,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down an ArithmeticFactor that represents an AST node, thereby generating the appropriate SQL.
*
* @param mixed $factor
*
* @return string
*/
public function walkArithmeticFactor($factor)
{
@@ -2329,7 +2510,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a StringPrimary that represents an AST node, thereby generating the appropriate SQL.
*
* @param mixed $stringPrimary
*
* @return string
*/
public function walkStringPrimary($stringPrimary)
{
@@ -2339,7 +2524,11 @@ class SqlWalker implements TreeWalker
}
/**
* {@inheritdoc}
* Walks down a ResultVariable that represents an AST node, thereby generating the appropriate SQL.
*
* @param string $resultVariable
*
* @return string
*/
public function walkResultVariable($resultVariable)
{
@@ -2362,7 +2551,7 @@ class SqlWalker implements TreeWalker
* @throws QueryException
*/
private function getChildDiscriminatorsFromClassMetadata(
ClassMetadataInfo $rootClass,
ClassMetadata $rootClass,
AST\InstanceOfExpression $instanceOfExpr
): string {
$sqlParameterList = [];
+182 -91
View File
@@ -34,6 +34,8 @@ interface TreeWalker
/**
* Sets or overrides a query component for a given dql alias.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param string $dqlAlias The DQL alias.
* @param array<string, mixed> $queryComponent
* @psalm-param QueryComponent $queryComponent
@@ -43,415 +45,504 @@ interface TreeWalker
public function setQueryComponent($dqlAlias, array $queryComponent);
/**
* Walks down a SelectStatement AST node, thereby generating the appropriate SQL.
* Walks down a SelectStatement AST node.
*
* @return string The SQL.
* @return void
*/
public function walkSelectStatement(AST\SelectStatement $AST);
/**
* Walks down a SelectClause AST node, thereby generating the appropriate SQL.
* Walks down a SelectClause AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\SelectClause $selectClause
*
* @return string The SQL.
* @return void
*/
public function walkSelectClause($selectClause);
/**
* Walks down a FromClause AST node, thereby generating the appropriate SQL.
* Walks down a FromClause AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\FromClause $fromClause
*
* @return string The SQL.
* @return void
*/
public function walkFromClause($fromClause);
/**
* Walks down a FunctionNode AST node, thereby generating the appropriate SQL.
* Walks down a FunctionNode AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\Functions\FunctionNode $function
*
* @return string The SQL.
* @return void
*/
public function walkFunction($function);
/**
* Walks down an OrderByClause AST node, thereby generating the appropriate SQL.
* Walks down an OrderByClause AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\OrderByClause $orderByClause
*
* @return string The SQL.
* @return void
*/
public function walkOrderByClause($orderByClause);
/**
* Walks down an OrderByItem AST node, thereby generating the appropriate SQL.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\OrderByItem $orderByItem
*
* @return string The SQL.
* @return void
*/
public function walkOrderByItem($orderByItem);
/**
* Walks down a HavingClause AST node, thereby generating the appropriate SQL.
* Walks down a HavingClause AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\HavingClause $havingClause
*
* @return string The SQL.
* @return void
*/
public function walkHavingClause($havingClause);
/**
* Walks down a Join AST node and creates the corresponding SQL.
* Walks down a Join AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\Join $join
*
* @return string The SQL.
* @return void
*/
public function walkJoin($join);
/**
* Walks down a SelectExpression AST node and generates the corresponding SQL.
* Walks down a SelectExpression AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\SelectExpression $selectExpression
*
* @return string The SQL.
* @return void
*/
public function walkSelectExpression($selectExpression);
/**
* Walks down a QuantifiedExpression AST node, thereby generating the appropriate SQL.
* Walks down a QuantifiedExpression AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\QuantifiedExpression $qExpr
*
* @return string The SQL.
* @return void
*/
public function walkQuantifiedExpression($qExpr);
/**
* Walks down a Subselect AST node, thereby generating the appropriate SQL.
* Walks down a Subselect AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\Subselect $subselect
*
* @return string The SQL.
* @return void
*/
public function walkSubselect($subselect);
/**
* Walks down a SubselectFromClause AST node, thereby generating the appropriate SQL.
* Walks down a SubselectFromClause AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\SubselectFromClause $subselectFromClause
*
* @return string The SQL.
* @return void
*/
public function walkSubselectFromClause($subselectFromClause);
/**
* Walks down a SimpleSelectClause AST node, thereby generating the appropriate SQL.
* Walks down a SimpleSelectClause AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\SimpleSelectClause $simpleSelectClause
*
* @return string The SQL.
* @return void
*/
public function walkSimpleSelectClause($simpleSelectClause);
/**
* Walks down a SimpleSelectExpression AST node, thereby generating the appropriate SQL.
* Walks down a SimpleSelectExpression AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\SimpleSelectExpression $simpleSelectExpression
*
* @return string The SQL.
* @return void
*/
public function walkSimpleSelectExpression($simpleSelectExpression);
/**
* Walks down an AggregateExpression AST node, thereby generating the appropriate SQL.
* Walks down an AggregateExpression AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\AggregateExpression $aggExpression
*
* @return string The SQL.
* @return void
*/
public function walkAggregateExpression($aggExpression);
/**
* Walks down a GroupByClause AST node, thereby generating the appropriate SQL.
* Walks down a GroupByClause AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\GroupByClause $groupByClause
*
* @return string The SQL.
* @return void
*/
public function walkGroupByClause($groupByClause);
/**
* Walks down a GroupByItem AST node, thereby generating the appropriate SQL.
* Walks down a GroupByItem AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\PathExpression|string $groupByItem
*
* @return string The SQL.
* @return void
*/
public function walkGroupByItem($groupByItem);
/**
* Walks down an UpdateStatement AST node, thereby generating the appropriate SQL.
* Walks down an UpdateStatement AST node.
*
* @return string The SQL.
* @return void
*/
public function walkUpdateStatement(AST\UpdateStatement $AST);
/**
* Walks down a DeleteStatement AST node, thereby generating the appropriate SQL.
* Walks down a DeleteStatement AST node.
*
* @return string The SQL.
* @return void
*/
public function walkDeleteStatement(AST\DeleteStatement $AST);
/**
* Walks down a DeleteClause AST node, thereby generating the appropriate SQL.
* Walks down a DeleteClause AST node.
*
* @return string The SQL.
* @deprecated This method will be removed from the interface in 3.0.
*
* @return void
*/
public function walkDeleteClause(AST\DeleteClause $deleteClause);
/**
* Walks down an UpdateClause AST node, thereby generating the appropriate SQL.
* Walks down an UpdateClause AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\UpdateClause $updateClause
*
* @return string The SQL.
* @return void
*/
public function walkUpdateClause($updateClause);
/**
* Walks down an UpdateItem AST node, thereby generating the appropriate SQL.
* Walks down an UpdateItem AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\UpdateItem $updateItem
*
* @return string The SQL.
* @return void
*/
public function walkUpdateItem($updateItem);
/**
* Walks down a WhereClause AST node, thereby generating the appropriate SQL.
* Walks down a WhereClause AST node.
*
* WhereClause or not, the appropriate discriminator sql is added.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\WhereClause $whereClause
*
* @return string The SQL.
* @return void
*/
public function walkWhereClause($whereClause);
/**
* Walk down a ConditionalExpression AST node, thereby generating the appropriate SQL.
* Walk down a ConditionalExpression AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\ConditionalExpression $condExpr
*
* @return string The SQL.
* @return void
*/
public function walkConditionalExpression($condExpr);
/**
* Walks down a ConditionalTerm AST node, thereby generating the appropriate SQL.
* Walks down a ConditionalTerm AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\ConditionalTerm $condTerm
*
* @return string The SQL.
* @return void
*/
public function walkConditionalTerm($condTerm);
/**
* Walks down a ConditionalFactor AST node, thereby generating the appropriate SQL.
* Walks down a ConditionalFactor AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\ConditionalFactor $factor
*
* @return string The SQL.
* @return void
*/
public function walkConditionalFactor($factor);
/**
* Walks down a ConditionalPrimary AST node, thereby generating the appropriate SQL.
* Walks down a ConditionalPrimary AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\ConditionalPrimary $primary
*
* @return string The SQL.
* @return void
*/
public function walkConditionalPrimary($primary);
/**
* Walks down an ExistsExpression AST node, thereby generating the appropriate SQL.
* Walks down an ExistsExpression AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\ExistsExpression $existsExpr
*
* @return string The SQL.
* @return void
*/
public function walkExistsExpression($existsExpr);
/**
* Walks down a CollectionMemberExpression AST node, thereby generating the appropriate SQL.
* Walks down a CollectionMemberExpression AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\CollectionMemberExpression $collMemberExpr
*
* @return string The SQL.
* @return void
*/
public function walkCollectionMemberExpression($collMemberExpr);
/**
* Walks down an EmptyCollectionComparisonExpression AST node, thereby generating the appropriate SQL.
* Walks down an EmptyCollectionComparisonExpression AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\EmptyCollectionComparisonExpression $emptyCollCompExpr
*
* @return string The SQL.
* @return void
*/
public function walkEmptyCollectionComparisonExpression($emptyCollCompExpr);
/**
* Walks down a NullComparisonExpression AST node, thereby generating the appropriate SQL.
* Walks down a NullComparisonExpression AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\NullComparisonExpression $nullCompExpr
*
* @return string The SQL.
* @return void
*/
public function walkNullComparisonExpression($nullCompExpr);
/**
* Walks down an InExpression AST node, thereby generating the appropriate SQL.
* Walks down an InExpression AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\InExpression $inExpr
*
* @return string The SQL.
* @return void
*/
public function walkInExpression($inExpr);
/**
* Walks down an InstanceOfExpression AST node, thereby generating the appropriate SQL.
* Walks down an InstanceOfExpression AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\InstanceOfExpression $instanceOfExpr
*
* @return string The SQL.
* @return void
*/
public function walkInstanceOfExpression($instanceOfExpr);
/**
* Walks down a literal that represents an AST node, thereby generating the appropriate SQL.
* Walks down a literal that represents an AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\Literal $literal
*
* @return string The SQL.
* @return void
*/
public function walkLiteral($literal);
/**
* Walks down a BetweenExpression AST node, thereby generating the appropriate SQL.
* Walks down a BetweenExpression AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\BetweenExpression $betweenExpr
*
* @return string The SQL.
* @return void
*/
public function walkBetweenExpression($betweenExpr);
/**
* Walks down a LikeExpression AST node, thereby generating the appropriate SQL.
* Walks down a LikeExpression AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\LikeExpression $likeExpr
*
* @return string The SQL.
* @return void
*/
public function walkLikeExpression($likeExpr);
/**
* Walks down a StateFieldPathExpression AST node, thereby generating the appropriate SQL.
* Walks down a StateFieldPathExpression AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\PathExpression $stateFieldPathExpression
*
* @return string The SQL.
* @return void
*/
public function walkStateFieldPathExpression($stateFieldPathExpression);
/**
* Walks down a ComparisonExpression AST node, thereby generating the appropriate SQL.
* Walks down a ComparisonExpression AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\ComparisonExpression $compExpr
*
* @return string The SQL.
* @return void
*/
public function walkComparisonExpression($compExpr);
/**
* Walks down an InputParameter AST node, thereby generating the appropriate SQL.
* Walks down an InputParameter AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\InputParameter $inputParam
*
* @return string The SQL.
* @return void
*/
public function walkInputParameter($inputParam);
/**
* Walks down an ArithmeticExpression AST node, thereby generating the appropriate SQL.
* Walks down an ArithmeticExpression AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\ArithmeticExpression $arithmeticExpr
*
* @return string The SQL.
* @return void
*/
public function walkArithmeticExpression($arithmeticExpr);
/**
* Walks down an ArithmeticTerm AST node, thereby generating the appropriate SQL.
* Walks down an ArithmeticTerm AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param mixed $term
*
* @return string The SQL.
* @return void
*/
public function walkArithmeticTerm($term);
/**
* Walks down a StringPrimary that represents an AST node, thereby generating the appropriate SQL.
* Walks down a StringPrimary that represents an AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param mixed $stringPrimary
*
* @return string The SQL.
* @return void
*/
public function walkStringPrimary($stringPrimary);
/**
* Walks down an ArithmeticFactor that represents an AST node, thereby generating the appropriate SQL.
* Walks down an ArithmeticFactor that represents an AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param mixed $factor
*
* @return string The SQL.
* @return void
*/
public function walkArithmeticFactor($factor);
/**
* Walks down an SimpleArithmeticExpression AST node, thereby generating the appropriate SQL.
* Walks down an SimpleArithmeticExpression AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\SimpleArithmeticExpression $simpleArithmeticExpr
*
* @return string The SQL.
* @return void
*/
public function walkSimpleArithmeticExpression($simpleArithmeticExpr);
/**
* Walks down a PathExpression AST node, thereby generating the appropriate SQL.
* Walks down a PathExpression AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\PathExpression $pathExpr
*
* @return string The SQL.
* @return void
*/
public function walkPathExpression($pathExpr);
/**
* Walks down a ResultVariable that represents an AST node, thereby generating the appropriate SQL.
* Walks down a ResultVariable that represents an AST node.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param string $resultVariable
*
* @return string The SQL.
* @return void
*/
public function walkResultVariable($resultVariable);
/**
* Gets an executor that can be used to execute the result of this walker.
*
* @deprecated This method will be removed from the interface in 3.0.
*
* @param AST\DeleteStatement|AST\UpdateStatement|AST\SelectStatement $AST
*
* @return Exec\AbstractSqlExecutor
+366 -72
View File
@@ -4,10 +4,18 @@ declare(strict_types=1);
namespace Doctrine\ORM\Query;
use Doctrine\Deprecations\Deprecation;
use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\Mapping\ClassMetadata;
use LogicException;
use function array_diff;
use function array_keys;
use function debug_backtrace;
use function is_a;
use function sprintf;
use const DEBUG_BACKTRACE_IGNORE_ARGS;
/**
* An adapter implementation of the TreeWalker interface. The methods in this class
@@ -22,30 +30,30 @@ abstract class TreeWalkerAdapter implements TreeWalker
*
* @var AbstractQuery
*/
private $_query;
private $query;
/**
* The ParserResult of the original query that was produced by the Parser.
*
* @var ParserResult
*/
private $_parserResult;
private $parserResult;
/**
* The query components of the original query (the "symbol table") that was produced by the Parser.
*
* @psalm-var array<string, QueryComponent>
*/
private $_queryComponents;
private $queryComponents;
/**
* {@inheritdoc}
*/
public function __construct($query, $parserResult, array $queryComponents)
{
$this->_query = $query;
$this->_parserResult = $parserResult;
$this->_queryComponents = $queryComponents;
$this->query = $query;
$this->parserResult = $parserResult;
$this->queryComponents = $queryComponents;
}
/**
@@ -53,29 +61,59 @@ abstract class TreeWalkerAdapter implements TreeWalker
*/
public function getQueryComponents()
{
return $this->_queryComponents;
return $this->queryComponents;
}
/**
* {@inheritdoc}
* Sets or overrides a query component for a given dql alias.
*
* @internal This method will be protected in 3.0.
*
* @param string $dqlAlias The DQL alias.
* @param array<string, mixed> $queryComponent
* @psalm-param QueryComponent $queryComponent
*
* @return void
*/
public function setQueryComponent($dqlAlias, array $queryComponent)
{
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
if (! isset($trace[1]['class']) || ! is_a($trace[1]['class'], self::class, true)) {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method %s will be protected in 3.0. Calling it publicly is deprecated.',
__METHOD__
);
}
$requiredKeys = ['metadata', 'parent', 'relation', 'map', 'nestingLevel', 'token'];
if (array_diff($requiredKeys, array_keys($queryComponent))) {
throw QueryException::invalidQueryComponent($dqlAlias);
}
$this->_queryComponents[$dqlAlias] = $queryComponent;
$this->queryComponents[$dqlAlias] = $queryComponent;
}
/**
* {@inheritDoc}
* Returns internal queryComponents array.
*
* @deprecated Call {@see getQueryComponents()} instead.
*
* @return array<string, array<string, mixed>>
* @psalm-return array<string, QueryComponent>
*/
protected function _getQueryComponents()
{
return $this->_queryComponents;
Deprecation::triggerIfCalledFromOutside(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method %s is deprecated, call getQueryComponents() instead.',
__METHOD__
);
return $this->queryComponents;
}
/**
@@ -85,7 +123,7 @@ abstract class TreeWalkerAdapter implements TreeWalker
*/
protected function _getQuery()
{
return $this->_query;
return $this->query;
}
/**
@@ -95,14 +133,9 @@ abstract class TreeWalkerAdapter implements TreeWalker
*/
protected function _getParserResult()
{
return $this->_parserResult;
return $this->parserResult;
}
/**
* {@inheritdoc}
*
* @return void
*/
public function walkSelectStatement(AST\SelectStatement $AST)
{
}
@@ -110,124 +143,202 @@ abstract class TreeWalkerAdapter implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkSelectClause($selectClause)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkFromClause($fromClause)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkFunction($function)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkOrderByClause($orderByClause)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkOrderByItem($orderByItem)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkHavingClause($havingClause)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkJoin($join)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkSelectExpression($selectExpression)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkQuantifiedExpression($qExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkSubselect($subselect)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkSubselectFromClause($subselectFromClause)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkSimpleSelectClause($simpleSelectClause)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkSimpleSelectExpression($simpleSelectExpression)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkAggregateExpression($aggExpression)
{
@@ -236,35 +347,37 @@ abstract class TreeWalkerAdapter implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkGroupByClause($groupByClause)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkGroupByItem($groupByItem)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
*/
public function walkUpdateStatement(AST\UpdateStatement $AST)
{
}
/**
* {@inheritdoc}
*
* @return void
*/
public function walkDeleteStatement(AST\DeleteStatement $AST)
{
}
@@ -272,252 +385,433 @@ abstract class TreeWalkerAdapter implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkDeleteClause(AST\DeleteClause $deleteClause)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkUpdateClause($updateClause)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkUpdateItem($updateItem)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkWhereClause($whereClause)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkConditionalExpression($condExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkConditionalTerm($condTerm)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkConditionalFactor($factor)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkConditionalPrimary($primary)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkExistsExpression($existsExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkCollectionMemberExpression($collMemberExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkEmptyCollectionComparisonExpression($emptyCollCompExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkNullComparisonExpression($nullCompExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkInExpression($inExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkInstanceOfExpression($instanceOfExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkLiteral($literal)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkBetweenExpression($betweenExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkLikeExpression($likeExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkStateFieldPathExpression($stateFieldPathExpression)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkComparisonExpression($compExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkInputParameter($inputParam)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkArithmeticExpression($arithmeticExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkArithmeticTerm($term)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkStringPrimary($stringPrimary)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkArithmeticFactor($factor)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkSimpleArithmeticExpression($simpleArithmeticExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkPathExpression($pathExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkResultVariable($resultVariable)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
}
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function getExecutor($AST)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
return null;
}
final protected function getMetadataForDqlAlias(string $dqlAlias): ClassMetadata
{
$metadata = $this->_getQueryComponents()[$dqlAlias]['metadata'] ?? null;
if ($metadata === null) {
throw new LogicException(sprintf('No metadata for DQL alias: %s', $dqlAlias));
}
return $metadata;
}
}
+354 -59
View File
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Doctrine\ORM\Query;
use Doctrine\Deprecations\Deprecation;
use Doctrine\ORM\AbstractQuery;
use Generator;
@@ -90,11 +91,6 @@ class TreeWalkerChain implements TreeWalker
$this->walkers[] = $walkerClass;
}
/**
* {@inheritdoc}
*
* @return void
*/
public function walkSelectStatement(AST\SelectStatement $AST)
{
foreach ($this->getWalkers() as $walker) {
@@ -107,10 +103,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkSelectClause($selectClause)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkSelectClause($selectClause);
}
@@ -119,10 +122,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkFromClause($fromClause)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkFromClause($fromClause);
}
@@ -131,10 +141,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkFunction($function)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkFunction($function);
}
@@ -143,10 +160,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkOrderByClause($orderByClause)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkOrderByClause($orderByClause);
}
@@ -155,10 +179,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkOrderByItem($orderByItem)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkOrderByItem($orderByItem);
}
@@ -167,10 +198,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkHavingClause($havingClause)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkHavingClause($havingClause);
}
@@ -179,10 +217,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkJoin($join)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkJoin($join);
}
@@ -191,10 +236,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkSelectExpression($selectExpression)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkSelectExpression($selectExpression);
}
@@ -203,10 +255,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkQuantifiedExpression($qExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkQuantifiedExpression($qExpr);
}
@@ -215,10 +274,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkSubselect($subselect)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkSubselect($subselect);
}
@@ -227,10 +293,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkSubselectFromClause($subselectFromClause)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkSubselectFromClause($subselectFromClause);
}
@@ -239,10 +312,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkSimpleSelectClause($simpleSelectClause)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkSimpleSelectClause($simpleSelectClause);
}
@@ -251,10 +331,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkSimpleSelectExpression($simpleSelectExpression)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkSimpleSelectExpression($simpleSelectExpression);
}
@@ -263,10 +350,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkAggregateExpression($aggExpression)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkAggregateExpression($aggExpression);
}
@@ -275,10 +369,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkGroupByClause($groupByClause)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkGroupByClause($groupByClause);
}
@@ -287,20 +388,22 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkGroupByItem($groupByItem)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkGroupByItem($groupByItem);
}
}
/**
* {@inheritdoc}
*
* @return void
*/
public function walkUpdateStatement(AST\UpdateStatement $AST)
{
foreach ($this->getWalkers() as $walker) {
@@ -308,11 +411,6 @@ class TreeWalkerChain implements TreeWalker
}
}
/**
* {@inheritdoc}
*
* @return void
*/
public function walkDeleteStatement(AST\DeleteStatement $AST)
{
foreach ($this->getWalkers() as $walker) {
@@ -323,10 +421,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkDeleteClause(AST\DeleteClause $deleteClause)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkDeleteClause($deleteClause);
}
@@ -335,10 +440,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkUpdateClause($updateClause)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkUpdateClause($updateClause);
}
@@ -347,10 +459,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkUpdateItem($updateItem)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkUpdateItem($updateItem);
}
@@ -359,10 +478,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkWhereClause($whereClause)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkWhereClause($whereClause);
}
@@ -371,10 +497,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkConditionalExpression($condExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkConditionalExpression($condExpr);
}
@@ -383,10 +516,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkConditionalTerm($condTerm)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkConditionalTerm($condTerm);
}
@@ -395,10 +535,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkConditionalFactor($factor)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkConditionalFactor($factor);
}
@@ -407,10 +554,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkConditionalPrimary($condPrimary)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkConditionalPrimary($condPrimary);
}
@@ -419,10 +573,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkExistsExpression($existsExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkExistsExpression($existsExpr);
}
@@ -431,10 +592,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkCollectionMemberExpression($collMemberExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkCollectionMemberExpression($collMemberExpr);
}
@@ -443,10 +611,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkEmptyCollectionComparisonExpression($emptyCollCompExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkEmptyCollectionComparisonExpression($emptyCollCompExpr);
}
@@ -455,10 +630,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkNullComparisonExpression($nullCompExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkNullComparisonExpression($nullCompExpr);
}
@@ -467,10 +649,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkInExpression($inExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkInExpression($inExpr);
}
@@ -479,10 +668,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkInstanceOfExpression($instanceOfExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkInstanceOfExpression($instanceOfExpr);
}
@@ -491,10 +687,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkLiteral($literal)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkLiteral($literal);
}
@@ -503,10 +706,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkBetweenExpression($betweenExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkBetweenExpression($betweenExpr);
}
@@ -515,10 +725,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkLikeExpression($likeExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkLikeExpression($likeExpr);
}
@@ -527,10 +744,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkStateFieldPathExpression($stateFieldPathExpression)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkStateFieldPathExpression($stateFieldPathExpression);
}
@@ -539,10 +763,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkComparisonExpression($compExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkComparisonExpression($compExpr);
}
@@ -551,10 +782,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkInputParameter($inputParam)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkInputParameter($inputParam);
}
@@ -563,10 +801,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkArithmeticExpression($arithmeticExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkArithmeticExpression($arithmeticExpr);
}
@@ -575,10 +820,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkArithmeticTerm($term)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkArithmeticTerm($term);
}
@@ -587,10 +839,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkStringPrimary($stringPrimary)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkStringPrimary($stringPrimary);
}
@@ -599,10 +858,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkArithmeticFactor($factor)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkArithmeticFactor($factor);
}
@@ -611,10 +877,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkSimpleArithmeticExpression($simpleArithmeticExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkSimpleArithmeticExpression($simpleArithmeticExpr);
}
@@ -623,10 +896,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkPathExpression($pathExpr)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkPathExpression($pathExpr);
}
@@ -635,10 +915,17 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function walkResultVariable($resultVariable)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
foreach ($this->getWalkers() as $walker) {
$walker->walkResultVariable($resultVariable);
}
@@ -647,10 +934,18 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*
* @return void
* @deprecated This method will be removed in 3.0.
*/
public function getExecutor($AST)
{
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/9551',
'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.',
__METHOD__
);
return null;
}
/**
+46 -10
View File
@@ -6,6 +6,7 @@ namespace Doctrine\ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Criteria;
use Doctrine\Deprecations\Deprecation;
use Doctrine\ORM\Query\Expr;
use Doctrine\ORM\Query\Parameter;
use Doctrine\ORM\Query\QueryExpressionVisitor;
@@ -38,13 +39,19 @@ use function substr;
*/
class QueryBuilder
{
/* The query types. */
/** @deprecated */
public const SELECT = 0;
/** @deprecated */
public const DELETE = 1;
/** @deprecated */
public const UPDATE = 2;
/* The builder states. */
/** @deprecated */
public const STATE_DIRTY = 0;
/** @deprecated */
public const STATE_CLEAN = 1;
/**
@@ -105,9 +112,9 @@ class QueryBuilder
/**
* The index of the first result to retrieve.
*
* @var int|null
* @var int
*/
private $_firstResult = null;
private $_firstResult = 0;
/**
* The maximum number of results to retrieve.
@@ -274,11 +281,20 @@ class QueryBuilder
/**
* Gets the type of the currently built query.
*
* @deprecated If necessary, track the type of the query being built outside of the builder.
*
* @return int
* @psalm-return self::SELECT|self::DELETE|self::UPDATE
*/
public function getType()
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/orm/pull/9945',
'Relying on the type of the query being built is deprecated.'
. ' If necessary, track the type of the query being built outside of the builder.'
);
return $this->_type;
}
@@ -295,11 +311,19 @@ class QueryBuilder
/**
* Gets the state of this query builder instance.
*
* @deprecated The builder state is an internal concern.
*
* @return int Either QueryBuilder::STATE_DIRTY or QueryBuilder::STATE_CLEAN.
* @psalm-return self::STATE_*
*/
public function getState()
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/orm/pull/9945',
'Relying on the query builder state is deprecated as it is an internal concern.'
);
return $this->_state;
}
@@ -637,11 +661,7 @@ class QueryBuilder
*/
public function setFirstResult($firstResult)
{
if ($firstResult !== null) {
$firstResult = (int) $firstResult;
}
$this->_firstResult = $firstResult;
$this->_firstResult = (int) $firstResult;
return $this;
}
@@ -848,6 +868,14 @@ class QueryBuilder
return $this;
}
if (! $alias) {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/issues/9733',
'Omitting the alias is deprecated and will throw an exception in Doctrine 3.0.'
);
}
return $this->add('from', new Expr\From($delete, $alias));
}
@@ -875,6 +903,14 @@ class QueryBuilder
return $this;
}
if (! $alias) {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/issues/9733',
'Omitting the alias is deprecated and will throw an exception in Doctrine 3.0.'
);
}
return $this->add('from', new Expr\From($update, $alias));
}
@@ -1356,7 +1392,7 @@ class QueryBuilder
// Overwrite limits only if they was set in criteria
$firstResult = $criteria->getFirstResult();
if ($firstResult !== null) {
if ($firstResult > 0) {
$this->setFirstResult($firstResult);
}
@@ -49,11 +49,9 @@ EOT
if ($dumpSql) {
$sqls = $schemaTool->getCreateSchemaSql($metadatas);
$ui->text('The following SQL statements will be executed:');
$ui->newLine();
foreach ($sqls as $sql) {
$ui->text(sprintf(' %s;', $sql));
$ui->writeln(sprintf('%s;', $sql));
}
return 0;
@@ -60,11 +60,8 @@ EOT
$sqls = $schemaTool->getDropSchemaSQL($metadatas);
}
$ui->text('The following SQL statements will be executed:');
$ui->newLine();
foreach ($sqls as $sql) {
$ui->text(sprintf(' %s;', $sql));
$ui->writeln(sprintf('%s;', $sql));
}
return 0;
@@ -88,10 +88,8 @@ EOT
$force = $input->getOption('force') === true;
if ($dumpSql) {
$ui->text('The following SQL statements will be executed:');
$ui->newLine();
foreach ($sqls as $sql) {
$ui->text(sprintf(' %s;', $sql));
$ui->writeln(sprintf('%s;', $sql));
}
}
@@ -25,6 +25,8 @@ use function strtolower;
/**
* Class to help with converting Doctrine 1 schema files to Doctrine 2 mapping files
*
* @deprecated This class is being removed from the ORM and won't have any replacement
*
* @link www.doctrine-project.org
*/
class ConvertDoctrine1Schema
@@ -51,7 +51,7 @@ class DebugUnitOfWorkListener
*/
public function onFlush(OnFlushEventArgs $args)
{
$this->dumpIdentityMap($args->getEntityManager());
$this->dumpIdentityMap($args->getObjectManager());
}
/**
@@ -13,6 +13,8 @@ use Doctrine\Persistence\Mapping\StaticReflectionService;
* load some mapping information and use it to do things like generate code
* from the mapping information.
*
* @deprecated This class is being removed from the ORM and will be removed in 3.0.
*
* @link www.doctrine-project.org
*/
class DisconnectedClassMetadataFactory extends ClassMetadataFactory
+1 -1
View File
@@ -1334,7 +1334,7 @@ public function __construct(<params>)
$lines[] = $this->generateAssociationMappingPropertyDocBlock($associationMapping, $metadata);
$lines[] = $this->spaces . $this->fieldVisibility . ' $' . $associationMapping['fieldName']
. ($associationMapping['type'] === 'manyToMany' ? ' = array()' : null) . ";\n";
. ($associationMapping['type'] === ClassMetadataInfo::MANY_TO_MANY ? ' = array()' : null) . ";\n";
}
return implode("\n", $lines);
@@ -30,6 +30,10 @@ use function sprintf;
* Works with composite keys but cannot deal with queries that have multiple
* root entities (e.g. `SELECT f, b from Foo, Bar`)
*
* Note that the ORDER BY clause is not removed. Many SQL implementations (e.g. MySQL)
* are able to cache subqueries. By keeping the ORDER BY clause intact, the limitSubQuery
* that will most likely be executed next can be read from the native SQL cache.
*
* @psalm-import-type QueryComponent from Parser
*/
class CountOutputWalker extends SqlWalker
@@ -59,15 +63,7 @@ class CountOutputWalker extends SqlWalker
}
/**
* Walks down a SelectStatement AST node, wrapping it in a COUNT (SELECT DISTINCT).
*
* Note that the ORDER BY clause is not removed. Many SQL implementations (e.g. MySQL)
* are able to cache subqueries. By keeping the ORDER BY clause intact, the limitSubQuery
* that will most likely be executed next can be read from the native SQL cache.
*
* @return string
*
* @throws RuntimeException
* {@inheritdoc}
*/
public function walkSelectStatement(SelectStatement $AST)
{
@@ -24,20 +24,12 @@ class CountWalker extends TreeWalkerAdapter
*/
public const HINT_DISTINCT = 'doctrine_paginator.distinct';
/**
* Walks down a SelectStatement AST node, modifying it to retrieve a COUNT.
*
* @return void
*
* @throws RuntimeException
*/
public function walkSelectStatement(SelectStatement $AST)
{
if ($AST->havingClause) {
throw new RuntimeException('Cannot count query that uses a HAVING clause. Use the output walkers for pagination');
}
$queryComponents = $this->_getQueryComponents();
// Get the root entity and alias from the AST fromClause
$from = $AST->fromClause->identificationVariableDeclarations;
@@ -47,7 +39,7 @@ class CountWalker extends TreeWalkerAdapter
$fromRoot = reset($from);
$rootAlias = $fromRoot->rangeVariableDeclaration->aliasIdentificationVariable;
$rootClass = $queryComponents[$rootAlias]['metadata'];
$rootClass = $this->getMetadataForDqlAlias($rootAlias);
$identifierFieldName = $rootClass->getSingleIdentifierFieldName();
$pathType = PathExpression::TYPE_STATE_FIELD;
@@ -104,7 +104,7 @@ class LimitSubqueryOutputWalker extends SqlWalker
// Reset limit and offset
$this->firstResult = $query->getFirstResult();
$this->maxResults = $query->getMaxResults();
$query->setFirstResult(null)->setMaxResults(null);
$query->setFirstResult(0)->setMaxResults(null);
$this->em = $query->getEntityManager();
$this->quoteStrategy = $this->em->getConfiguration()->getQuoteStrategy();
@@ -155,11 +155,7 @@ class LimitSubqueryOutputWalker extends SqlWalker
}
/**
* Walks down a SelectStatement AST node, wrapping it in a SELECT DISTINCT.
*
* @return string
*
* @throws RuntimeException
* {@inheritdoc}
*/
public function walkSelectStatement(SelectStatement $AST)
{
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Doctrine\ORM\Tools\Pagination;
use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Query;
use Doctrine\ORM\Query\AST\Functions\IdentityFunction;
use Doctrine\ORM\Query\AST\Node;
@@ -35,22 +35,13 @@ class LimitSubqueryWalker extends TreeWalkerAdapter
*/
private $_aliasCounter = 0;
/**
* Walks down a SelectStatement AST node, modifying it to retrieve DISTINCT ids
* of the root Entity.
*
* @return void
*
* @throws RuntimeException
*/
public function walkSelectStatement(SelectStatement $AST)
{
$queryComponents = $this->_getQueryComponents();
// Get the root entity and alias from the AST fromClause
$from = $AST->fromClause->identificationVariableDeclarations;
$fromRoot = reset($from);
$rootAlias = $fromRoot->rangeVariableDeclaration->aliasIdentificationVariable;
$rootClass = $queryComponents[$rootAlias]['metadata'];
$rootClass = $this->getMetadataForDqlAlias($rootAlias);
$this->validate($AST);
$identifier = $rootClass->getSingleIdentifierFieldName();
@@ -81,6 +72,7 @@ class LimitSubqueryWalker extends TreeWalkerAdapter
return;
}
$queryComponents = $this->_getQueryComponents();
foreach ($AST->orderByClause->orderByItems as $item) {
if ($item->expression instanceof PathExpression) {
$AST->selectClause->selectExpressions[] = new SelectExpression(
@@ -135,7 +127,7 @@ class LimitSubqueryWalker extends TreeWalkerAdapter
if (
isset($queryComponent['parent'])
&& isset($queryComponent['relation'])
&& $queryComponent['relation']['type'] & ClassMetadataInfo::TO_MANY
&& $queryComponent['relation']['type'] & ClassMetadata::TO_MANY
) {
throw new RuntimeException('Cannot select distinct identifiers from query with LIMIT and ORDER BY on a column from a fetch joined to-many association. Use output walkers.');
}
@@ -157,7 +157,7 @@ class Paginator implements Countable, IteratorAggregate
$this->appendTreeWalker($whereInQuery, WhereInWalker::class);
$whereInQuery->setHint(WhereInWalker::HINT_PAGINATOR_ID_COUNT, count($ids));
$whereInQuery->setFirstResult(null)->setMaxResults(null);
$whereInQuery->setFirstResult(0)->setMaxResults(null);
$whereInQuery->setParameter(WhereInWalker::PAGINATOR_ID_ALIAS, $ids);
$whereInQuery->setCacheable($this->query->isCacheable());
$whereInQuery->expireQueryCache();
@@ -241,7 +241,7 @@ class Paginator implements Countable, IteratorAggregate
$this->unbindUnusedQueryParams($countQuery);
}
$countQuery->setFirstResult(null)->setMaxResults(null);
$countQuery->setFirstResult(0)->setMaxResults(null);
return $countQuery;
}
@@ -23,7 +23,6 @@ class RowNumberOverFunction extends FunctionNode
public $orderByClause;
/**
* @override
* @inheritdoc
*/
public function getSql(SqlWalker $sqlWalker)
@@ -36,7 +35,6 @@ class RowNumberOverFunction extends FunctionNode
/**
* @throws RowNumberOverFunctionNotEnabled
*
* @override
* @inheritdoc
*/
public function parse(Parser $parser)
@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace Doctrine\ORM\Tools\Pagination;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Query\AST\ArithmeticExpression;
use Doctrine\ORM\Query\AST\ConditionalExpression;
use Doctrine\ORM\Query\AST\ConditionalFactor;
@@ -28,7 +27,13 @@ use function is_array;
use function reset;
/**
* Appends a condition "id IN (:foo_1, :foo_2)" to the whereClause of the AST.
* Appends a condition equivalent to "WHERE IN (:dpid_1, :dpid_2, ...)" to the whereClause of the AST.
*
* The parameter namespace (dpid) is defined by
* the PAGINATOR_ID_ALIAS
*
* The total number of parameters is retrieved from
* the HINT_PAGINATOR_ID_COUNT query hint.
*/
class WhereInWalker extends TreeWalkerAdapter
{
@@ -42,22 +47,8 @@ class WhereInWalker extends TreeWalkerAdapter
*/
public const PAGINATOR_ID_ALIAS = 'dpid';
/**
* Appends a condition equivalent to "WHERE IN (:dpid_1, :dpid_2, ...)" to the whereClause of the AST.
*
* The parameter namespace (dpid) is defined by
* the PAGINATOR_ID_ALIAS
*
* The total number of parameters is retrieved from
* the HINT_PAGINATOR_ID_COUNT query hint.
*
* @return void
*
* @throws RuntimeException
*/
public function walkSelectStatement(SelectStatement $AST)
{
$queryComponents = $this->_getQueryComponents();
// Get the root entity and alias from the AST fromClause
$from = $AST->fromClause->identificationVariableDeclarations;
@@ -65,10 +56,9 @@ class WhereInWalker extends TreeWalkerAdapter
throw new RuntimeException('Cannot count query which selects two FROM components, cannot make distinction');
}
$fromRoot = reset($from);
$rootAlias = $fromRoot->rangeVariableDeclaration->aliasIdentificationVariable;
$rootClass = $queryComponents[$rootAlias]['metadata'];
assert($rootClass instanceof ClassMetadata);
$fromRoot = reset($from);
$rootAlias = $fromRoot->rangeVariableDeclaration->aliasIdentificationVariable;
$rootClass = $this->getMetadataForDqlAlias($rootAlias);
$identifierFieldName = $rootClass->getSingleIdentifierFieldName();
$pathType = PathExpression::TYPE_STATE_FIELD;
+32 -35
View File
@@ -13,7 +13,6 @@ use Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\Visitor\DropSchemaSqlCollector;
use Doctrine\DBAL\Schema\Visitor\RemoveNamespacedAssets;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping\ClassMetadata;
@@ -579,6 +578,12 @@ class SchemaTool
$this->quoteStrategy->getJoinTableName($mapping, $foreignClass, $this->platform)
);
if (isset($joinTable['options'])) {
foreach ($joinTable['options'] as $key => $val) {
$theJoinTable->addOption($key, $val);
}
}
$primaryKeyColumns = [];
// Build first FK constraint (relation table => source table)
@@ -706,14 +711,13 @@ class SchemaTool
$fieldMapping = $definingClass->getFieldMapping($referencedFieldName);
$columnDef = null;
if (isset($joinColumn['columnDefinition'])) {
$columnDef = $joinColumn['columnDefinition'];
} elseif (isset($fieldMapping['columnDefinition'])) {
$columnDef = $fieldMapping['columnDefinition'];
}
$columnOptions = ['notnull' => false];
$columnOptions = ['notnull' => false, 'columnDefinition' => $columnDef];
if (isset($joinColumn['columnDefinition'])) {
$columnOptions['columnDefinition'] = $joinColumn['columnDefinition'];
} elseif (isset($fieldMapping['columnDefinition'])) {
$columnOptions['columnDefinition'] = $fieldMapping['columnDefinition'];
}
if (isset($joinColumn['nullable'])) {
$columnOptions['notnull'] = ! $joinColumn['nullable'];
@@ -721,13 +725,17 @@ class SchemaTool
$columnOptions += $this->gatherColumnOptions($fieldMapping);
if ($fieldMapping['type'] === 'string' && isset($fieldMapping['length'])) {
if (isset($fieldMapping['length'])) {
$columnOptions['length'] = $fieldMapping['length'];
} elseif ($fieldMapping['type'] === 'decimal') {
}
if ($fieldMapping['type'] === 'decimal') {
$columnOptions['scale'] = $fieldMapping['scale'];
$columnOptions['precision'] = $fieldMapping['precision'];
}
$columnOptions = $this->gatherColumnOptions($joinColumn) + $columnOptions;
$theJoinTable->addColumn($quotedColumnName, $fieldMapping['type'], $columnOptions);
}
@@ -848,12 +856,9 @@ class SchemaTool
*/
public function getDropDatabaseSQL()
{
$schema = $this->schemaManager->createSchema();
$visitor = new DropSchemaSqlCollector($this->platform);
$schema->visit($visitor);
return $visitor->getQueries();
return $this->schemaManager
->createSchema()
->toDropSql($this->platform);
}
/**
@@ -865,29 +870,21 @@ class SchemaTool
*/
public function getDropSchemaSQL(array $classes)
{
$visitor = new DropSchemaSqlCollector($this->platform);
$schema = $this->getSchemaFromMetadata($classes);
$schema = $this->getSchemaFromMetadata($classes);
$fullSchema = $this->schemaManager->createSchema();
$deployedSchema = $this->schemaManager->createSchema();
foreach ($fullSchema->getTables() as $table) {
if (! $schema->hasTable($table->getName())) {
foreach ($table->getForeignKeys() as $foreignKey) {
if ($schema->hasTable($foreignKey->getForeignTableName())) {
$visitor->acceptForeignKey($table, $foreignKey);
}
}
} else {
$visitor->acceptTable($table);
foreach ($table->getForeignKeys() as $foreignKey) {
$visitor->acceptForeignKey($table, $foreignKey);
}
foreach ($schema->getTables() as $table) {
if (! $deployedSchema->hasTable($table->getName())) {
$schema->dropTable($table->getName());
}
}
if ($this->platform->supportsSequences()) {
foreach ($schema->getSequences() as $sequence) {
$visitor->acceptSequence($sequence);
if (! $deployedSchema->hasSequence($sequence->getName())) {
$schema->dropSequence($sequence->getName());
}
}
foreach ($schema->getTables() as $table) {
@@ -895,15 +892,15 @@ class SchemaTool
$columns = $table->getPrimaryKey()->getColumns();
if (count($columns) === 1) {
$checkSequence = $table->getName() . '_' . $columns[0] . '_seq';
if ($fullSchema->hasSequence($checkSequence)) {
$visitor->acceptSequence($fullSchema->getSequence($checkSequence));
if ($deployedSchema->hasSequence($checkSequence) && ! $schema->hasSequence($checkSequence)) {
$schema->createSequence($checkSequence);
}
}
}
}
}
return $visitor->getQueries();
return $schema->toDropSql($this->platform);
}
/**
+19 -5
View File
@@ -5,7 +5,9 @@ declare(strict_types=1);
namespace Doctrine\ORM\Tools;
use Doctrine\DBAL\Types\Type;
use Doctrine\Deprecations\Deprecation;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use function array_diff;
@@ -15,6 +17,7 @@ use function array_values;
use function class_exists;
use function class_parents;
use function count;
use function get_class;
use function implode;
use function in_array;
@@ -69,6 +72,17 @@ class SchemaValidator
*/
public function validateClass(ClassMetadataInfo $class)
{
if (! $class instanceof ClassMetadata) {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/249',
'Passing an instance of %s to %s is deprecated, please pass a ClassMetadata instance instead.',
get_class($class),
__METHOD__,
ClassMetadata::class
);
}
$ce = [];
$cmf = $this->em->getMetadataFactory();
@@ -146,13 +160,13 @@ class SchemaValidator
// Verify inverse side/owning side match each other
if (array_key_exists($assoc['inversedBy'], $targetMetadata->associationMappings)) {
$targetAssoc = $targetMetadata->associationMappings[$assoc['inversedBy']];
if ($assoc['type'] === ClassMetadataInfo::ONE_TO_ONE && $targetAssoc['type'] !== ClassMetadataInfo::ONE_TO_ONE) {
if ($assoc['type'] === ClassMetadata::ONE_TO_ONE && $targetAssoc['type'] !== ClassMetadata::ONE_TO_ONE) {
$ce[] = 'If association ' . $class->name . '#' . $fieldName . ' is one-to-one, then the inversed ' .
'side ' . $targetMetadata->name . '#' . $assoc['inversedBy'] . ' has to be one-to-one as well.';
} elseif ($assoc['type'] === ClassMetadataInfo::MANY_TO_ONE && $targetAssoc['type'] !== ClassMetadataInfo::ONE_TO_MANY) {
} elseif ($assoc['type'] === ClassMetadata::MANY_TO_ONE && $targetAssoc['type'] !== ClassMetadata::ONE_TO_MANY) {
$ce[] = 'If association ' . $class->name . '#' . $fieldName . ' is many-to-one, then the inversed ' .
'side ' . $targetMetadata->name . '#' . $assoc['inversedBy'] . ' has to be one-to-many.';
} elseif ($assoc['type'] === ClassMetadataInfo::MANY_TO_MANY && $targetAssoc['type'] !== ClassMetadataInfo::MANY_TO_MANY) {
} elseif ($assoc['type'] === ClassMetadata::MANY_TO_MANY && $targetAssoc['type'] !== ClassMetadata::MANY_TO_MANY) {
$ce[] = 'If association ' . $class->name . '#' . $fieldName . ' is many-to-many, then the inversed ' .
'side ' . $targetMetadata->name . '#' . $assoc['inversedBy'] . ' has to be many-to-many as well.';
}
@@ -160,7 +174,7 @@ class SchemaValidator
}
if ($assoc['isOwningSide']) {
if ($assoc['type'] === ClassMetadataInfo::MANY_TO_MANY) {
if ($assoc['type'] === ClassMetadata::MANY_TO_MANY) {
$identifierColumns = $class->getIdentifierColumnNames();
foreach ($assoc['joinTable']['joinColumns'] as $joinColumn) {
if (! in_array($joinColumn['referencedColumnName'], $identifierColumns, true)) {
@@ -192,7 +206,7 @@ class SchemaValidator
"however '" . implode(', ', array_diff($class->getIdentifierColumnNames(), array_values($assoc['relationToSourceKeyColumns']))) .
"' are missing.";
}
} elseif ($assoc['type'] & ClassMetadataInfo::TO_ONE) {
} elseif ($assoc['type'] & ClassMetadata::TO_ONE) {
$identifierColumns = $targetMetadata->getIdentifierColumnNames();
foreach ($assoc['joinColumns'] as $joinColumn) {
if (! in_array($joinColumn['referencedColumnName'], $identifierColumns, true)) {
+8 -5
View File
@@ -25,6 +25,7 @@ use Doctrine\ORM\Id\AssignedGenerator;
use Doctrine\ORM\Internal\CommitOrderCalculator;
use Doctrine\ORM\Internal\HydrationCompleteHandler;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\MappingException;
use Doctrine\ORM\Mapping\Reflection\ReflectionPropertiesGetter;
use Doctrine\ORM\Persisters\Collection\CollectionPersister;
@@ -74,6 +75,8 @@ use function sprintf;
* in the correct order.
*
* Internal note: This class contains highly performance-sensitive code.
*
* @psalm-import-type AssociationMapping from ClassMetadataInfo
*/
class UnitOfWork implements PropertyChangedListener
{
@@ -1940,8 +1943,8 @@ class UnitOfWork implements PropertyChangedListener
/**
* Executes a merge operation on an entity.
*
* @param object $entity
* @param string[] $assoc
* @param object $entity
* @psalm-param AssociationMapping|null $assoc
* @psalm-param array<int, object> $visited
*
* @return object The managed copy of the entity.
@@ -1955,7 +1958,7 @@ class UnitOfWork implements PropertyChangedListener
$entity,
array &$visited,
$prevManagedCopy = null,
array $assoc = []
?array $assoc = null
) {
$oid = spl_object_id($entity);
@@ -2091,8 +2094,8 @@ class UnitOfWork implements PropertyChangedListener
/**
* Sets/adds associated managed copies into the previous entity's association field
*
* @param object $entity
* @param string[] $association
* @param object $entity
* @psalm-param AssociationMapping $association
*/
private function updateAssociationWithMergedEntity(
$entity,
+2 -487
View File
@@ -556,472 +556,12 @@ parameters:
path: lib/Doctrine/ORM/Query/SqlWalker.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:getExecutor\\(\\) should be compatible with return type \\(Doctrine\\\\ORM\\\\Query\\\\Exec\\\\AbstractSqlExecutor\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:getExecutor\\(\\)$#"
message: "#^Method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:getExecutor\\(\\) should return Doctrine\\\\ORM\\\\Query\\\\Exec\\\\AbstractSqlExecutor but returns null\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkAggregateExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkAggregateExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkArithmeticExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkArithmeticExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkArithmeticFactor\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkArithmeticFactor\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkArithmeticTerm\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkArithmeticTerm\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkBetweenExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkBetweenExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkCollectionMemberExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkCollectionMemberExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkComparisonExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkComparisonExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkConditionalExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkConditionalExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkConditionalFactor\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkConditionalFactor\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkConditionalPrimary\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkConditionalPrimary\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkConditionalTerm\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkConditionalTerm\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkDeleteClause\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkDeleteClause\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkDeleteStatement\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkDeleteStatement\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkEmptyCollectionComparisonExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkEmptyCollectionComparisonExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkExistsExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkExistsExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkFromClause\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkFromClause\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkFunction\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkFunction\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkGroupByClause\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkGroupByClause\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkGroupByItem\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkGroupByItem\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkHavingClause\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkHavingClause\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkInExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkInExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkInputParameter\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkInputParameter\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkInstanceOfExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkInstanceOfExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkJoin\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkJoin\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkLikeExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkLikeExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkLiteral\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkLiteral\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkNullComparisonExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkNullComparisonExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkOrderByClause\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkOrderByClause\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkOrderByItem\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkOrderByItem\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkPathExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkPathExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkQuantifiedExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkQuantifiedExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkResultVariable\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkResultVariable\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkSelectClause\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkSelectClause\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkSelectExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkSelectExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkSelectStatement\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkSelectStatement\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkSimpleArithmeticExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkSimpleArithmeticExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkSimpleSelectClause\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkSimpleSelectClause\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkSimpleSelectExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkSimpleSelectExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkStateFieldPathExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkStateFieldPathExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkStringPrimary\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkStringPrimary\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkSubselect\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkSubselect\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkSubselectFromClause\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkSubselectFromClause\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkUpdateClause\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkUpdateClause\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkUpdateItem\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkUpdateItem\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkUpdateStatement\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkUpdateStatement\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerAdapter\\:\\:walkWhereClause\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkWhereClause\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerAdapter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:getExecutor\\(\\) should be compatible with return type \\(Doctrine\\\\ORM\\\\Query\\\\Exec\\\\AbstractSqlExecutor\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:getExecutor\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkAggregateExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkAggregateExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkArithmeticExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkArithmeticExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkArithmeticFactor\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkArithmeticFactor\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkArithmeticTerm\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkArithmeticTerm\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkBetweenExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkBetweenExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkCollectionMemberExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkCollectionMemberExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkComparisonExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkComparisonExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkConditionalExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkConditionalExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkConditionalFactor\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkConditionalFactor\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkConditionalPrimary\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkConditionalPrimary\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkConditionalTerm\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkConditionalTerm\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkDeleteClause\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkDeleteClause\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkDeleteStatement\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkDeleteStatement\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkEmptyCollectionComparisonExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkEmptyCollectionComparisonExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkExistsExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkExistsExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkFromClause\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkFromClause\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkFunction\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkFunction\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkGroupByClause\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkGroupByClause\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkGroupByItem\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkGroupByItem\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkHavingClause\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkHavingClause\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkInExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkInExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkInputParameter\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkInputParameter\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkInstanceOfExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkInstanceOfExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkJoin\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkJoin\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkLikeExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkLikeExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkLiteral\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkLiteral\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkNullComparisonExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkNullComparisonExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkOrderByClause\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkOrderByClause\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkOrderByItem\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkOrderByItem\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkPathExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkPathExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkQuantifiedExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkQuantifiedExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkResultVariable\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkResultVariable\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkSelectClause\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkSelectClause\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkSelectExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkSelectExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkSelectStatement\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkSelectStatement\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkSimpleArithmeticExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkSimpleArithmeticExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkSimpleSelectClause\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkSimpleSelectClause\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkSimpleSelectExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkSimpleSelectExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkStateFieldPathExpression\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkStateFieldPathExpression\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkStringPrimary\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkStringPrimary\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkSubselect\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkSubselect\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkSubselectFromClause\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkSubselectFromClause\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkUpdateClause\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkUpdateClause\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkUpdateItem\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkUpdateItem\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkUpdateStatement\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkUpdateStatement\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:walkWhereClause\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkWhereClause\\(\\)$#"
message: "#^Method Doctrine\\\\ORM\\\\Query\\\\TreeWalkerChain\\:\\:getExecutor\\(\\) should return Doctrine\\\\ORM\\\\Query\\\\Exec\\\\AbstractSqlExecutor but returns null\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/TreeWalkerChain.php
@@ -1195,16 +735,6 @@ parameters:
count: 1
path: lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Tools\\\\Pagination\\\\CountWalker\\:\\:walkSelectStatement\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkSelectStatement\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Tools/Pagination/CountWalker.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Tools\\\\Pagination\\\\LimitSubqueryWalker\\:\\:walkSelectStatement\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkSelectStatement\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryWalker.php
-
message: "#^Instanceof between \\*NEVER\\* and Doctrine\\\\ORM\\\\Query\\\\AST\\\\ConditionalFactor will always evaluate to false\\.$#"
count: 1
@@ -1220,11 +750,6 @@ parameters:
count: 1
path: lib/Doctrine/ORM/Tools/Pagination/WhereInWalker.php
-
message: "#^Return type \\(void\\) of method Doctrine\\\\ORM\\\\Tools\\\\Pagination\\\\WhereInWalker\\:\\:walkSelectStatement\\(\\) should be compatible with return type \\(string\\) of method Doctrine\\\\ORM\\\\Query\\\\TreeWalker\\:\\:walkSelectStatement\\(\\)$#"
count: 1
path: lib/Doctrine/ORM/Tools/Pagination/WhereInWalker.php
-
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
count: 1
@@ -1235,11 +760,6 @@ parameters:
count: 1
path: lib/Doctrine/ORM/Tools/SchemaTool.php
-
message: "#^Binary operation \"&\" between string and 3 results in an error\\.$#"
count: 1
path: lib/Doctrine/ORM/UnitOfWork.php
-
message: "#^Call to an undefined method Doctrine\\\\Common\\\\Collections\\\\Collection\\<\\(int\\|string\\), object\\>\\:\\:getMapping\\(\\)\\.$#"
count: 2
@@ -1265,11 +785,6 @@ parameters:
count: 1
path: lib/Doctrine/ORM/UnitOfWork.php
-
message: "#^Strict comparison using \\=\\=\\= between string and 4 will always evaluate to false\\.$#"
count: 1
path: lib/Doctrine/ORM/UnitOfWork.php
-
message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\:\\:\\$name\\.$#"
count: 1
+240 -258
View File
@@ -7,6 +7,9 @@
<DeprecatedMethod occurrences="1">
<code>iterate</code>
</DeprecatedMethod>
<DocblockTypeContradiction occurrences="1">
<code>in_array($fetchMode, [Mapping\ClassMetadata::FETCH_EAGER, Mapping\ClassMetadata::FETCH_LAZY], true)</code>
</DocblockTypeContradiction>
<FalsableReturnStatement occurrences="1">
<code>! $filteredParameters-&gt;isEmpty() ? $filteredParameters-&gt;first() : null</code>
</FalsableReturnStatement>
@@ -75,6 +78,12 @@
<InvalidArgument occurrences="1">
<code>$em-&gt;getMetadataFactory()</code>
</InvalidArgument>
<PossiblyNullArrayOffset occurrences="1">
<code>$targetClassMetadata-&gt;associationMappings</code>
</PossiblyNullArrayOffset>
<PossiblyUndefinedArrayOffset occurrences="3">
<code>$assoc['joinColumnFieldNames']</code>
</PossiblyUndefinedArrayOffset>
<UndefinedInterfaceMethod occurrences="1">
<code>getCacheRegion</code>
</UndefinedInterfaceMethod>
@@ -337,6 +346,9 @@
</UnsafeInstantiation>
</file>
<file src="lib/Doctrine/ORM/EntityRepository.php">
<DeprecatedMethod occurrences="1">
<code>addNamedNativeQueryMapping</code>
</DeprecatedMethod>
<InvalidReturnStatement occurrences="2">
<code>$persister-&gt;load($criteria, null, null, [], null, 1, $orderBy)</code>
<code>new LazyCriteriaCollection($persister, $criteria)</code>
@@ -386,6 +398,10 @@
<code>IterableResult</code>
<code>new IterableResult($this)</code>
</DeprecatedClass>
<PossiblyUndefinedArrayOffset occurrences="2">
<code>$class-&gt;associationMappings[$fieldName]['joinColumns']</code>
<code>$class-&gt;associationMappings[$fieldName]['joinColumns']</code>
</PossiblyUndefinedArrayOffset>
<ReferenceConstraintViolation occurrences="1">
<code>return $rowData;</code>
</ReferenceConstraintViolation>
@@ -430,9 +446,13 @@
<code>$parentObject</code>
<code>$parentObject</code>
</PossiblyInvalidArgument>
<PossiblyNullArgument occurrences="1">
<PossiblyNullArgument occurrences="2">
<code>$objectClass</code>
<code>$relation['mappedBy']</code>
</PossiblyNullArgument>
<PossiblyNullArrayOffset occurrences="1">
<code>$targetClass-&gt;reflFields</code>
</PossiblyNullArrayOffset>
<PossiblyNullReference occurrences="6">
<code>getValue</code>
<code>getValue</code>
@@ -441,7 +461,9 @@
<code>setValue</code>
<code>setValue</code>
</PossiblyNullReference>
<PossiblyUndefinedArrayOffset occurrences="1">
<PossiblyUndefinedArrayOffset occurrences="3">
<code>$class-&gt;associationMappings[$class-&gt;identifier[0]]['joinColumns']</code>
<code>$class-&gt;associationMappings[$fieldName]['joinColumns']</code>
<code>$newObject['args']</code>
</PossiblyUndefinedArrayOffset>
</file>
@@ -556,8 +578,9 @@
<code>$this-&gt;columnNames</code>
<code>$this-&gt;columnNames</code>
</DeprecatedProperty>
<DocblockTypeContradiction occurrences="2">
<DocblockTypeContradiction occurrences="3">
<code>! $this-&gt;table</code>
<code>! class_exists($mapping['targetEntity'])</code>
<code>$this-&gt;table</code>
</DocblockTypeContradiction>
<InvalidDocblock occurrences="3">
@@ -565,9 +588,10 @@
<code>protected function _validateAndCompleteManyToManyMapping(array $mapping)</code>
<code>protected function _validateAndCompleteOneToOneMapping(array $mapping)</code>
</InvalidDocblock>
<InvalidNullableReturnType occurrences="2">
<InvalidNullableReturnType occurrences="3">
<code>ReflectionProperty</code>
<code>ReflectionProperty</code>
<code>getAssociationMappedByTargetField</code>
</InvalidNullableReturnType>
<InvalidPropertyAssignmentValue occurrences="2">
<code>$definition</code>
@@ -585,13 +609,6 @@
<code>$className</code>
<code>$this-&gt;namespace . '\\' . $className</code>
</LessSpecificReturnStatement>
<MissingClosureParamType occurrences="2">
<code>$joinColumn</code>
<code>$joinColumn</code>
</MissingClosureParamType>
<MissingClosureReturnType occurrences="1">
<code>static function ($joinColumn) {</code>
</MissingClosureReturnType>
<MissingReturnType occurrences="3">
<code>_validateAndCompleteAssociationMapping</code>
<code>_validateAndCompleteManyToManyMapping</code>
@@ -601,7 +618,8 @@
<code>array{usage: int, region: string|null}</code>
<code>class-string|null</code>
</MoreSpecificReturnType>
<NullableReturnStatement occurrences="3">
<NullableReturnStatement occurrences="4">
<code>$this-&gt;associationMappings[$fieldName]['mappedBy']</code>
<code>$this-&gt;reflClass</code>
<code>$this-&gt;reflFields[$name]</code>
<code>$this-&gt;reflFields[$this-&gt;identifier[0]]</code>
@@ -636,10 +654,15 @@
<code>setValue</code>
<code>setValue</code>
</PossiblyNullReference>
<PossiblyUndefinedArrayOffset occurrences="3">
<PossiblyUndefinedArrayOffset occurrences="8">
<code>$mapping['originalClass']</code>
<code>$mapping['originalField']</code>
<code>$mapping['targetEntity']</code>
<code>$this-&gt;associationMappings[$assocName]['joinColumns']</code>
<code>$this-&gt;associationMappings[$fieldName]['joinColumns']</code>
<code>$this-&gt;associationMappings[$fieldName]['joinColumns']</code>
<code>$this-&gt;associationMappings[$idProperty]['joinColumns']</code>
<code>$this-&gt;associationMappings[$idProperty]['joinColumns']</code>
</PossiblyUndefinedArrayOffset>
<PropertyNotSetInConstructor occurrences="5">
<code>$idGenerator</code>
@@ -648,7 +671,9 @@
<code>$table</code>
<code>$tableGeneratorDefinition</code>
</PropertyNotSetInConstructor>
<PropertyTypeCoercion occurrences="10">
<PropertyTypeCoercion occurrences="12">
<code>$this-&gt;associationMappings</code>
<code>$this-&gt;associationMappings</code>
<code>$this-&gt;entityListeners</code>
<code>$this-&gt;fieldMappings</code>
<code>$this-&gt;fullyQualifiedClassName($repositoryClassName)</code>
@@ -692,9 +717,6 @@
</PropertyTypeCoercion>
</file>
<file src="lib/Doctrine/ORM/Mapping/DefaultNamingStrategy.php">
<MissingParamType occurrences="1">
<code>$className</code>
</MissingParamType>
<PossiblyFalseOperand occurrences="1">
<code>strrpos($className, '\\')</code>
</PossiblyFalseOperand>
@@ -704,9 +726,9 @@
<code>canEmulateSchemas</code>
<code>canEmulateSchemas</code>
</DeprecatedMethod>
<MissingClosureParamType occurrences="1">
<code>$joinColumn</code>
</MissingClosureParamType>
<PossiblyUndefinedArrayOffset occurrences="1">
<code>$class-&gt;associationMappings[$fieldName]['joinColumns']</code>
</PossiblyUndefinedArrayOffset>
</file>
<file src="lib/Doctrine/ORM/Mapping/DiscriminatorColumn.php">
<PossiblyNullPropertyAssignmentValue occurrences="1">
@@ -777,6 +799,9 @@
</RedundantConditionGivenDocblockType>
</file>
<file src="lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php">
<DocblockTypeContradiction occurrences="1">
<code>$metadata instanceof ClassMetadata</code>
</DocblockTypeContradiction>
<LessSpecificReturnStatement occurrences="2">
<code>$this-&gt;namespace . $this-&gt;classNamesForTables[$tableName]</code>
<code>$this-&gt;namespace . $this-&gt;inflector-&gt;classify(strtolower($tableName))</code>
@@ -787,12 +812,7 @@
<MoreSpecificReturnType occurrences="1">
<code>class-string</code>
</MoreSpecificReturnType>
<PossiblyNullArgument occurrences="2">
<code>$this-&gt;tables[$tableName]</code>
<code>$this-&gt;tables[$tableName]</code>
</PossiblyNullArgument>
<PossiblyNullArrayAccess occurrences="3">
<code>$this-&gt;tables[$tableName]</code>
<PossiblyNullArrayAccess occurrences="2">
<code>$this-&gt;tables[$tableName]</code>
<code>$this-&gt;tables[$tableName]</code>
</PossiblyNullArrayAccess>
@@ -1043,9 +1063,6 @@
</MissingConstructor>
</file>
<file src="lib/Doctrine/ORM/Mapping/UnderscoreNamingStrategy.php">
<MissingParamType occurrences="1">
<code>$className</code>
</MissingParamType>
<PossiblyFalseOperand occurrences="1">
<code>strrpos($className, '\\')</code>
</PossiblyFalseOperand>
@@ -1223,6 +1240,9 @@
<code>getFieldForColumn</code>
<code>getFieldForColumn</code>
</PossiblyNullReference>
<PossiblyUndefinedArrayOffset occurrences="1">
<code>$mapping['joinTable']</code>
</PossiblyUndefinedArrayOffset>
</file>
<file src="lib/Doctrine/ORM/Persisters/Collection/OneToManyPersister.php">
<ImplementedReturnTypeMismatch occurrences="1">
@@ -1270,6 +1290,9 @@
<PossiblyNullArrayOffset occurrences="1">
<code>$targetClass-&gt;associationMappings</code>
</PossiblyNullArrayOffset>
<PossiblyUndefinedArrayOffset occurrences="1">
<code>$targetClass-&gt;associationMappings[$mapping['mappedBy']]['joinColumns']</code>
</PossiblyUndefinedArrayOffset>
</file>
<file src="lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php">
<DocblockTypeContradiction occurrences="1">
@@ -1305,13 +1328,18 @@
<code>$targetEntity</code>
<code>$targetEntity</code>
</NullableReturnStatement>
<PossiblyNullArgument occurrences="2">
<PossiblyNullArgument occurrences="3">
<code>$assoc['mappedBy']</code>
<code>$association</code>
<code>$type</code>
</PossiblyNullArgument>
<PossiblyNullArrayAccess occurrences="1">
<code>$assoc['isOwningSide']</code>
</PossiblyNullArrayAccess>
<PossiblyNullArrayOffset occurrences="2">
<code>$class-&gt;associationMappings</code>
<code>$class-&gt;associationMappings</code>
</PossiblyNullArrayOffset>
<PossiblyNullReference occurrences="7">
<code>getValue</code>
<code>getValue</code>
@@ -1321,6 +1349,21 @@
<code>getValue</code>
<code>setValue</code>
</PossiblyNullReference>
<PossiblyUndefinedArrayOffset occurrences="15">
<code>$assoc['joinColumns']</code>
<code>$assoc['joinColumns']</code>
<code>$assoc['relationToTargetKeyColumns']</code>
<code>$assoc['sourceToTargetKeyColumns']</code>
<code>$association['joinColumns']</code>
<code>$association['joinColumns']</code>
<code>$association['joinColumns']</code>
<code>$association['joinTable']</code>
<code>$association['joinTable']</code>
<code>$association['joinTable']</code>
<code>$association['joinTable']</code>
<code>$this-&gt;class-&gt;associationMappings[$fieldName]['joinColumns']</code>
<code>$this-&gt;class-&gt;associationMappings[$idField]['joinColumns']</code>
</PossiblyUndefinedArrayOffset>
<PropertyTypeCoercion occurrences="1">
<code>$this-&gt;currentPersisterContext-&gt;sqlTableAliases</code>
</PropertyTypeCoercion>
@@ -1348,8 +1391,15 @@
<MoreSpecificReturnType occurrences="1">
<code>executeInserts</code>
</MoreSpecificReturnType>
<PossiblyUndefinedArrayOffset occurrences="3">
<code>$mapping['joinColumns']</code>
<code>$mapping['joinColumns']</code>
</PossiblyUndefinedArrayOffset>
</file>
<file src="lib/Doctrine/ORM/Persisters/Entity/SingleTablePersister.php">
<PossiblyUndefinedArrayOffset occurrences="1">
<code>$assoc['joinColumns']</code>
</PossiblyUndefinedArrayOffset>
<PossiblyUndefinedVariable occurrences="1">
<code>$columnList</code>
</PossiblyUndefinedVariable>
@@ -1599,6 +1649,9 @@
<PossiblyNullArrayAccess occurrences="1">
<code>$parser-&gt;getLexer()-&gt;token['value']</code>
</PossiblyNullArrayAccess>
<PossiblyUndefinedArrayOffset occurrences="1">
<code>$assoc['joinColumns']</code>
</PossiblyUndefinedArrayOffset>
<PropertyNotSetInConstructor occurrences="1">
<code>$pathExpression</code>
</PropertyNotSetInConstructor>
@@ -1652,6 +1705,13 @@
</PropertyNotSetInConstructor>
</file>
<file src="lib/Doctrine/ORM/Query/AST/Functions/SizeFunction.php">
<PossiblyNullArrayOffset occurrences="2">
<code>$targetClass-&gt;associationMappings</code>
<code>$targetClass-&gt;associationMappings</code>
</PossiblyNullArrayOffset>
<PossiblyUndefinedArrayOffset occurrences="2">
<code>$owningAssoc['joinTable']</code>
</PossiblyUndefinedArrayOffset>
<PropertyNotSetInConstructor occurrences="1">
<code>$collectionPathExpression</code>
</PropertyNotSetInConstructor>
@@ -2249,11 +2309,6 @@
<RedundantConditionGivenDocblockType occurrences="1">
<code>$AST instanceof AST\SelectStatement</code>
</RedundantConditionGivenDocblockType>
<UnsafeInstantiation occurrences="3">
<code>new $funcClass($funcNameLower)</code>
<code>new $funcClass($funcNameLower)</code>
<code>new $funcClass($funcNameLower)</code>
</UnsafeInstantiation>
</file>
<file src="lib/Doctrine/ORM/Query/ParserResult.php">
<PropertyNotSetInConstructor occurrences="1">
@@ -2269,12 +2324,71 @@
<ArgumentTypeCoercion occurrences="1">
<code>$class</code>
</ArgumentTypeCoercion>
<DeprecatedMethod occurrences="4">
<code>addNamedNativeQueryEntityResultMapping</code>
<code>addNamedNativeQueryEntityResultMapping</code>
<code>addNamedNativeQueryResultClassMapping</code>
<code>addNamedNativeQueryResultSetMapping</code>
</DeprecatedMethod>
<PossiblyUndefinedArrayOffset occurrences="3">
<code>$associationMapping['joinColumns']</code>
<code>$associationMapping['joinColumns']</code>
<code>$associationMapping['joinColumns']</code>
</PossiblyUndefinedArrayOffset>
</file>
<file src="lib/Doctrine/ORM/Query/SqlWalker.php">
<DocblockTypeContradiction occurrences="2">
<code>''</code>
<code>is_string($expression)</code>
</DocblockTypeContradiction>
<ImplementedReturnTypeMismatch occurrences="46">
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
<code>string</code>
</ImplementedReturnTypeMismatch>
<ImplicitToStringCast occurrences="1">
<code>$expr</code>
</ImplicitToStringCast>
@@ -2285,7 +2399,7 @@
<code>$selectedClass['class']-&gt;name</code>
</InvalidArgument>
<InvalidNullableReturnType occurrences="1">
<code>walkConditionalPrimary</code>
<code>string</code>
</InvalidNullableReturnType>
<InvalidScalarArgument occurrences="3">
<code>$this-&gt;queryComponents[$expr]['token']['value']</code>
@@ -2309,213 +2423,45 @@
<code>$identificationVariableDecl-&gt;rangeVariableDeclaration</code>
<code>$subselect-&gt;whereClause</code>
</PossiblyNullArgument>
<PossiblyNullArrayOffset occurrences="2">
<PossiblyNullArrayOffset occurrences="4">
<code>$targetClass-&gt;associationMappings</code>
<code>$targetClass-&gt;associationMappings</code>
<code>$this-&gt;scalarResultAliasMap</code>
<code>$this-&gt;scalarResultAliasMap</code>
</PossiblyNullArrayOffset>
<PossiblyNullReference occurrences="1">
<code>dispatch</code>
</PossiblyNullReference>
<PossiblyUndefinedArrayOffset occurrences="8">
<code>$assoc['joinColumns']</code>
<code>$assoc['joinColumns']</code>
<code>$assoc['sourceToTargetKeyColumns']</code>
<code>$association['sourceToTargetKeyColumns']</code>
<code>$owningAssoc['joinTable']</code>
</PossiblyUndefinedArrayOffset>
<RedundantConditionGivenDocblockType occurrences="2">
<code>$whereClause !== null</code>
<code>($factor-&gt;not ? 'NOT ' : '') . $this-&gt;walkConditionalPrimary($factor-&gt;conditionalPrimary)</code>
</RedundantConditionGivenDocblockType>
</file>
<file src="lib/Doctrine/ORM/Query/TreeWalkerAdapter.php">
<ImplementedReturnTypeMismatch occurrences="47">
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
</ImplementedReturnTypeMismatch>
<MissingParamType occurrences="43">
<code>$AST</code>
<code>$aggExpression</code>
<code>$arithmeticExpr</code>
<code>$betweenExpr</code>
<code>$collMemberExpr</code>
<code>$compExpr</code>
<code>$condExpr</code>
<code>$condTerm</code>
<code>$emptyCollCompExpr</code>
<code>$existsExpr</code>
<code>$factor</code>
<code>$factor</code>
<code>$fromClause</code>
<code>$function</code>
<code>$groupByClause</code>
<code>$groupByItem</code>
<code>$havingClause</code>
<code>$inExpr</code>
<code>$inputParam</code>
<code>$instanceOfExpr</code>
<code>$join</code>
<code>$likeExpr</code>
<code>$literal</code>
<code>$nullCompExpr</code>
<code>$orderByClause</code>
<code>$orderByItem</code>
<code>$pathExpr</code>
<code>$primary</code>
<code>$qExpr</code>
<code>$resultVariable</code>
<code>$selectClause</code>
<code>$selectExpression</code>
<code>$simpleArithmeticExpr</code>
<code>$simpleSelectClause</code>
<code>$simpleSelectExpression</code>
<code>$stateFieldPathExpression</code>
<code>$stringPrimary</code>
<code>$subselect</code>
<code>$subselectFromClause</code>
<code>$term</code>
<code>$updateClause</code>
<code>$updateItem</code>
<code>$whereClause</code>
</MissingParamType>
<MissingReturnType occurrences="1">
<code>_getQueryComponents</code>
</MissingReturnType>
<InvalidNullableReturnType occurrences="1">
<code>getExecutor</code>
</InvalidNullableReturnType>
<NullableReturnStatement occurrences="1">
<code>null</code>
</NullableReturnStatement>
</file>
<file src="lib/Doctrine/ORM/Query/TreeWalkerChain.php">
<ImplementedReturnTypeMismatch occurrences="47">
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
<code>void</code>
</ImplementedReturnTypeMismatch>
<MissingParamType occurrences="44">
<code>$AST</code>
<code>$aggExpression</code>
<code>$arithmeticExpr</code>
<code>$betweenExpr</code>
<code>$collMemberExpr</code>
<code>$compExpr</code>
<code>$condExpr</code>
<code>$condPrimary</code>
<code>$condTerm</code>
<InvalidNullableReturnType occurrences="1">
<code>getExecutor</code>
</InvalidNullableReturnType>
<MissingParamType occurrences="1">
<code>$dqlAlias</code>
<code>$emptyCollCompExpr</code>
<code>$existsExpr</code>
<code>$factor</code>
<code>$factor</code>
<code>$fromClause</code>
<code>$function</code>
<code>$groupByClause</code>
<code>$groupByItem</code>
<code>$havingClause</code>
<code>$inExpr</code>
<code>$inputParam</code>
<code>$instanceOfExpr</code>
<code>$join</code>
<code>$likeExpr</code>
<code>$literal</code>
<code>$nullCompExpr</code>
<code>$orderByClause</code>
<code>$orderByItem</code>
<code>$pathExpr</code>
<code>$qExpr</code>
<code>$resultVariable</code>
<code>$selectClause</code>
<code>$selectExpression</code>
<code>$simpleArithmeticExpr</code>
<code>$simpleSelectClause</code>
<code>$simpleSelectExpression</code>
<code>$stateFieldPathExpression</code>
<code>$stringPrimary</code>
<code>$subselect</code>
<code>$subselectFromClause</code>
<code>$term</code>
<code>$updateClause</code>
<code>$updateItem</code>
<code>$whereClause</code>
</MissingParamType>
<NullableReturnStatement occurrences="1">
<code>null</code>
</NullableReturnStatement>
<ParamNameMismatch occurrences="1">
<code>$condPrimary</code>
</ParamNameMismatch>
@@ -2628,7 +2574,7 @@
<ArgumentTypeCoercion occurrences="1">
<code>$metadata</code>
</ArgumentTypeCoercion>
<DeprecatedClass occurrences="10">
<DeprecatedClass occurrences="11">
<code>ClassMetadataExporter</code>
<code>ClassMetadataExporter</code>
<code>ClassMetadataExporter|null</code>
@@ -2636,6 +2582,7 @@
<code>EntityGenerator</code>
<code>EntityGenerator|null</code>
<code>new ClassMetadataExporter()</code>
<code>new ConvertDoctrine1Schema($fromPaths)</code>
<code>new EntityGenerator()</code>
<code>private $entityGenerator = null;</code>
<code>private $metadataExporter = null;</code>
@@ -2648,9 +2595,10 @@
<ArgumentTypeCoercion occurrences="1">
<code>$metadata</code>
</ArgumentTypeCoercion>
<DeprecatedClass occurrences="3">
<DeprecatedClass occurrences="4">
<code>AbstractExporter</code>
<code>new ClassMetadataExporter()</code>
<code>new DisconnectedClassMetadataFactory()</code>
<code>new EntityGenerator()</code>
</DeprecatedClass>
<MissingReturnType occurrences="1">
@@ -2669,7 +2617,8 @@
<ArgumentTypeCoercion occurrences="1">
<code>$metadatas</code>
</ArgumentTypeCoercion>
<DeprecatedClass occurrences="1">
<DeprecatedClass occurrences="2">
<code>new DisconnectedClassMetadataFactory()</code>
<code>new EntityGenerator()</code>
</DeprecatedClass>
<MissingReturnType occurrences="1">
@@ -2870,6 +2819,10 @@
<NonInvariantDocblockPropertyType occurrences="1">
<code>$_extension</code>
</NonInvariantDocblockPropertyType>
<PossiblyUndefinedArrayOffset occurrences="2">
<code>$associationMapping['joinColumns']</code>
<code>$associationMapping['orphanRemoval']</code>
</PossiblyUndefinedArrayOffset>
<RedundantConditionGivenDocblockType occurrences="4">
<code>$metadata-&gt;inheritanceType</code>
<code>$metadata-&gt;inheritanceType</code>
@@ -2925,6 +2878,11 @@
<NonInvariantDocblockPropertyType occurrences="1">
<code>$_extension</code>
</NonInvariantDocblockPropertyType>
<PossiblyUndefinedArrayOffset occurrences="3">
<code>$associationMapping['joinColumns']</code>
<code>$associationMapping['orphanRemoval']</code>
<code>$associationMapping['orphanRemoval']</code>
</PossiblyUndefinedArrayOffset>
<RedundantConditionGivenDocblockType occurrences="2">
<code>$metadata-&gt;table</code>
<code>isset($metadata-&gt;lifecycleCallbacks)</code>
@@ -2934,11 +2892,9 @@
<MoreSpecificImplementedParamType occurrences="1">
<code>$query</code>
</MoreSpecificImplementedParamType>
</file>
<file src="lib/Doctrine/ORM/Tools/Pagination/CountWalker.php">
<ImplementedReturnTypeMismatch occurrences="1">
<code>void</code>
</ImplementedReturnTypeMismatch>
<PossiblyUndefinedArrayOffset occurrences="1">
<code>$rootClass-&gt;associationMappings[$property]['joinColumns']</code>
</PossiblyUndefinedArrayOffset>
</file>
<file src="lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php">
<MoreSpecificImplementedParamType occurrences="1">
@@ -2958,11 +2914,9 @@
<PossiblyNullPropertyFetch occurrences="1">
<code>$orderByClause-&gt;orderByItems</code>
</PossiblyNullPropertyFetch>
</file>
<file src="lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryWalker.php">
<ImplementedReturnTypeMismatch occurrences="1">
<code>void</code>
</ImplementedReturnTypeMismatch>
<PossiblyUndefinedArrayOffset occurrences="1">
<code>$rootClass-&gt;associationMappings[$property]['joinColumns']</code>
</PossiblyUndefinedArrayOffset>
</file>
<file src="lib/Doctrine/ORM/Tools/Pagination/Paginator.php">
<ArgumentTypeCoercion occurrences="1">
@@ -2988,9 +2942,6 @@
<code>$AST-&gt;whereClause-&gt;conditionalExpression instanceof ConditionalFactor</code>
<code>$AST-&gt;whereClause-&gt;conditionalExpression instanceof ConditionalPrimary</code>
</DocblockTypeContradiction>
<ImplementedReturnTypeMismatch occurrences="1">
<code>void</code>
</ImplementedReturnTypeMismatch>
<MissingClosureReturnType occurrences="1">
<code>static function ($id) use ($connection, $type) {</code>
</MissingClosureReturnType>
@@ -3012,9 +2963,14 @@
<PossiblyNullReference occurrences="1">
<code>getColumns</code>
</PossiblyNullReference>
<PossiblyUndefinedArrayOffset occurrences="2">
<PossiblyUndefinedArrayOffset occurrences="7">
<code>$assoc['joinColumns']</code>
<code>$class-&gt;getAssociationMapping($fieldName)['joinColumns']</code>
<code>$fieldMapping['precision']</code>
<code>$fieldMapping['scale']</code>
<code>$idMapping['joinColumns']</code>
<code>$mapping['joinColumns']</code>
<code>$mapping['joinTable']</code>
</PossiblyUndefinedArrayOffset>
<RedundantCondition occurrences="1">
<code>is_numeric($indexName)</code>
@@ -3027,6 +2983,21 @@
<code>$indexName</code>
</TypeDoesNotContainType>
</file>
<file src="lib/Doctrine/ORM/Tools/SchemaValidator.php">
<PossiblyUndefinedArrayOffset occurrences="4">
<code>$assoc['joinColumns']</code>
<code>$assoc['joinTable']</code>
<code>$assoc['relationToSourceKeyColumns']</code>
<code>$assoc['relationToTargetKeyColumns']</code>
</PossiblyUndefinedArrayOffset>
<RedundantConditionGivenDocblockType occurrences="2">
<code>$assoc['orderBy'] !== null</code>
<code>isset($assoc['orderBy']) &amp;&amp; $assoc['orderBy'] !== null</code>
</RedundantConditionGivenDocblockType>
<TypeDoesNotContainType occurrences="1">
<code>! class_exists($assoc['targetEntity'])</code>
</TypeDoesNotContainType>
</file>
<file src="lib/Doctrine/ORM/Tools/Setup.php">
<DeprecatedClass occurrences="2">
<code>new ClassLoader('Doctrine', $directory)</code>
@@ -3044,10 +3015,8 @@
<code>$collectionToUpdate</code>
<code>$commitOrder[$i]</code>
</ArgumentTypeCoercion>
<DocblockTypeContradiction occurrences="4">
<DocblockTypeContradiction occurrences="2">
<code>! is_object($object)</code>
<code>$association['type'] === ClassMetadata::ONE_TO_MANY</code>
<code>$association['type'] === ClassMetadata::ONE_TO_MANY</code>
<code>is_object($object)</code>
</DocblockTypeContradiction>
<InvalidArgument occurrences="1">
@@ -3056,20 +3025,10 @@
<InvalidNullableReturnType occurrences="1">
<code>object</code>
</InvalidNullableReturnType>
<InvalidOperand occurrences="1">
<code>$association['type']</code>
</InvalidOperand>
<InvalidPropertyAssignmentValue occurrences="2">
<code>$this-&gt;entityChangeSets</code>
<code>$this-&gt;entityChangeSets</code>
</InvalidPropertyAssignmentValue>
<MissingClosureReturnType occurrences="5">
<code>static function ($assoc) {</code>
<code>static function ($assoc) {</code>
<code>static function ($assoc) {</code>
<code>static function ($assoc) {</code>
<code>static function ($assoc) {</code>
</MissingClosureReturnType>
<MissingParamType occurrences="3">
<code>$managedCopy</code>
<code>$prevManagedCopy</code>
@@ -3081,7 +3040,9 @@
<PossiblyInvalidArrayOffset occurrences="1">
<code>$this-&gt;identityMap[$rootClassName]</code>
</PossiblyInvalidArrayOffset>
<PossiblyNullArgument occurrences="10">
<PossiblyNullArgument occurrences="12">
<code>$assoc</code>
<code>$assoc</code>
<code>$assoc</code>
<code>$assoc</code>
<code>$assoc['targetEntity']</code>
@@ -3097,6 +3058,10 @@
<code>$assoc['targetEntity']</code>
<code>$assoc['type']</code>
</PossiblyNullArrayAccess>
<PossiblyNullArrayOffset occurrences="2">
<code>$class-&gt;reflFields</code>
<code>$targetClass-&gt;reflFields</code>
</PossiblyNullArrayOffset>
<PossiblyNullReference occurrences="33">
<code>buildCachedCollectionPersister</code>
<code>buildCachedEntityPersister</code>
@@ -3132,6 +3097,10 @@
<code>setValue</code>
<code>setValue</code>
</PossiblyNullReference>
<PossiblyUndefinedArrayOffset occurrences="3">
<code>$assoc['joinColumns']</code>
<code>$assoc['orphanRemoval']</code>
</PossiblyUndefinedArrayOffset>
<PossiblyUndefinedMethod occurrences="3">
<code>unwrap</code>
<code>unwrap</code>
@@ -3155,4 +3124,17 @@
<code>$rootClassMetadata-&gt;subClasses</code>
</NoInterfaceProperties>
</file>
<file src="lib/Doctrine/ORM/Utility/IdentifierFlattener.php">
<PossiblyUndefinedArrayOffset occurrences="1">
<code>$class-&gt;associationMappings[$field]['joinColumns']</code>
</PossiblyUndefinedArrayOffset>
</file>
<file src="lib/Doctrine/ORM/Utility/PersisterHelper.php">
<PossiblyNullArgument occurrences="1">
<code>$assoc['mappedBy']</code>
</PossiblyNullArgument>
<PossiblyUndefinedArrayOffset occurrences="1">
<code>$assoc['joinTable']</code>
</PossiblyUndefinedArrayOffset>
</file>
</files>
+13 -9
View File
@@ -26,11 +26,10 @@
<referencedClass name="Doctrine\ORM\Cache\Exception\InvalidResultCacheDriver"/>
<!-- We wire the command as long as DBAL ships it -->
<referencedClass name="Doctrine\DBAL\Tools\Console\Command\ReservedWordsCommand" />
<!-- Remove on 2.13.x -->
<referencedClass name="Doctrine\DBAL\Schema\Visitor\DropSchemaSqlCollector"/>
<referencedClass name="Doctrine\DBAL\Schema\Visitor\RemoveNamespacedAssets"/>
<!-- Remove on 3.0.x -->
<referencedClass name="Doctrine\Common\Persistence\PersistentObject"/>
<referencedClass name="Doctrine\DBAL\Schema\Visitor\RemoveNamespacedAssets"/>
<referencedClass name="Doctrine\ORM\Event\LifecycleEventArgs"/>
<referencedClass name="Doctrine\ORM\Exception\UnknownEntityNamespace"/>
<referencedClass name="Doctrine\ORM\Mapping\Driver\YamlDriver"/>
<referencedClass name="Doctrine\ORM\Tools\Console\Command\ConvertDoctrine1SchemaCommand"/>
@@ -47,9 +46,8 @@
<file name="lib/Doctrine/ORM/Configuration.php"/>
<file name="lib/Doctrine/ORM/Query/Lexer.php"/>
<file name="lib/Doctrine/ORM/Query/Parser.php"/>
<file name="lib/Doctrine/ORM/QueryBuilder.php"/>
<file name="lib/Doctrine/ORM/Tools/EntityGenerator.php"/>
<!-- Remove on 2.13.x. -->
<file name="lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php" />
</errorLevel>
</DeprecatedConstant>
<DeprecatedInterface>
@@ -72,15 +70,15 @@
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::getGuidExpression"/>
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::supportsForeignKeyConstraints"/>
<referencedMethod name="Doctrine\DBAL\Types\Type::getName"/>
<!-- Remove on 2.13.x -->
<referencedMethod name="Doctrine\DBAL\Schema\AbstractSchemaManager::getDatabasePlatform"/>
<referencedMethod name="Doctrine\DBAL\Schema\Schema::visit"/>
<!-- Remove on 3.0.x -->
<referencedMethod name="Doctrine\DBAL\Schema\Schema::visit"/>
<referencedMethod name="Doctrine\ORM\Internal\Hydration\AbstractHydrator::hydrateRow"/>
<referencedMethod name="Doctrine\ORM\Configuration::ensureProductionSettings"/>
<referencedMethod name="Doctrine\ORM\Configuration::newDefaultAnnotationDriver"/>
<referencedMethod name="Doctrine\ORM\Id\AbstractIdGenerator::generate"/>
<referencedMethod name="Doctrine\ORM\ORMInvalidArgumentException::invalidEntityName"/>
<referencedMethod name="Doctrine\ORM\Query\TreeWalkerAdapter::_getQueryComponents"/>
<file name="lib/Doctrine/ORM/Query/TreeWalkerChain.php"/>
</errorLevel>
</DeprecatedMethod>
<DeprecatedProperty>
@@ -174,7 +172,7 @@
<!-- DBAL 3.2 forward compatibility -->
<referencedClass name="Doctrine\DBAL\Platforms\PostgreSQLPlatform"/>
<referencedClass name="Doctrine\DBAL\Platforms\SQLServerPlatform"/>
<!-- Persistence 2 compatibility -->
<referencedClass name="Doctrine\Persistence\ObjectManagerAware"/>
</errorLevel>
@@ -191,5 +189,11 @@
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::getGuidExpression"/>
</errorLevel>
</UndefinedMethod>
<ArgumentTypeCoercion>
<errorLevel type="suppress">
<!-- See https://github.com/JetBrains/phpstorm-stubs/pull/1383 -->
<file name="lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php"/>
</errorLevel>
</ArgumentTypeCoercion>
</issueHandlers>
</psalm>
@@ -71,6 +71,6 @@ final class EntityManagerFactory
}
};
return EntityManager::create($connection, $config);
return EntityManager::create($connection, $config, $connection->getEventManager());
}
}
@@ -7,6 +7,8 @@ namespace Doctrine\Tests\DbalTypes;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\Type;
use function method_exists;
class CustomIdObjectType extends Type
{
public const NAME = 'CustomIdObject';
@@ -32,6 +34,10 @@ class CustomIdObjectType extends Type
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
if (method_exists($platform, 'getStringTypeDeclarationSQL')) {
return $platform->getStringTypeDeclarationSQL($fieldDeclaration);
}
return $platform->getVarcharTypeDeclarationSQL($fieldDeclaration);
}
@@ -7,6 +7,7 @@ namespace Doctrine\Tests\DbalTypes;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\Type;
use function method_exists;
use function str_rot13;
/**
@@ -58,6 +59,10 @@ class Rot13Type extends Type
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
if (method_exists($platform, 'getStringTypeDeclarationSQL')) {
return $platform->getStringTypeDeclarationSQL($fieldDeclaration);
}
return $platform->getVarcharTypeDeclarationSQL($fieldDeclaration);
}
@@ -0,0 +1,59 @@
<?php
declare(strict_types=1);
namespace Doctrine\Tests\Mocks;
use Doctrine\ORM\Query\AST\IdentificationVariableDeclaration;
use Doctrine\ORM\Query\AST\Join;
use Doctrine\ORM\Query\AST\JoinAssociationDeclaration;
use Doctrine\ORM\Query\AST\JoinAssociationPathExpression;
use Doctrine\ORM\Query\AST\SelectExpression;
use Doctrine\ORM\Query\AST\SelectStatement;
use Doctrine\ORM\Query\TreeWalkerAdapter;
use Doctrine\Tests\Models\CMS\CmsAddress;
use Doctrine\Tests\Models\CMS\CmsUser;
class CustomTreeWalkerJoin extends TreeWalkerAdapter
{
public function walkSelectStatement(SelectStatement $selectStatement): void
{
foreach ($selectStatement->fromClause->identificationVariableDeclarations as $identificationVariableDeclaration) {
$rangeVariableDecl = $identificationVariableDeclaration->rangeVariableDeclaration;
if ($rangeVariableDecl->abstractSchemaName !== CmsUser::class) {
continue;
}
$this->modifySelectStatement($selectStatement, $identificationVariableDeclaration);
}
}
private function modifySelectStatement(SelectStatement $selectStatement, IdentificationVariableDeclaration $identificationVariableDecl): void
{
$rangeVariableDecl = $identificationVariableDecl->rangeVariableDeclaration;
$joinAssocPathExpression = new JoinAssociationPathExpression($rangeVariableDecl->aliasIdentificationVariable, 'address');
$joinAssocDeclaration = new JoinAssociationDeclaration($joinAssocPathExpression, $rangeVariableDecl->aliasIdentificationVariable . 'a', null);
$join = new Join(Join::JOIN_TYPE_LEFT, $joinAssocDeclaration);
$selectExpression = new SelectExpression($rangeVariableDecl->aliasIdentificationVariable . 'a', null, false);
$identificationVariableDecl->joins[] = $join;
$selectStatement->selectClause->selectExpressions[] = $selectExpression;
$entityManager = $this->_getQuery()->getEntityManager();
$userMetadata = $entityManager->getClassMetadata(CmsUser::class);
$addressMetadata = $entityManager->getClassMetadata(CmsAddress::class);
$this->setQueryComponent(
$rangeVariableDecl->aliasIdentificationVariable . 'a',
[
'metadata' => $addressMetadata,
'parent' => $rangeVariableDecl->aliasIdentificationVariable,
'relation' => $userMetadata->getAssociationMapping('address'),
'map' => null,
'nestingLevel' => 0,
'token' => null,
]
);
}
}
@@ -64,10 +64,6 @@ class EntityManagerMock extends EntityManager
$config->setMetadataDriverImpl(ORMSetup::createDefaultAnnotationDriver());
}
if ($eventManager === null) {
$eventManager = new EventManager();
}
return new EntityManagerMock($conn, $config, $eventManager);
return new EntityManagerMock($conn, $config);
}
}
@@ -1,21 +0,0 @@
<?php
declare(strict_types=1);
namespace Doctrine\Tests\Mocks;
use Doctrine\ORM\Query\TreeWalkerAdapter;
/**
* Mock class for TreeWalker.
*/
class MockTreeWalker extends TreeWalkerAdapter
{
/**
* {@inheritdoc}
*/
public function getExecutor($AST)
{
return null;
}
}
@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace Doctrine\Tests\Mocks;
use Doctrine\DBAL\Connection;
use Doctrine\ORM\Query\AST;
use Doctrine\ORM\Query\Exec\AbstractSqlExecutor;
use Doctrine\ORM\Query\SqlWalker;
/**
* SqlWalker implementation that does not produce SQL.
*/
class NullSqlWalker extends SqlWalker
{
public function walkSelectStatement(AST\SelectStatement $AST): string
{
return '';
}
public function walkUpdateStatement(AST\UpdateStatement $AST): string
{
return '';
}
public function walkDeleteStatement(AST\DeleteStatement $AST): string
{
return '';
}
public function getExecutor($AST): AbstractSqlExecutor
{
return new class extends AbstractSqlExecutor {
public function execute(Connection $conn, array $params, array $types): int
{
return 0;
}
};
}
}
@@ -34,7 +34,7 @@ class CmsComment
/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
*/
public $text;
+1 -1
View File
@@ -22,7 +22,7 @@ class Action
/**
* @var string
* @Id
* @Column(type="string")
* @Column(type="string", length=255)
* @GeneratedValue(strategy="NONE")
*/
public $name;
+1 -1
View File
@@ -31,7 +31,7 @@ class Token
/**
* @var string
* @Id
* @Column(type="string")
* @Column(type="string", length=255)
*/
public $token;
@@ -16,7 +16,7 @@ class CompanyAuction extends CompanyEvent
{
/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
*/
private $data;
@@ -33,7 +33,7 @@ use Doctrine\ORM\Mapping\Table;
* @Entity
* @Table(name="company_contracts")
* @InheritanceType("SINGLE_TABLE")
* @DiscriminatorColumn(name="discr", type="string")
* @DiscriminatorColumn(name="discr", type="string", length=255)
* @EntityListeners({"CompanyContractListener"})
* @DiscriminatorMap({
* "fix" = "CompanyFixContract",
@@ -19,7 +19,7 @@ use Doctrine\ORM\Mapping\Table;
* @Entity
* @Table(name="company_events")
* @InheritanceType("JOINED")
* @DiscriminatorColumn(name="event_type", type="string")
* @DiscriminatorColumn(name="event_type", type="string", length=255)
* @DiscriminatorMap({"auction"="CompanyAuction", "raffle"="CompanyRaffle"})
*/
abstract class CompanyEvent
@@ -4,9 +4,9 @@ declare(strict_types=1);
namespace Doctrine\Tests\Models\Company;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\PrePersist;
use Doctrine\Persistence\Event\LifecycleEventArgs;
use function func_get_args;
@@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping\Table;
* @Entity
* @Table(name="company_persons")
* @InheritanceType("JOINED")
* @DiscriminatorColumn(name="discr", type="string")
* @DiscriminatorColumn(name="discr", type="string", length=255)
* @DiscriminatorMap({
* "person" = "CompanyPerson",
* "manager" = "CompanyManager",
@@ -15,13 +15,13 @@ class JoinedChildClass extends JoinedRootClass
{
/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
*/
public $extension = 'ext';
/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
* @Id
*/
private $additionalId = 'additional';

Some files were not shown because too many files have changed in this diff Show More