Compare commits

...

161 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
Alexander M. Turek
78d08584f1 Fix build (#9964) 2022-08-07 17:31:32 +02:00
Adrien Foulon
f7e202f3ed fix: class normalisation test (#9966) 2022-08-07 17:07:36 +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
c8025dc4f8 Update branch info in README and .doctrine-project.json (#9943) 2022-07-31 14:53:31 +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
Alexander M. Turek
8bfe20073b Psalm 4.25.0, PHPStan 1.8.2 (#9941) 2022-07-28 19:35:26 +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
Vincent Langlet
9b37541b3b Use a more precise phpdoc for ClassMetadataInfo::versionField than mixed (#9937) 2022-07-27 23:23:43 +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
Alexander M. Turek
6c64bc6067 Simplify LanguageRecognitionTest (#9930) 2022-07-25 16:14:07 +02:00
Grégoire Paris
f5246bdedd Merge pull request #9927 from rdey/patch-1
GH9335: Fix for bug with objects as foreign keys
2022-07-24 15:21:28 +02:00
Louise Zetterlund
705dc6fbda test/added test for foreign keys with custom id object types 2022-07-22 18:41:35 +02:00
Alexander M. Turek
faedb90ffa Widen types for DiscriminatorMap (#9922)
* Allow integers as keys for DiscriminatorMap

* Widen types for DiscriminatorMap
2022-07-21 10:19:42 +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
99d9c46bde Add tests for SQL output feature (#9907)
It is not covered yet, and that makes contributions to these commands
hard.
2022-07-18 21:28:17 +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
Grégoire Paris
ab4844b82a Merge pull request #9892 from greg0ire/address-array-object-type-deprecation
Address array object type deprecation
2022-07-10 23:05:34 +02:00
Grégoire Paris
00989d6671 Remove SerializationModel from generic model set
It contains fields with deprecated types.
2022-07-10 12:23:05 +02:00
Grégoire Paris
7ed0db0621 Document what we test in test method name 2022-07-10 11:23:22 +02:00
Grégoire Paris
d6dcfbd6f7 Use ::class notation 2022-07-10 11:23:21 +02:00
Grégoire Paris
baf6a394a1 Test invalid mapping file with boolean model
SerializationModel has a field with type array, and another with type
object. Both types are deprecated.
2022-07-10 11:22:46 +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
Alexander M. Turek
291765e879 PHPStan 1.8.0 (#9887) 2022-07-08 13:53:03 +02:00
Grégoire Paris
f79ec43e70 Merge pull request #9880 from CarlSchwan/patch-1
Fix typo in AbstractQuery
2022-07-06 21:07:32 +02:00
Carl Schwan
306b5f9812 Fix typo in AbstractQuery 2022-07-06 14:06:42 +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
Grégoire Paris
83c1ad2f57 Merge pull request #9870 from popov-a-e/GH-9807
[GH-9807] Fix: initialize potentially empty collections at the hydration complete
2022-07-03 22:25:18 +02:00
Alex Popov
79447cbb18 ObjectHydrator: defer initialization of potentially empty collections
If ObjectHydrator faces an empty row to an uninitialized collection,
it initializes it, to prevent it from querying again (DDC-1526).
However, if that row is the first but not the only in the collection,
the next rows will be ignored, as the collection will be considered
"existing", and "existing" collections are only replaced if REFRESH hint
is present. To prevent it, we defer initialization to the end of the
hydration.

Fixes GH-9807
2022-07-03 13:25:34 +04: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
Grégoire Paris
3295ccfa25 Merge pull request #9874 from greg0ire/migrate-to-csfm
Migrate more usages of SchemaTool::createSchema()
2022-07-02 00:11:41 +02:00
Grégoire Paris
b1419ddc6c Migrate more usages of SchemaTool::createSchema()
When I introduced OrmFunctionalTestCase::createSchemaForModels(), I made
several wrong assumptions:
- the call is always wrapped in a try / catch;
- that try / catch is always typed with "Exception".

Because of that, I missed, many, many occurrences of
SchemaTool::createSchema().

I recently noticed that contributors kept using the
SchemaTool::createSchema() and figured not everything had been
migrated.

Migrating some of them did not result in something far better until I
also introduced similar methods for
SchemaTool::getUpdateSchemaSql() and SchemaTool::getSchemaFromMetadata().
2022-07-01 21:45:45 +02:00
Thomas Landauer
0ef08c5dfb preUpdate: Add restriction that changed field needs to be in computed changeset (#9871) 2022-06-28 23:44:23 +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
Alexander M. Turek
278bf194ca Psalm 4.24.0, PHPStan 1.7.15 (#9865) 2022-06-28 10:41:20 +02:00
Alexander M. Turek
b9f2488c6c PHP CodeSniffer 3.7.1, PHPStan 1.7.14 (#9858) 2022-06-19 14:48:36 +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
Alexander M. Turek
c05e1709e9 Run tests on PHP 8.2 (#9840) 2022-06-16 15:42:23 +02:00
Alexander M. Turek
6e31758c7b PHPStan 1.7.13 (#9844) 2022-06-15 11:11:24 +02:00
Alexander M. Turek
eff540a996 Flip conditional extension of legacy AnnotationDriver class (#9843) 2022-06-13 20:10:37 +02:00
Alexander M. Turek
33d74e2e48 PHP CodeSniffer 3.7 (#9842) 2022-06-13 19:19:15 +02:00
bartholdbos
09ff36cda0 Make Reflection available to ConvertMappingCommand (#9619) 2022-06-13 17:30:08 +02:00
Grégoire Paris
e30426cbc0 Merge pull request #9841 from derrabus/bugfix/dynamic-property
Add missing property declaration
2022-06-12 16:55:59 +02:00
Alexander M. Turek
e9135b86e0 Add missing property declaration 2022-06-12 14:25:39 +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
Grégoire Paris
3dc5581294 Merge pull request #9818 from greg0ire/fix-wrong-type-config
Document missing possible types
2022-06-09 07:23:43 +02:00
Grégoire Paris
7bf2c4c8d1 Merge pull request #9823 from greg0ire/fix-build 2022-06-08 14:39:31 +02:00
Grégoire Paris
c81776ad12 Backport fixes from upstream branch
Not all of 01fb82b497 was ported, only
what is necessary to fix the build.
2022-06-08 13:26:35 +02:00
Grégoire Paris
d9c6f86627 Document missing possible types 2022-06-04 18:16:35 +02:00
Alexander M. Turek
ddede4064c Merge 2.12.x into 2.13.x (#9811) 2022-06-03 13:22:41 +02:00
Alexander M. Turek
67d82cdf72 PHPStan 1.7.9 (#9812) 2022-06-03 13:11:19 +02:00
Alexander M. Turek
744f0b5983 Remove empty test file (#9805) 2022-06-03 07:53:13 +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
wiseguy1394
768e2f3816 Add primary key on temp table (#9770)
* add primary key on temp table;fixes doctrine/orm#9768

* use all ID Columns in primary key
2022-06-02 16:08:22 +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
21976471a3 Fix wrong types (#9802) 2022-06-01 22:42:51 +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
olegsuvorkov
aae8b43622 Update IdentifierFlattener.php
Fix for coding-standards / Coding Standards (8.1)
2022-05-27 15:35:23 +03:00
Alexander M. Turek
e66fbc434d MockTreeWalker should be an SqlWalker (#9790) 2022-05-27 00:15:30 +02:00
olegsuvorkov
3f4e9e397a Update IdentifierFlattener.php
Hello, I would like to make a small change.
The need arose when using \Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator in "symfony/doctrine-bridge" composite foreign keys
I'm sure these changes will not hurt performance
and allow other objects to be used as identifiers
2022-05-26 10:46:14 +03: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
Alexander M. Turek
48e4e333c7 PHPStan 1.7.0 (#9785) 2022-05-24 00:41:57 +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
1f63389065 Fix wrong types for AbstractQuery and child classes (#9774)
* Remove comment about BC

I do not think we actually want to force our users to build an array
collection when they want to use setParameters().

* Make phpdoc more accurate
2022-05-23 11:26:19 +02:00
Grégoire Paris
359dd4ecfb Merge pull request #9779 from greg0ire/fix-config-phpdoc 2022-05-23 11:18:58 +02:00
Grégoire Paris
a0697c9aff Document callable as possible
Custom string functions can either be a class string or a callable
returning the function.
2022-05-23 11:05:16 +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
8f7701279d Add use statement (#9769)
We are supposed to use the driver from doctrine/persistence, and not the
deprecated one from this package.
2022-05-19 13:16:51 +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
45e196eb57 Omit version number in README (#9749) 2022-05-10 09:09:20 +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
Grégoire Paris
eed20ff4dd Better phpdoc tests (#9746)
* Fix inaccurate and imprecise phpdoc

* Remove extra argument

The method signature does not specify it, and it's always set to null.
It looks like this test and its data provider were copy/pasted from the
previous one.

* Specify what concrete class is passed

This is important as the signature of the concrete classes don't
necessarily match the one of the interface. Here, an extra argument that
is only defined in the classes is used.
2022-05-10 00:32:30 +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
Alexander M. Turek
07ee555279 Exclude /ci from distribution packages (#9732) 2022-05-06 13:07:36 +02: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
484 changed files with 5084 additions and 3530 deletions

View File

@@ -12,21 +12,27 @@
"upcoming": true
},
{
"name": "2.12",
"branchName": "2.12.x",
"slug": "2.12",
"name": "2.13",
"branchName": "2.13.x",
"slug": "2.13",
"upcoming": true
},
{
"name": "2.11",
"branchName": "2.11.x",
"slug": "2.11",
"name": "2.12",
"branchName": "2.12.x",
"slug": "2.12",
"current": true,
"aliases": [
"current",
"stable"
]
},
{
"name": "2.11",
"branchName": "2.11.x",
"slug": "2.11",
"maintained": false
},
{
"name": "2.10",
"branchName": "2.10.x",

5
.gitattributes vendored
View File

@@ -1,7 +1,8 @@
/.github export-ignore
/ci export-ignore
/docs export-ignore
/tests export-ignore
/tools export-ignore
/docs export-ignore
/.github export-ignore
.doctrine-project.json export-ignore
.gitattributes export-ignore
.gitignore export-ignore

View File

@@ -31,6 +31,8 @@ jobs:
dbal-version: "2.13"
- php-version: "8.1"
dbal-version: "3@dev"
- php-version: "8.2"
dbal-version: "3@dev"
steps:
- name: "Checkout"
@@ -52,6 +54,8 @@ jobs:
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
composer-options: "--ignore-platform-req=php+"
- name: "Run PHPUnit"
run: "vendor/bin/phpunit -c ci/github/phpunit/sqlite.xml --coverage-clover=coverage-no-cache.xml"
@@ -88,6 +92,9 @@ jobs:
- php-version: "8.0"
dbal-version: "2.13"
postgres-version: "14"
- php-version: "8.2"
dbal-version: "3@dev"
postgres-version: "14"
services:
postgres:
@@ -120,6 +127,8 @@ jobs:
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
composer-options: "--ignore-platform-req=php+"
- name: "Run PHPUnit"
run: "vendor/bin/phpunit -c ci/github/phpunit/pdo_pgsql.xml --coverage-clover=coverage.xml"
@@ -152,6 +161,14 @@ jobs:
dbal-version: "2.13"
mariadb-version: "10.6"
extension: "pdo_mysql"
- php-version: "8.2"
dbal-version: "3@dev"
mariadb-version: "10.6"
extension: "pdo_mysql"
- php-version: "8.2"
dbal-version: "3@dev"
mariadb-version: "10.6"
extension: "mysqli"
services:
mariadb:
@@ -186,6 +203,8 @@ jobs:
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
composer-options: "--ignore-platform-req=php+"
- name: "Run PHPUnit"
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --coverage-clover=coverage.xml"
@@ -219,6 +238,14 @@ jobs:
dbal-version: "2.13"
mysql-version: "8.0"
extension: "pdo_mysql"
- php-version: "8.2"
dbal-version: "3@dev"
mysql-version: "8.0"
extension: "mysqli"
- php-version: "8.2"
dbal-version: "3@dev"
mysql-version: "8.0"
extension: "pdo_mysql"
services:
mysql:
@@ -252,6 +279,8 @@ jobs:
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
composer-options: "--ignore-platform-req=php+"
- name: "Run PHPUnit"
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --coverage-clover=coverage-no-cache.xml"

View File

@@ -1,11 +1,11 @@
| [3.0.x][3.0] | [2.12.x][2.12] | [2.11.x][2.11] |
| [3.0.x][3.0] | [2.13.x][2.13] | [2.12.x][2.12] |
|:----------------:|:----------------:|:----------:|
| [![Build status][3.0 image]][3.0] | [![Build status][2.12 image]][2.12] | [![Build status][2.11 image]][2.11] |
| [![Coverage Status][3.0 coverage image]][3.0 coverage]| [![Coverage Status][2.12 coverage image]][2.12 coverage] | [![Coverage Status][2.11 coverage image]][2.11 coverage] |
| [![Build status][3.0 image]][3.0] | [![Build status][2.13 image]][2.13] | [![Build status][2.12 image]][2.12] |
| [![Coverage Status][3.0 coverage image]][3.0 coverage]| [![Coverage Status][2.13 coverage image]][2.13 coverage] | [![Coverage Status][2.12 coverage image]][2.12 coverage] |
[<h1 align="center">🇺🇦 UKRAINE NEEDS YOUR HELP NOW!</h1>](https://www.doctrine-project.org/stop-war.html)
Doctrine 2 is an object-relational mapper (ORM) for PHP 7.1+ that provides transparent persistence
Doctrine ORM is an object-relational mapper for PHP 7.1+ that provides transparent persistence
for PHP objects. It sits on top of a powerful database abstraction layer (DBAL). One of its key features
is the option to write database queries in a proprietary object oriented SQL dialect called Doctrine Query Language (DQL),
inspired by Hibernate's HQL. This provides developers with a powerful alternative to SQL that maintains flexibility
@@ -22,11 +22,11 @@ without requiring unnecessary code duplication.
[3.0]: https://github.com/doctrine/orm/tree/3.0.x
[3.0 coverage image]: https://codecov.io/gh/doctrine/orm/branch/3.0.x/graph/badge.svg
[3.0 coverage]: https://codecov.io/gh/doctrine/orm/branch/3.0.x
[2.13 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.13.x
[2.13]: https://github.com/doctrine/orm/tree/2.13.x
[2.13 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.13.x/graph/badge.svg
[2.13 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.13.x
[2.12 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.12.x
[2.12]: https://github.com/doctrine/orm/tree/2.12.x
[2.12 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.12.x/graph/badge.svg
[2.12 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.12.x
[2.11 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.11.x
[2.11]: https://github.com/doctrine/orm/tree/2.11.x
[2.11 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.11.x/graph/badge.svg
[2.11 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.11.x

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.

View File

@@ -42,18 +42,19 @@
"doctrine/annotations": "^1.13",
"doctrine/coding-standard": "^9.0",
"phpbench/phpbench": "^0.16.10 || ^1.0",
"phpstan/phpstan": "~1.4.10 || 1.6.3",
"phpstan/phpstan": "~1.4.10 || 1.8.2",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"psr/log": "^1 || ^2 || ^3",
"squizlabs/php_codesniffer": "3.6.2",
"squizlabs/php_codesniffer": "3.7.1",
"symfony/cache": "^4.4 || ^5.4 || ^6.0",
"symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0",
"vimeo/psalm": "4.23.0"
"vimeo/psalm": "4.26.0"
},
"conflict": {
"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"
},

View File

@@ -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();

View File

@@ -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:

View File

@@ -644,6 +644,9 @@ A simple example for this event looks like:
if ($eventArgs->getEntity() instanceof User) {
if ($eventArgs->hasChangedField('name') && $eventArgs->getNewValue('name') == 'Alice') {
$eventArgs->setNewValue('name', 'Bob');
// The following will only work if `status` is already present in the computed changeset.
// Otherwise it will throw an InvalidArgumentException:
$eventArgs->setNewValue('status', 'active');
}
}
}
@@ -753,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;
@@ -827,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
{

View File

@@ -96,6 +96,8 @@ For this you just need to use the ``StaticPHPDriver``:
.. code-block:: php
<?php
use Doctrine\Persistence\Mapping\Driver\StaticPHPDriver;
$driver = new StaticPHPDriver('/path/to/entities');
$em->getConfiguration()->setMetadataDriverImpl($driver);

View File

@@ -32,10 +32,13 @@ 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;
use function is_scalar;
use function is_string;
use function iterator_count;
use function iterator_to_array;
use function ksort;
@@ -196,7 +199,7 @@ abstract class AbstractQuery
}
/**
* @return bool TRUE if the query results are enable for second level cache, FALSE otherwise.
* @return bool TRUE if the query results are enabled for second level cache, FALSE otherwise.
*/
public function isCacheable()
{
@@ -282,7 +285,7 @@ abstract class AbstractQuery
* The returned SQL syntax depends on the connection driver that is used
* by this query object at the time of this method call.
*
* @return string SQL query
* @return list<string>|string SQL query
*/
abstract public function getSQL();
@@ -324,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.
*/
@@ -353,7 +356,6 @@ abstract class AbstractQuery
*/
public function setParameters($parameters)
{
// BC compatibility with 2.3-
if (is_array($parameters)) {
/** @psalm-var ArrayCollection<int, Parameter> $parameterCollection */
$parameterCollection = new ArrayCollection();
@@ -401,8 +403,7 @@ abstract class AbstractQuery
*
* @param mixed $value
*
* @return mixed[]|string|int|float|bool
* @psalm-return array|scalar
* @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;
}
@@ -1302,7 +1335,8 @@ abstract class AbstractQuery
$parameters[$parameter->getName()] = $this->processParameterValue($parameter->getValue());
}
$sql = $this->getSQL();
$sql = $this->getSQL();
assert(is_string($sql));
$queryCacheProfile = $this->getHydrationCacheProfile();
$hints = $this->getHints();
$hints['hydrationMode'] = $this->getHydrationMode();
@@ -1374,7 +1408,8 @@ abstract class AbstractQuery
*/
protected function getHash()
{
$query = $this->getSQL();
$query = $this->getSQL();
assert(is_string($query));
$hints = $this->getHints();
$params = array_map(function (Parameter $parameter) {
$value = $parameter->getValue();

View File

@@ -12,6 +12,7 @@ use Doctrine\ORM\UnitOfWork;
use Doctrine\ORM\Utility\IdentifierFlattener;
use function array_merge;
use function assert;
use function is_array;
use function is_object;
use function reset;
@@ -57,6 +58,7 @@ class DefaultEntityHydrator implements EntityHydrator
if ($metadata->requiresFetchAfterChange) {
if ($metadata->isVersioned) {
assert($metadata->versionField !== null);
$data[$metadata->versionField] = $metadata->getFieldValue($entity, $metadata->versionField);
}

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
*/
@@ -607,8 +610,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
*
* @param string $name
*
* @return string|null
* @psalm-return ?class-string
* @return string|callable|null
* @psalm-return class-string<FunctionNode>|callable(string):FunctionNode|null
*/
public function getCustomStringFunction($name)
{
@@ -625,7 +628,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
*
* Any previously added string functions are discarded.
*
* @psalm-param array<string, class-string> $functions The map of custom
* @psalm-param array<string, class-string<FunctionNode>|callable(string):FunctionNode> $functions The map of custom
* DQL string functions.
*
* @return void
@@ -644,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
*/
@@ -659,8 +663,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
*
* @param string $name
*
* @return string|null
* @psalm-return ?class-string
* @return string|callable|null
* @psalm-return class-string|callable|null
*/
public function getCustomNumericFunction($name)
{
@@ -698,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
*/
@@ -712,8 +716,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
*
* @param string $name
*
* @return string|null
* @psalm-return ?class-string $name
* @return string|callable|null
* @psalm-return class-string|callable|null $name
*/
public function getCustomDatetimeFunction($name)
{
@@ -731,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
*/

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);
}
/**

View File

@@ -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();
}
}

View File

@@ -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;
}

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();
}
/**

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();
}
}

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();
}
}

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();
}
}

View File

@@ -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())
));
}
}

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 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;
}

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;
}

View File

@@ -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);
}
}

View File

@@ -83,9 +83,8 @@ class HydrationException extends ORMException
}
/**
* @param string $discrValue
* @param string[] $discrValues
* @psalm-param list<string> $discrValues
* @param string $discrValue
* @param list<int|string> $discrValues
*
* @return HydrationException
*/

View File

@@ -44,6 +44,9 @@ class ObjectHydrator extends AbstractHydrator
/** @var mixed[] */
private $initializedCollections = [];
/** @var array<string, PersistentCollection> */
private $uninitializedCollections = [];
/** @var mixed[] */
private $existingCollections = [];
@@ -112,10 +115,11 @@ class ObjectHydrator extends AbstractHydrator
parent::cleanup();
$this->identifierMap =
$this->initializedCollections =
$this->existingCollections =
$this->resultPointers = [];
$this->identifierMap =
$this->initializedCollections =
$this->uninitializedCollections =
$this->existingCollections =
$this->resultPointers = [];
if ($eagerLoad) {
$this->_uow->triggerEagerLoads();
@@ -126,10 +130,11 @@ class ObjectHydrator extends AbstractHydrator
protected function cleanupAfterRowIteration(): void
{
$this->identifierMap =
$this->initializedCollections =
$this->existingCollections =
$this->resultPointers = [];
$this->identifierMap =
$this->initializedCollections =
$this->uninitializedCollections =
$this->existingCollections =
$this->resultPointers = [];
}
/**
@@ -148,6 +153,12 @@ class ObjectHydrator extends AbstractHydrator
$coll->takeSnapshot();
}
foreach ($this->uninitializedCollections as $coll) {
if (! $coll->isInitialized()) {
$coll->setInitialized(true);
}
}
return $result;
}
@@ -411,8 +422,8 @@ class ObjectHydrator extends AbstractHydrator
}
} elseif (! $reflFieldValue) {
$this->initRelatedCollection($parentObject, $parentClass, $relationField, $parentAlias);
} elseif ($reflFieldValue instanceof PersistentCollection && $reflFieldValue->isInitialized() === false) {
$reflFieldValue->setInitialized(true);
} elseif ($reflFieldValue instanceof PersistentCollection && $reflFieldValue->isInitialized() === false && ! isset($this->uninitializedCollections[$oid . $relationField])) {
$this->uninitializedCollections[$oid . $relationField] = $reflFieldValue;
}
} else {
// PATH B: Single-valued association

View File

@@ -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;
}

View File

@@ -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());

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
{
@@ -519,9 +564,9 @@ class ClassMetadataInfo implements ClassMetadata
*
* @see discriminatorColumn
*
* @var array<string, string>
* @var array<int|string, string>
*
* @psalm-var array<string, class-string>
* @psalm-var array<int|string, class-string>
*/
public $discriminatorMap = [];
@@ -621,7 +666,7 @@ class ClassMetadataInfo implements ClassMetadata
* )
* </pre>
*
* @psalm-var array<string, array<string, mixed>>
* @psalm-var array<string, AssociationMapping>
*/
public $associationMappings = [];
@@ -713,7 +758,7 @@ class ClassMetadataInfo implements ClassMetadata
/**
* READ-ONLY: The name of the field which is used for versioning in optimistic locking (if any).
*
* @var mixed
* @var string|null
*/
public $versionField;
@@ -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
*
@@ -3219,7 +3264,7 @@ class ClassMetadataInfo implements ClassMetadata
* Sets the discriminator values used by this class.
* Used for JOINED and SINGLE_TABLE inheritance mapping strategies.
*
* @psalm-param array<string, class-string> $map
* @param array<int|string, string> $map
*
* @return void
*/
@@ -3233,9 +3278,8 @@ class ClassMetadataInfo implements ClassMetadata
/**
* Adds one entry of the discriminator map with a new class and corresponding name.
*
* @param string $name
* @param string $className
* @psalm-param class-string $className
* @param int|string $name
* @param string $className
*
* @return void
*
@@ -3519,7 +3563,7 @@ class ClassMetadataInfo implements ClassMetadata
* Sets the name of the field that is to be used for versioning if this class is
* versioned for optimistic locking.
*
* @param string $versionField
* @param string|null $versionField
*
* @return void
*/
@@ -3709,7 +3753,6 @@ class ClassMetadataInfo implements ClassMetadata
/**
* @param string|null $className
* @psalm-param string|class-string|null $className
*
* @return string|null null if the input value is null
* @psalm-return class-string|null

View File

@@ -54,6 +54,9 @@ class DefaultNamingStrategy implements NamingStrategy
/**
* {@inheritdoc}
*
* @param string $propertyName
* @param class-string $className
*/
public function joinColumnName($propertyName, $className = null)
{

View File

@@ -15,15 +15,11 @@ use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
#[Attribute(Attribute::TARGET_CLASS)]
final class DiscriminatorMap implements Annotation
{
/**
* @var array<string, string>
* @psalm-var array<string, class-string>
*/
/** @var array<int|string, string> */
public $value;
/**
* @param array<string, string> $value
* @psalm-param array<string, class-string> $value
* @param array<int|string, string> $value
*/
public function __construct(array $value)
{

View File

@@ -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;
}
/**

View File

@@ -108,7 +108,10 @@ class AttributeDriver extends CompatibilityAnnotationDriver
*/
public function loadMetadataForClass($className, PersistenceClassMetadata $metadata): void
{
$reflectionClass = $metadata->getReflectionClass();
$reflectionClass = $metadata->getReflectionClass()
// this happens when running annotation driver in combination with
// static reflection services. This is not the nicest fix
?? new ReflectionClass($metadata->name);
$classAttributes = $this->reader->getClassAnnotations($reflectionClass);
@@ -412,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) {
@@ -650,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,
@@ -663,6 +671,12 @@ class AttributeDriver extends CompatibilityAnnotationDriver
'columnDefinition' => $joinColumn->columnDefinition,
'referencedColumnName' => $joinColumn->referencedColumnName,
];
if ($joinColumn->options) {
$mapping['options'] = $joinColumn->options;
}
return $mapping;
}
/**

View File

@@ -9,18 +9,18 @@ use Doctrine\Persistence\Mapping\Driver\MappingDriver;
use function class_exists;
if (class_exists(PersistenceAnnotationDriver::class)) {
/**
* @internal This class will be removed in ORM 3.0.
*/
abstract class CompatibilityAnnotationDriver extends PersistenceAnnotationDriver
{
}
} else {
if (! class_exists(PersistenceAnnotationDriver::class)) {
/**
* @internal This class will be removed in ORM 3.0.
*/
abstract class CompatibilityAnnotationDriver implements MappingDriver
{
}
} else {
/**
* @internal This class will be removed in ORM 3.0.
*/
abstract class CompatibilityAnnotationDriver extends PersistenceAnnotationDriver
{
}
}

View File

@@ -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.
*

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
*

View File

@@ -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;
}
}

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;
}
}

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;
}
}

View File

@@ -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)));
}
}

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.
*/

View File

@@ -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'],

View File

@@ -112,6 +112,9 @@ class UnderscoreNamingStrategy implements NamingStrategy
/**
* {@inheritdoc}
*
* @param string $propertyName
* @param class-string $className
*/
public function joinColumnName($propertyName, $className = null)
{

View File

@@ -33,12 +33,8 @@ final class NativeQuery extends AbstractQuery
/**
* Gets the SQL query.
*
* @return mixed The built SQL query or an array of all SQL queries.
*
* @override
*/
public function getSQL()
public function getSQL(): string
{
return $this->sql;
}

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;
}

View File

@@ -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);
}
}

View File

@@ -14,7 +14,9 @@ use Doctrine\ORM\Utility\PersisterHelper;
use function array_merge;
use function array_reverse;
use function array_values;
use function assert;
use function implode;
use function is_string;
/**
* Persister for one-to-many collections.
@@ -225,7 +227,9 @@ class OneToManyPersister extends AbstractCollectionPersister
. ' FROM ' . $targetClass->name . ' t0 WHERE t0.' . $mapping['mappedBy'] . ' = :owner'
)->setParameter('owner', $collection->getOwner());
$statement = 'INSERT INTO ' . $tempTable . ' (' . $idColumnList . ') ' . $query->getSQL();
$sql = $query->getSQL();
assert(is_string($sql));
$statement = 'INSERT INTO ' . $tempTable . ' (' . $idColumnList . ') ' . $sql;
$parameters = array_values($sourceClass->getIdentifierValues($collection->getOwner()));
$numDeleted = $this->conn->executeStatement($statement, $parameters);

View File

@@ -494,7 +494,8 @@ class BasicEntityPersister implements EntityPersister
}
if ($versioned) {
$versionField = $this->class->versionField;
$versionField = $this->class->versionField;
assert($versionField !== null);
$versionFieldType = $this->class->fieldMappings[$versionField]['type'];
$versionColumn = $this->quoteStrategy->getColumnName($versionField, $this->class, $this->platform);

View File

@@ -73,8 +73,6 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
* @param string $fieldName
*
* @return string
*
* @override
*/
public function getOwningTable($fieldName)
{

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").
@@ -174,7 +176,7 @@ final class Query extends AbstractQuery
/**
* The query cache lifetime.
*
* @var int
* @var int|null
*/
private $queryCacheTTL;
@@ -188,9 +190,7 @@ final class Query extends AbstractQuery
/**
* Gets the SQL query/queries that correspond to this DQL query.
*
* @return mixed The built sql query or an array of all sql queries.
*
* @override
* @return list<string>|string The built sql query or an array of all sql queries.
*/
public function getSQL()
{
@@ -537,7 +537,7 @@ final class Query extends AbstractQuery
/**
* Defines how long the query cache will be active before expire.
*
* @param int $timeToLive How long the cache entry is valid.
* @param int|null $timeToLive How long the cache entry is valid.
*
* @return $this
*/
@@ -582,9 +582,6 @@ final class Query extends AbstractQuery
return $this->expireQueryCache;
}
/**
* @override
*/
public function free(): void
{
parent::free();
@@ -596,15 +593,24 @@ final class Query extends AbstractQuery
/**
* Sets a DQL query string.
*
* @param string $dqlQuery DQL Query.
* @param string|null $dqlQuery DQL Query.
*/
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;
}

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -17,7 +17,6 @@ use function strtolower;
class DateSubFunction extends DateAddFunction
{
/**
* @override
* @inheritdoc
*/
public function getSql(SqlWalker $sqlWalker)

View File

@@ -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
{

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -18,7 +18,7 @@ use Doctrine\DBAL\Types\Type;
*/
abstract class AbstractSqlExecutor
{
/** @var mixed[]|string */
/** @var list<string>|string */
protected $_sqlStatements;
/** @var QueryCacheProfile */

View File

@@ -98,7 +98,7 @@ class MultiTableDeleteExecutor extends AbstractSqlExecutor
}
$this->_createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable . ' ('
. $platform->getColumnDeclarationListSQL($columnDefinitions) . ')';
. $platform->getColumnDeclarationListSQL($columnDefinitions) . ', PRIMARY KEY(' . implode(',', $idColumnNames) . '))';
$this->_dropTempTableSql = $platform->getDropTemporaryTableSQL($tempTable);
}

View File

@@ -139,7 +139,7 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
}
$this->_createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable . ' ('
. $platform->getColumnDeclarationListSQL($columnDefinitions) . ')';
. $platform->getColumnDeclarationListSQL($columnDefinitions) . ', PRIMARY KEY(' . implode(',', $idColumnNames) . '))';
$this->_dropTempTableSql = $platform->getDropTemporaryTableSQL($tempTable);
}

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);

View File

@@ -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
*

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 = [];

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

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;
}
}

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;
}
/**

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);
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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));
}
}

View File

@@ -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

View File

@@ -51,7 +51,7 @@ class DebugUnitOfWorkListener
*/
public function onFlush(OnFlushEventArgs $args)
{
$this->dumpIdentityMap($args->getEntityManager());
$this->dumpIdentityMap($args->getObjectManager());
}
/**

View File

@@ -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

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);

View File

@@ -82,7 +82,7 @@ class XmlExporter extends AbstractExporter
foreach ($metadata->discriminatorMap as $value => $className) {
$discriminatorMappingXml = $discriminatorMapXml->addChild('discriminator-mapping');
$discriminatorMappingXml->addAttribute('value', $value);
$discriminatorMappingXml->addAttribute('value', (string) $value);
$discriminatorMappingXml->addAttribute('class', $className);
}
}

View File

@@ -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)
{

View File

@@ -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;

View File

@@ -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)
{

View File

@@ -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.');
}

View File

@@ -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;
}

View File

@@ -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)

View File

@@ -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;

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);
}
/**

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)) {

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;
@@ -54,6 +55,7 @@ use function array_merge;
use function array_pop;
use function array_sum;
use function array_values;
use function assert;
use function count;
use function current;
use function get_class;
@@ -73,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
{
@@ -1612,6 +1616,8 @@ class UnitOfWork implements PropertyChangedListener
case $class->isIdentifierNatural():
// Check for a version field, if available, to avoid a db lookup.
if ($class->isVersioned) {
assert($class->versionField !== null);
return $class->getFieldValue($entity, $class->versionField)
? self::STATE_DETACHED
: self::STATE_NEW;
@@ -1937,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.
@@ -1952,7 +1958,7 @@ class UnitOfWork implements PropertyChangedListener
$entity,
array &$visited,
$prevManagedCopy = null,
array $assoc = []
?array $assoc = null
) {
$oid = spl_object_id($entity);
@@ -2061,6 +2067,7 @@ class UnitOfWork implements PropertyChangedListener
return;
}
assert($class->versionField !== null);
$reflField = $class->reflFields[$class->versionField];
$managedCopyVersion = $reflField->getValue($managedCopy);
$entityVersion = $reflField->getValue($entity);
@@ -2087,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,
@@ -2495,6 +2502,7 @@ class UnitOfWork implements PropertyChangedListener
$entity->__load();
}
assert($class->versionField !== null);
$entityVersion = $class->reflFields[$class->versionField]->getValue($entity);
// phpcs:ignore SlevomatCodingStandard.Operators.DisallowEqualOperators.DisallowedNotEqualOperator

View File

@@ -11,7 +11,7 @@ use Doctrine\Persistence\Mapping\ClassMetadataFactory;
use function assert;
use function implode;
use function is_object;
use function is_a;
/**
* The IdentifierFlattener utility now houses some of the identifier manipulation logic from unit of work, so that it
@@ -55,7 +55,7 @@ final class IdentifierFlattener
$flatId = [];
foreach ($class->identifier as $field) {
if (isset($class->associationMappings[$field]) && isset($id[$field]) && is_object($id[$field])) {
if (isset($class->associationMappings[$field]) && isset($id[$field]) && is_a($id[$field], $class->associationMappings[$field]['targetEntity'])) {
$targetClassMetadata = $this->metadataFactory->getMetadataFor(
$class->associationMappings[$field]['targetEntity']
);

View File

@@ -266,21 +266,4 @@
<!-- https://github.com/doctrine/orm/issues/8537 -->
<exclude-pattern>lib/Doctrine/ORM/QueryBuilder.php</exclude-pattern>
</rule>
<rule ref="Generic.WhiteSpace.ScopeIndent.Incorrect">
<!-- see https://github.com/squizlabs/PHP_CodeSniffer/issues/3474 -->
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/AccessLevel.php</exclude-pattern>
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/City.php</exclude-pattern>
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/Suit.php</exclude-pattern>
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/Unit.php</exclude-pattern>
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/UserStatus.php</exclude-pattern>
</rule>
<rule ref="Generic.WhiteSpace.ScopeIndent.IncorrectExact">
<!-- see https://github.com/squizlabs/PHP_CodeSniffer/issues/3474 -->
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/AccessLevel.php</exclude-pattern>
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/City.php</exclude-pattern>
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/Suit.php</exclude-pattern>
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/Unit.php</exclude-pattern>
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/UserStatus.php</exclude-pattern>
</rule>
</ruleset>

View File

@@ -1,10 +1,5 @@
parameters:
ignoreErrors:
-
message: "#^Method Doctrine\\\\ORM\\\\AbstractQuery\\:\\:processParameterValue\\(\\) should return array\\|bool\\|float\\|int\\|string but returns mixed\\.$#"
count: 1
path: lib/Doctrine/ORM/AbstractQuery.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\Persisters\\\\Entity\\\\EntityPersister\\:\\:getCacheRegion\\(\\)\\.$#"
count: 1
@@ -225,6 +220,11 @@ parameters:
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
-
message: "#^Expression on left side of \\?\\? is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php
-
message: "#^Empty array passed to foreach\\.$#"
count: 1
@@ -326,37 +326,37 @@ parameters:
path: lib/Doctrine/ORM/Query/AST/Functions/DateAddFunction.php
-
message: "#^Parameter \\#2 \\$days of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddDaysExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$days of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddDaysExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateAddFunction.php
-
message: "#^Parameter \\#2 \\$hours of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddHourExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$hours of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddHourExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateAddFunction.php
-
message: "#^Parameter \\#2 \\$minutes of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddMinutesExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$minutes of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddMinutesExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateAddFunction.php
-
message: "#^Parameter \\#2 \\$months of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddMonthExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$months of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddMonthExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateAddFunction.php
-
message: "#^Parameter \\#2 \\$seconds of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddSecondsExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$seconds of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddSecondsExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateAddFunction.php
-
message: "#^Parameter \\#2 \\$weeks of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddWeeksExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$weeks of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddWeeksExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateAddFunction.php
-
message: "#^Parameter \\#2 \\$years of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddYearsExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$years of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddYearsExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateAddFunction.php
@@ -366,37 +366,37 @@ parameters:
path: lib/Doctrine/ORM/Query/AST/Functions/DateSubFunction.php
-
message: "#^Parameter \\#2 \\$days of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubDaysExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$days of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubDaysExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateSubFunction.php
-
message: "#^Parameter \\#2 \\$hours of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubHourExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$hours of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubHourExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateSubFunction.php
-
message: "#^Parameter \\#2 \\$minutes of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubMinutesExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$minutes of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubMinutesExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateSubFunction.php
-
message: "#^Parameter \\#2 \\$months of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubMonthExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$months of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubMonthExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateSubFunction.php
-
message: "#^Parameter \\#2 \\$seconds of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubSecondsExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$seconds of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubSecondsExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateSubFunction.php
-
message: "#^Parameter \\#2 \\$weeks of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubWeeksExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$weeks of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubWeeksExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateSubFunction.php
-
message: "#^Parameter \\#2 \\$years of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubYearsExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$years of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubYearsExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateSubFunction.php
@@ -475,11 +475,6 @@ parameters:
count: 1
path: lib/Doctrine/ORM/Query/Expr/Select.php
-
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
count: 3
path: lib/Doctrine/ORM/Query/Parser.php
-
message: "#^Method Doctrine\\\\ORM\\\\Query\\\\Parser\\:\\:ArithmeticFactor\\(\\) should return Doctrine\\\\ORM\\\\Query\\\\AST\\\\ArithmeticFactor but returns Doctrine\\\\ORM\\\\Query\\\\AST\\\\Node\\|string\\.$#"
count: 1
@@ -561,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
@@ -1200,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
@@ -1225,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
@@ -1240,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
@@ -1270,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

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