mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Compare commits
129 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf449bef7d | ||
|
|
152f91fa33 | ||
|
|
14d1eb5340 | ||
|
|
da0998c401 | ||
|
|
cc011d8215 | ||
|
|
d831c126c9 | ||
|
|
10eae1a7ff | ||
|
|
125e18cf24 | ||
|
|
8fba9d6868 | ||
|
|
7f4f1cda71 | ||
|
|
1c905b0e0a | ||
|
|
7901790b97 | ||
|
|
cef1d2d740 | ||
|
|
8126882305 | ||
|
|
a9513692cb | ||
|
|
52c3d9d82a | ||
|
|
2f46e5a130 | ||
|
|
a3fa1d7faa | ||
|
|
c7c57be0c2 | ||
|
|
721794fb9c | ||
|
|
70477d81e9 | ||
|
|
9bc6f5b4ac | ||
|
|
60c625be17 | ||
|
|
8b0d6a13c2 | ||
|
|
a7ac6ff8d9 | ||
|
|
222d544b0c | ||
|
|
6f1fd7a81e | ||
|
|
2af6e4db38 | ||
|
|
b48dafded8 | ||
|
|
ffe1550a68 | ||
|
|
eef5a1db81 | ||
|
|
c2d053d185 | ||
|
|
77822d623e | ||
|
|
7b5fafffbe | ||
|
|
aba8d74017 | ||
|
|
a056552db9 | ||
|
|
1142a396d3 | ||
|
|
f01b7d254d | ||
|
|
1ea8424e07 | ||
|
|
ba9f51a363 | ||
|
|
1ae74b8ec5 | ||
|
|
a64f315dfe | ||
|
|
6ca319a6f4 | ||
|
|
fceb279947 | ||
|
|
2977933119 | ||
|
|
5ac6fadf29 | ||
|
|
e59ed88251 | ||
|
|
a16aeaeac8 | ||
|
|
fca1ef78a7 | ||
|
|
a78e5bcf65 | ||
|
|
09b4a75ed3 | ||
|
|
b984b567b8 | ||
|
|
92c56164ee | ||
|
|
b2707509fc | ||
|
|
1d02139d2a | ||
|
|
7ed28dba50 | ||
|
|
f215515bab | ||
|
|
ffbfbfcda1 | ||
|
|
4a30f622ec | ||
|
|
aec3556502 | ||
|
|
25bd41a504 | ||
|
|
04573fc283 | ||
|
|
82362ee65e | ||
|
|
9ff0440aac | ||
|
|
2c40e917c8 | ||
|
|
5c06d46874 | ||
|
|
24c4ac4dd8 | ||
|
|
4fad7a1190 | ||
|
|
f36a8c879c | ||
|
|
fa4b945b94 | ||
|
|
7814cbf4ec | ||
|
|
979b3dcb8d | ||
|
|
8efdcb0555 | ||
|
|
3810a0b6f9 | ||
|
|
c9b644dced | ||
|
|
ae6de13c01 | ||
|
|
072c40357f | ||
|
|
ca94e82828 | ||
|
|
db0b9d13c6 | ||
|
|
6c17e47624 | ||
|
|
83d56d75e1 | ||
|
|
d593c33ffa | ||
|
|
6c925f5b60 | ||
|
|
82bf68d482 | ||
|
|
2ee936acb4 | ||
|
|
843bff4971 | ||
|
|
d679292861 | ||
|
|
65687821a7 | ||
|
|
ca0dffb53e | ||
|
|
01028cf3b8 | ||
|
|
84bfe7cbb9 | ||
|
|
1b3978e8c9 | ||
|
|
7f783b59c8 | ||
|
|
68662f5920 | ||
|
|
769b161dff | ||
|
|
9857cf971b | ||
|
|
f73dae9bc4 | ||
|
|
1c357b9fb3 | ||
|
|
3d031ed541 | ||
|
|
15ed97b7b1 | ||
|
|
9fd4af23e1 | ||
|
|
4206f01e7b | ||
|
|
7d4052c9e7 | ||
|
|
fc6feb5938 | ||
|
|
89b98bdff9 | ||
|
|
37572802cc | ||
|
|
a5bdc619c7 | ||
|
|
65a7c8882f | ||
|
|
2d6295c9db | ||
|
|
f0616626e0 | ||
|
|
a8ef69dbe6 | ||
|
|
c0a7317e8d | ||
|
|
843b0fcc16 | ||
|
|
b56de5b0e2 | ||
|
|
0b35e637b8 | ||
|
|
277614d9c2 | ||
|
|
29b8b0bffb | ||
|
|
b7ba018f0a | ||
|
|
72b1bf0c02 | ||
|
|
70241d3407 | ||
|
|
1d5d47964c | ||
|
|
c9c4203a1e | ||
|
|
091da8c420 | ||
|
|
515a3d8b8b | ||
|
|
603ab9a185 | ||
|
|
10d27c18ea | ||
|
|
ae9fb8ca21 | ||
|
|
c7f2a1d580 | ||
|
|
b3f441cb8b |
@@ -12,21 +12,27 @@
|
||||
"upcoming": true
|
||||
},
|
||||
{
|
||||
"name": "2.15",
|
||||
"branchName": "2.15.x",
|
||||
"slug": "2.15",
|
||||
"name": "2.16",
|
||||
"branchName": "2.16.x",
|
||||
"slug": "2.16",
|
||||
"upcoming": true
|
||||
},
|
||||
{
|
||||
"name": "2.14",
|
||||
"branchName": "2.14.x",
|
||||
"slug": "2.14",
|
||||
"name": "2.15",
|
||||
"branchName": "2.15.x",
|
||||
"slug": "2.15",
|
||||
"current": true,
|
||||
"aliases": [
|
||||
"current",
|
||||
"stable"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "2.14",
|
||||
"branchName": "2.14.x",
|
||||
"slug": "2.14",
|
||||
"maintained": false
|
||||
},
|
||||
{
|
||||
"name": "2.13",
|
||||
"branchName": "2.13.x",
|
||||
|
||||
@@ -40,6 +40,11 @@ cd orm
|
||||
composer install
|
||||
```
|
||||
|
||||
You will also need to enable the PHP extension that provides the SQLite driver
|
||||
for PDO: `pdo_sqlite`. How to do so depends on your system, but checking that it
|
||||
is enabled can universally be done with `php -m`: that command should list the
|
||||
extension.
|
||||
|
||||
To run the testsuite against another database, copy the ``phpunit.xml.dist``
|
||||
to for example ``mysql.phpunit.xml`` and edit the parameters. You can
|
||||
take a look at the ``ci/github/phpunit`` directory for some examples. Then run:
|
||||
|
||||
22
README.md
22
README.md
@@ -1,7 +1,7 @@
|
||||
| [3.0.x][3.0] | [2.14.x][2.14] | [2.13.x][2.13] |
|
||||
| [3.0.x][3.0] | [2.16.x][2.16] | [2.15.x][2.15] |
|
||||
|:----------------:|:----------------:|:----------:|
|
||||
| [![Build status][3.0 image]][3.0] | [![Build status][2.14 image]][2.14] | [![Build status][2.13 image]][2.13] |
|
||||
| [![Coverage Status][3.0 coverage image]][3.0 coverage]| [![Coverage Status][2.14 coverage image]][2.14 coverage] | [![Coverage Status][2.13 coverage image]][2.13 coverage] |
|
||||
| [![Build status][3.0 image]][3.0] | [![Build status][2.16 image]][2.16] | [![Build status][2.15 image]][2.15] |
|
||||
| [![Coverage Status][3.0 coverage image]][3.0 coverage]| [![Coverage Status][2.16 coverage image]][2.16 coverage] | [![Coverage Status][2.15 coverage image]][2.15 coverage] |
|
||||
|
||||
[<h1 align="center">🇺🇦 UKRAINE NEEDS YOUR HELP NOW!</h1>](https://www.doctrine-project.org/stop-war.html)
|
||||
|
||||
@@ -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.14 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.14.x
|
||||
[2.14]: https://github.com/doctrine/orm/tree/2.14.x
|
||||
[2.14 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.14.x/graph/badge.svg
|
||||
[2.14 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.14.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.16 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.16.x
|
||||
[2.16]: https://github.com/doctrine/orm/tree/2.16.x
|
||||
[2.16 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.16.x/graph/badge.svg
|
||||
[2.16 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.16.x
|
||||
[2.15 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.15.x
|
||||
[2.15]: https://github.com/doctrine/orm/tree/2.15.x
|
||||
[2.15 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.15.x/graph/badge.svg
|
||||
[2.15 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.15.x
|
||||
|
||||
30
UPGRADE.md
30
UPGRADE.md
@@ -1,3 +1,33 @@
|
||||
# Upgrade to 2.15
|
||||
|
||||
## Deprecated configuring `JoinColumn` on the inverse side of one-to-one associations
|
||||
|
||||
For one-to-one associations, the side using the `mappedBy` attribute is the inverse side.
|
||||
The owning side is the entity with the table containing the foreign key. Using `JoinColumn`
|
||||
configuration on the _inverse_ side now triggers a deprecation notice and will be an error
|
||||
in 3.0.
|
||||
|
||||
## Deprecated overriding fields or associations not declared in mapped superclasses
|
||||
|
||||
As stated in the documentation, fields and associations may only be overridden when being inherited
|
||||
from mapped superclasses. Overriding them for parent entity classes now triggers a deprecation notice
|
||||
and will be an error in 3.0.
|
||||
|
||||
## Deprecated undeclared entity inheritance
|
||||
|
||||
As soon as an entity class inherits from another entity class, inheritance has to
|
||||
be declared by adding the appropriate configuration for the root entity.
|
||||
|
||||
## Deprecated stubs for "concrete table inheritance"
|
||||
|
||||
This third way of mapping class inheritance was never implemented. Code stubs are
|
||||
now deprecated and will be removed in 3.0.
|
||||
|
||||
* `\Doctrine\ORM\Mapping\ClassMetadataInfo::INHERITANCE_TYPE_TABLE_PER_CLASS` constant
|
||||
* `\Doctrine\ORM\Mapping\ClassMetadataInfo::isInheritanceTypeTablePerClass()` method
|
||||
* Using `TABLE_PER_CLASS` as the value for the `InheritanceType` attribute or annotation
|
||||
or in XML configuration files.
|
||||
|
||||
# Upgrade to 2.14
|
||||
|
||||
## Deprecated `Doctrine\ORM\Persisters\Exception\UnrecognizedField::byName($field)` method.
|
||||
|
||||
@@ -24,14 +24,14 @@
|
||||
"composer-runtime-api": "^2",
|
||||
"ext-ctype": "*",
|
||||
"doctrine/cache": "^1.12.1 || ^2.1.1",
|
||||
"doctrine/collections": "^1.5 || ^2.0",
|
||||
"doctrine/collections": "^1.5 || ^2.1",
|
||||
"doctrine/common": "^3.0.3",
|
||||
"doctrine/dbal": "^2.13.1 || ^3.2",
|
||||
"doctrine/deprecations": "^0.5.3 || ^1",
|
||||
"doctrine/event-manager": "^1.2 || ^2",
|
||||
"doctrine/inflector": "^1.4 || ^2.0",
|
||||
"doctrine/instantiator": "^1.3",
|
||||
"doctrine/lexer": "^1.2.3 || ^2",
|
||||
"doctrine/instantiator": "^1.3 || ^2",
|
||||
"doctrine/lexer": "^2",
|
||||
"doctrine/persistence": "^2.4 || ^3",
|
||||
"psr/cache": "^1 || ^2 || ^3",
|
||||
"symfony/console": "^4.2 || ^5.0 || ^6.0",
|
||||
@@ -40,16 +40,16 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/annotations": "^1.13 || ^2",
|
||||
"doctrine/coding-standard": "^9.0.2 || ^11.0",
|
||||
"doctrine/coding-standard": "^9.0.2 || ^12.0",
|
||||
"phpbench/phpbench": "^0.16.10 || ^1.0",
|
||||
"phpstan/phpstan": "~1.4.10 || 1.10.6",
|
||||
"phpstan/phpstan": "~1.4.10 || 1.10.14",
|
||||
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.6",
|
||||
"psr/log": "^1 || ^2 || ^3",
|
||||
"squizlabs/php_codesniffer": "3.7.2",
|
||||
"symfony/cache": "^4.4 || ^5.4 || ^6.0",
|
||||
"symfony/var-exporter": "^4.4 || ^5.4 || ^6.2",
|
||||
"symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0",
|
||||
"vimeo/psalm": "4.30.0 || 5.9.0"
|
||||
"vimeo/psalm": "4.30.0 || 5.11.0"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/annotations": "<1.13 || >= 3.0"
|
||||
|
||||
@@ -368,6 +368,7 @@ Optional parameters:
|
||||
- **length**: By default this is 255.
|
||||
- **columnDefinition**: By default this is null the definition according to the type will be used. This option allows to override it.
|
||||
- **enumType**: By default this is `null`. Allows to map discriminatorColumn value to PHP enum
|
||||
- **options**: See "options" attribute on :ref:`#[Column] <attrref_column>`.
|
||||
|
||||
.. _attrref_discriminatormap:
|
||||
|
||||
@@ -575,7 +576,7 @@ Example with partial indexes:
|
||||
|
||||
#[Index(name: "search_idx", columns: ["category"],
|
||||
options: [
|
||||
"where": "((category IS NOT NULL))"
|
||||
"where" => "((category IS NOT NULL))"
|
||||
]
|
||||
)]
|
||||
class ECommerceProduct
|
||||
@@ -1104,7 +1105,8 @@ context.
|
||||
Required parameters:
|
||||
|
||||
- **name**: Name of the Index
|
||||
- **columns**: Array of columns.
|
||||
- **fields**: Array of fields (the names of the properties, used in the entity class).
|
||||
- **columns**: Array of columns (the names of the columns, used in the schema).
|
||||
|
||||
Optional parameters:
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ with the batching strategy that was already used for bulk inserts:
|
||||
|
||||
<?php
|
||||
$batchSize = 20;
|
||||
$i = 1;
|
||||
$i = 0;
|
||||
$q = $em->createQuery('select u from MyProject\Model\User u');
|
||||
foreach ($q->toIterable() as $user) {
|
||||
$user->increaseCredit();
|
||||
@@ -145,7 +145,7 @@ The following example shows how to do this:
|
||||
|
||||
<?php
|
||||
$batchSize = 20;
|
||||
$i = 1;
|
||||
$i = 0;
|
||||
$q = $em->createQuery('select u from MyProject\Model\User u');
|
||||
foreach($q->toIterable() as $row) {
|
||||
$em->remove($row);
|
||||
|
||||
@@ -1304,14 +1304,13 @@ creating a class which extends ``AbstractHydrator``:
|
||||
<?php
|
||||
namespace MyProject\Hydrators;
|
||||
|
||||
use Doctrine\DBAL\FetchMode;
|
||||
use Doctrine\ORM\Internal\Hydration\AbstractHydrator;
|
||||
|
||||
class CustomHydrator extends AbstractHydrator
|
||||
{
|
||||
protected function _hydrateAll()
|
||||
{
|
||||
return $this->_stmt->fetchAll(FetchMode::FETCH_ASSOC);
|
||||
return $this->_stmt->fetchAllAssociative();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,22 +15,32 @@ is common to multiple entity classes.
|
||||
|
||||
Mapped superclasses, just as regular, non-mapped classes, can
|
||||
appear in the middle of an otherwise mapped inheritance hierarchy
|
||||
(through Single Table Inheritance or Class Table Inheritance).
|
||||
(through Single Table Inheritance or Class Table Inheritance). They
|
||||
are not query-able, and need not have an ``#[Id]`` property.
|
||||
|
||||
No database table will be created for a mapped superclass itself,
|
||||
only for entity classes inheriting from it. Also, a mapped superclass
|
||||
need not have an ``#[Id]`` property.
|
||||
only for entity classes inheriting from it. That implies that a
|
||||
mapped superclass cannot be the ``targetEntity`` in associations.
|
||||
|
||||
In other words, a mapped superclass can use unidirectional One-To-One
|
||||
and Many-To-One associations where it is the owning side.
|
||||
Many-To-Many associations are only possible if the mapped
|
||||
superclass is only used in exactly one entity at the moment. For further
|
||||
support of inheritance, the single or joined table inheritance features
|
||||
have to be used.
|
||||
|
||||
.. note::
|
||||
|
||||
A mapped superclass cannot be an entity, it is not query-able and
|
||||
persistent relationships defined by a mapped superclass must be
|
||||
unidirectional (with an owning side only). This means that One-To-Many
|
||||
associations are not possible on a mapped superclass at all.
|
||||
Furthermore Many-To-Many associations are only possible if the
|
||||
mapped superclass is only used in exactly one entity at the moment.
|
||||
For further support of inheritance, the single or
|
||||
joined table inheritance features have to be used.
|
||||
One-To-Many associations are not generally possible on a mapped
|
||||
superclass, since they require the "many" side to hold the foreign
|
||||
key.
|
||||
|
||||
It is, however, possible to use the :doc:`ResolveTargetEntityListener <cookbook/resolve-target-entity-listener>`
|
||||
to replace references to a mapped superclass with an entity class at runtime.
|
||||
As long as there is only one entity subclass inheriting from the mapped
|
||||
superclass and all references to the mapped superclass are resolved to that
|
||||
entity class at runtime, the mapped superclass *can* use One-To-Many associations
|
||||
and be named as the ``targetEntity`` on the owning sides.
|
||||
|
||||
.. warning::
|
||||
|
||||
|
||||
@@ -166,10 +166,10 @@ As long as the results are consistent with what a solution _without_ traits woul
|
||||
have produced, this is probably fine.
|
||||
|
||||
However, to mention known limitations, it is currently not possible to use "class"
|
||||
level `annotations <https://github.com/doctrine/orm/pull/1517>` or
|
||||
level `annotations <https://github.com/doctrine/orm/pull/1517>`_ or
|
||||
`attributes <https://github.com/doctrine/orm/issues/8868>` on traits, and attempts to
|
||||
improve parser support for traits as `here <https://github.com/doctrine/annotations/pull/102>`
|
||||
or `there <https://github.com/doctrine/annotations/pull/63>` have been abandoned
|
||||
improve parser support for traits as `here <https://github.com/doctrine/annotations/pull/102>`_
|
||||
or `there <https://github.com/doctrine/annotations/pull/63>`_ have been abandoned
|
||||
due to complexity.
|
||||
|
||||
XML mapping configuration probably needs to completely re-configure or otherwise
|
||||
|
||||
@@ -123,12 +123,12 @@ the ``FileDriver`` implementation for you to extend from:
|
||||
class MyMetadataDriver extends FileDriver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected $_fileExtension = '.dcm.ext';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function loadMetadataForClass($className, ClassMetadata $metadata)
|
||||
{
|
||||
@@ -138,7 +138,7 @@ the ``FileDriver`` implementation for you to extend from:
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function _loadMappingFile($file)
|
||||
{
|
||||
|
||||
@@ -167,7 +167,7 @@ The API of the ClassMetadataBuilder has the following methods with a fluent inte
|
||||
- ``addNamedQuery($name, $dqlQuery)``
|
||||
- ``setJoinedTableInheritance()``
|
||||
- ``setSingleTableInheritance()``
|
||||
- ``setDiscriminatorColumn($name, $type = 'string', $length = 255, $columnDefinition = null, $enumType = null)``
|
||||
- ``setDiscriminatorColumn($name, $type = 'string', $length = 255, $columnDefinition = null, $enumType = null, $options = [])``
|
||||
- ``addDiscriminatorMapClass($name, $class)``
|
||||
- ``setChangeTrackingPolicyDeferredExplicit()``
|
||||
- ``setChangeTrackingPolicyNotify()``
|
||||
|
||||
@@ -153,7 +153,7 @@ You need to create a class which implements ``Doctrine\ORM\Mapping\TypedFieldMap
|
||||
final class CustomEnumTypedFieldMapper implements TypedFieldMapper
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function validateAndComplete(array $mapping, ReflectionProperty $field): array
|
||||
{
|
||||
|
||||
@@ -718,6 +718,7 @@ methods:
|
||||
|
||||
* ``andX($arg1, $arg2, ...)``
|
||||
* ``orX($arg1, $arg2, ...)``
|
||||
* ``not($expression)``
|
||||
* ``eq($field, $value)``
|
||||
* ``gt($field, $value)``
|
||||
* ``lt($field, $value)``
|
||||
|
||||
@@ -22,5 +22,5 @@ In this workflow you would modify the database schema first and then
|
||||
regenerate the PHP code to use with this schema. You need a flexible
|
||||
code-generator for this task.
|
||||
|
||||
We spinned off a subproject, Doctrine CodeGenerator, that will fill this gap and
|
||||
We spun off a subproject, Doctrine CodeGenerator, that will fill this gap and
|
||||
allow you to do *Database First* development.
|
||||
|
||||
@@ -322,7 +322,7 @@ data in your storage, and later in your application when the data is loaded agai
|
||||
.. note::
|
||||
|
||||
This method, although very common, is inappropriate for Domain Driven
|
||||
Design (`DDD <https://en.wikipedia.org/wiki/Domain-driven_design>`)
|
||||
Design (`DDD <https://en.wikipedia.org/wiki/Domain-driven_design>`_)
|
||||
where methods should represent real business operations and not simple
|
||||
property change, And business invariants should be maintained both in the
|
||||
application state (entities in this case) and in the database, with no
|
||||
@@ -449,7 +449,7 @@ entity.
|
||||
|
||||
.. note::
|
||||
|
||||
A `DTO <https://en.wikipedia.org/wiki/Data_transfer_object>` is an object
|
||||
A `DTO <https://en.wikipedia.org/wiki/Data_transfer_object>`_ is an object
|
||||
that only carries data without any logic. Its only goal is to be transferred
|
||||
from one service to another.
|
||||
A ``DTO`` often represents data sent by a client and that has to be validated,
|
||||
|
||||
@@ -302,7 +302,7 @@
|
||||
<xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other"/>
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:NMTOKEN" use="required" />
|
||||
<xs:attribute name="type" type="xs:NMTOKEN" default="string" />
|
||||
<xs:attribute name="type" type="orm:type" default="string" />
|
||||
<xs:attribute name="column" type="orm:columntoken" />
|
||||
<xs:attribute name="length" type="xs:NMTOKEN" />
|
||||
<xs:attribute name="unique" type="xs:boolean" default="false" />
|
||||
@@ -330,6 +330,7 @@
|
||||
|
||||
<xs:complexType name="discriminator-column">
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="options" type="orm:options" minOccurs="0" />
|
||||
<xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other"/>
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:NMTOKEN" use="required" />
|
||||
@@ -414,7 +415,7 @@
|
||||
<xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other"/>
|
||||
</xs:choice>
|
||||
<xs:attribute name="name" type="xs:NMTOKEN" use="required" />
|
||||
<xs:attribute name="type" type="xs:NMTOKEN" />
|
||||
<xs:attribute name="type" type="orm:type" />
|
||||
<xs:attribute name="column" type="orm:columntoken" />
|
||||
<xs:attribute name="length" type="xs:NMTOKEN" />
|
||||
<xs:attribute name="association-key" type="xs:boolean" default="false" />
|
||||
@@ -446,6 +447,13 @@
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="type" id="type">
|
||||
<xs:restriction base="xs:token">
|
||||
<xs:pattern value="([a-zA-Z_u01-uff][a-zA-Z0-9_u01-uff]+)|(\c+)" id="type.class.pattern">
|
||||
</xs:pattern>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:complexType name="inverse-join-columns">
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="join-column" type="orm:join-column" minOccurs="1" maxOccurs="unbounded" />
|
||||
@@ -630,7 +638,7 @@
|
||||
<xs:element name="options" type="orm:options" minOccurs="0" />
|
||||
<xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other"/>
|
||||
</xs:choice>
|
||||
<xs:attribute name="type" type="xs:NMTOKEN" default="string" />
|
||||
<xs:attribute name="type" type="orm:type" default="string" />
|
||||
<xs:attribute name="column" type="orm:columntoken" />
|
||||
<xs:attribute name="length" type="xs:NMTOKEN" />
|
||||
<xs:attribute name="unique" type="xs:boolean" default="false" />
|
||||
|
||||
@@ -14,6 +14,8 @@ use Doctrine\ORM\Persisters\Entity\EntityPersister;
|
||||
|
||||
/**
|
||||
* Contract for building second level cache regions components.
|
||||
*
|
||||
* @psalm-import-type AssociationMapping from ClassMetadata
|
||||
*/
|
||||
interface CacheFactory
|
||||
{
|
||||
@@ -31,7 +33,7 @@ interface CacheFactory
|
||||
/**
|
||||
* Build a collection persister for the given relation mapping.
|
||||
*
|
||||
* @param mixed[] $mapping The association mapping.
|
||||
* @param AssociationMapping $mapping The association mapping.
|
||||
*
|
||||
* @return CachedCollectionPersister
|
||||
*/
|
||||
|
||||
@@ -48,7 +48,7 @@ class DefaultCache implements Cache
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getEntityCacheRegion($className)
|
||||
{
|
||||
@@ -63,7 +63,7 @@ class DefaultCache implements Cache
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getCollectionCacheRegion($className, $association)
|
||||
{
|
||||
@@ -78,7 +78,7 @@ class DefaultCache implements Cache
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function containsEntity($className, $identifier)
|
||||
{
|
||||
@@ -93,7 +93,7 @@ class DefaultCache implements Cache
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function evictEntity($className, $identifier)
|
||||
{
|
||||
@@ -108,7 +108,7 @@ class DefaultCache implements Cache
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function evictEntityRegion($className)
|
||||
{
|
||||
@@ -123,7 +123,7 @@ class DefaultCache implements Cache
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function evictEntityRegions()
|
||||
{
|
||||
@@ -141,7 +141,7 @@ class DefaultCache implements Cache
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function containsCollection($className, $association, $ownerIdentifier)
|
||||
{
|
||||
@@ -156,7 +156,7 @@ class DefaultCache implements Cache
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function evictCollection($className, $association, $ownerIdentifier)
|
||||
{
|
||||
@@ -171,7 +171,7 @@ class DefaultCache implements Cache
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function evictCollectionRegion($className, $association)
|
||||
{
|
||||
@@ -186,7 +186,7 @@ class DefaultCache implements Cache
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function evictCollectionRegions()
|
||||
{
|
||||
@@ -210,7 +210,7 @@ class DefaultCache implements Cache
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function containsQuery($regionName)
|
||||
{
|
||||
@@ -218,7 +218,7 @@ class DefaultCache implements Cache
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function evictQueryRegion($regionName = null)
|
||||
{
|
||||
@@ -234,7 +234,7 @@ class DefaultCache implements Cache
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function evictQueryRegions()
|
||||
{
|
||||
@@ -246,7 +246,7 @@ class DefaultCache implements Cache
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getQueryCache($regionName = null)
|
||||
{
|
||||
|
||||
@@ -106,7 +106,7 @@ class DefaultCacheFactory implements CacheFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function buildCachedEntityPersister(EntityManagerInterface $em, EntityPersister $persister, ClassMetadata $metadata)
|
||||
{
|
||||
@@ -134,10 +134,11 @@ class DefaultCacheFactory implements CacheFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function buildCachedCollectionPersister(EntityManagerInterface $em, CollectionPersister $persister, array $mapping)
|
||||
{
|
||||
assert(isset($mapping['cache']));
|
||||
$usage = $mapping['cache']['usage'];
|
||||
$region = $this->getRegion($mapping['cache']);
|
||||
|
||||
@@ -161,7 +162,7 @@ class DefaultCacheFactory implements CacheFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function buildQueryCache(EntityManagerInterface $em, $regionName = null)
|
||||
{
|
||||
@@ -177,7 +178,7 @@ class DefaultCacheFactory implements CacheFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function buildCollectionHydrator(EntityManagerInterface $em, array $mapping)
|
||||
{
|
||||
@@ -185,7 +186,7 @@ class DefaultCacheFactory implements CacheFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function buildEntityHydrator(EntityManagerInterface $em, ClassMetadata $metadata)
|
||||
{
|
||||
@@ -193,7 +194,7 @@ class DefaultCacheFactory implements CacheFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getRegion(array $cache)
|
||||
{
|
||||
@@ -224,7 +225,7 @@ class DefaultCacheFactory implements CacheFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getTimestampRegion()
|
||||
{
|
||||
@@ -239,7 +240,7 @@ class DefaultCacheFactory implements CacheFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function createCache(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ class DefaultCollectionHydrator implements CollectionHydrator
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function buildCacheEntry(ClassMetadata $metadata, CollectionCacheKey $key, $collection)
|
||||
{
|
||||
@@ -49,7 +49,7 @@ class DefaultCollectionHydrator implements CollectionHydrator
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function loadCacheEntry(ClassMetadata $metadata, CollectionCacheKey $key, CollectionCacheEntry $entry, PersistentCollection $collection)
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ class DefaultEntityHydrator implements EntityHydrator
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function buildCacheEntry(ClassMetadata $metadata, EntityCacheKey $key, $entity)
|
||||
{
|
||||
@@ -140,7 +140,7 @@ class DefaultEntityHydrator implements EntityHydrator
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function loadCacheEntry(ClassMetadata $metadata, EntityCacheKey $key, EntityCacheEntry $entry, $entity = null)
|
||||
{
|
||||
|
||||
@@ -29,6 +29,8 @@ use function reset;
|
||||
|
||||
/**
|
||||
* Default query cache implementation.
|
||||
*
|
||||
* @psalm-import-type AssociationMapping from ClassMetadata
|
||||
*/
|
||||
class DefaultQueryCache implements QueryCache
|
||||
{
|
||||
@@ -66,7 +68,7 @@ class DefaultQueryCache implements QueryCache
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function get(QueryCacheKey $key, ResultSetMapping $rsm, array $hints = [])
|
||||
{
|
||||
@@ -225,7 +227,7 @@ class DefaultQueryCache implements QueryCache
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function put(QueryCacheKey $key, ResultSetMapping $rsm, $result, array $hints = [])
|
||||
{
|
||||
@@ -326,8 +328,8 @@ class DefaultQueryCache implements QueryCache
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string,mixed> $assoc
|
||||
* @param mixed $assocValue
|
||||
* @param AssociationMapping $assoc
|
||||
* @param mixed $assocValue
|
||||
*
|
||||
* @return mixed[]|null
|
||||
* @psalm-return array{targetEntity: class-string, type: mixed, list?: array[], identifier?: array}|null
|
||||
@@ -448,7 +450,7 @@ class DefaultQueryCache implements QueryCache
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
@@ -456,7 +458,7 @@ class DefaultQueryCache implements QueryCache
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getRegion()
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ class CacheLoggerChain implements CacheLogger
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function collectionCacheHit($regionName, CollectionCacheKey $key)
|
||||
{
|
||||
@@ -50,7 +50,7 @@ class CacheLoggerChain implements CacheLogger
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function collectionCacheMiss($regionName, CollectionCacheKey $key)
|
||||
{
|
||||
@@ -60,7 +60,7 @@ class CacheLoggerChain implements CacheLogger
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function collectionCachePut($regionName, CollectionCacheKey $key)
|
||||
{
|
||||
@@ -70,7 +70,7 @@ class CacheLoggerChain implements CacheLogger
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function entityCacheHit($regionName, EntityCacheKey $key)
|
||||
{
|
||||
@@ -80,7 +80,7 @@ class CacheLoggerChain implements CacheLogger
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function entityCacheMiss($regionName, EntityCacheKey $key)
|
||||
{
|
||||
@@ -90,7 +90,7 @@ class CacheLoggerChain implements CacheLogger
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function entityCachePut($regionName, EntityCacheKey $key)
|
||||
{
|
||||
@@ -100,7 +100,7 @@ class CacheLoggerChain implements CacheLogger
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function queryCacheHit($regionName, QueryCacheKey $key)
|
||||
{
|
||||
@@ -110,7 +110,7 @@ class CacheLoggerChain implements CacheLogger
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function queryCacheMiss($regionName, QueryCacheKey $key)
|
||||
{
|
||||
@@ -120,7 +120,7 @@ class CacheLoggerChain implements CacheLogger
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function queryCachePut($regionName, QueryCacheKey $key)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ class StatisticsCacheLogger implements CacheLogger
|
||||
private $cachePutCountMap = [];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function collectionCacheMiss($regionName, CollectionCacheKey $key)
|
||||
{
|
||||
@@ -34,7 +34,7 @@ class StatisticsCacheLogger implements CacheLogger
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function collectionCacheHit($regionName, CollectionCacheKey $key)
|
||||
{
|
||||
@@ -43,7 +43,7 @@ class StatisticsCacheLogger implements CacheLogger
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function collectionCachePut($regionName, CollectionCacheKey $key)
|
||||
{
|
||||
@@ -52,7 +52,7 @@ class StatisticsCacheLogger implements CacheLogger
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function entityCacheMiss($regionName, EntityCacheKey $key)
|
||||
{
|
||||
@@ -61,7 +61,7 @@ class StatisticsCacheLogger implements CacheLogger
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function entityCacheHit($regionName, EntityCacheKey $key)
|
||||
{
|
||||
@@ -70,7 +70,7 @@ class StatisticsCacheLogger implements CacheLogger
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function entityCachePut($regionName, EntityCacheKey $key)
|
||||
{
|
||||
@@ -79,7 +79,7 @@ class StatisticsCacheLogger implements CacheLogger
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function queryCacheHit($regionName, QueryCacheKey $key)
|
||||
{
|
||||
@@ -88,7 +88,7 @@ class StatisticsCacheLogger implements CacheLogger
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function queryCacheMiss($regionName, QueryCacheKey $key)
|
||||
{
|
||||
@@ -97,7 +97,7 @@ class StatisticsCacheLogger implements CacheLogger
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function queryCachePut($regionName, QueryCacheKey $key)
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@ use function array_values;
|
||||
use function assert;
|
||||
use function count;
|
||||
|
||||
/** @psalm-import-type AssociationMapping from ClassMetadata */
|
||||
abstract class AbstractCollectionPersister implements CachedCollectionPersister
|
||||
{
|
||||
/** @var UnitOfWork */
|
||||
@@ -64,7 +65,7 @@ abstract class AbstractCollectionPersister implements CachedCollectionPersister
|
||||
* @param CollectionPersister $persister The collection persister that will be cached.
|
||||
* @param Region $region The collection region.
|
||||
* @param EntityManagerInterface $em The entity manager.
|
||||
* @param mixed[] $association The association mapping.
|
||||
* @param AssociationMapping $association The association mapping.
|
||||
*/
|
||||
public function __construct(CollectionPersister $persister, Region $region, EntityManagerInterface $em, array $association)
|
||||
{
|
||||
@@ -85,7 +86,7 @@ abstract class AbstractCollectionPersister implements CachedCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getCacheRegion()
|
||||
{
|
||||
@@ -93,7 +94,7 @@ abstract class AbstractCollectionPersister implements CachedCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSourceEntityMetadata()
|
||||
{
|
||||
@@ -101,7 +102,7 @@ abstract class AbstractCollectionPersister implements CachedCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getTargetEntityMetadata()
|
||||
{
|
||||
@@ -109,7 +110,7 @@ abstract class AbstractCollectionPersister implements CachedCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function loadCollectionCache(PersistentCollection $collection, CollectionCacheKey $key)
|
||||
{
|
||||
@@ -123,7 +124,7 @@ abstract class AbstractCollectionPersister implements CachedCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function storeCollectionCache(CollectionCacheKey $key, $elements)
|
||||
{
|
||||
@@ -167,7 +168,7 @@ abstract class AbstractCollectionPersister implements CachedCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function contains(PersistentCollection $collection, $element)
|
||||
{
|
||||
@@ -175,7 +176,7 @@ abstract class AbstractCollectionPersister implements CachedCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function containsKey(PersistentCollection $collection, $key)
|
||||
{
|
||||
@@ -183,7 +184,7 @@ abstract class AbstractCollectionPersister implements CachedCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function count(PersistentCollection $collection)
|
||||
{
|
||||
@@ -199,7 +200,7 @@ abstract class AbstractCollectionPersister implements CachedCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function get(PersistentCollection $collection, $index)
|
||||
{
|
||||
@@ -207,7 +208,7 @@ abstract class AbstractCollectionPersister implements CachedCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function slice(PersistentCollection $collection, $offset, $length = null)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ use function spl_object_id;
|
||||
class NonStrictReadWriteCachedCollectionPersister extends AbstractCollectionPersister
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function afterTransactionComplete()
|
||||
{
|
||||
@@ -32,7 +32,7 @@ class NonStrictReadWriteCachedCollectionPersister extends AbstractCollectionPers
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function afterTransactionRolledBack()
|
||||
{
|
||||
@@ -40,7 +40,7 @@ class NonStrictReadWriteCachedCollectionPersister extends AbstractCollectionPers
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function delete(PersistentCollection $collection)
|
||||
{
|
||||
@@ -53,7 +53,7 @@ class NonStrictReadWriteCachedCollectionPersister extends AbstractCollectionPers
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function update(PersistentCollection $collection)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ use Doctrine\ORM\PersistentCollection;
|
||||
class ReadOnlyCachedCollectionPersister extends NonStrictReadWriteCachedCollectionPersister
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function update(PersistentCollection $collection)
|
||||
{
|
||||
|
||||
@@ -7,21 +7,23 @@ namespace Doctrine\ORM\Cache\Persister\Collection;
|
||||
use Doctrine\ORM\Cache\CollectionCacheKey;
|
||||
use Doctrine\ORM\Cache\ConcurrentRegion;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Doctrine\ORM\PersistentCollection;
|
||||
use Doctrine\ORM\Persisters\Collection\CollectionPersister;
|
||||
|
||||
use function spl_object_id;
|
||||
|
||||
/** @psalm-import-type AssociationMapping from ClassMetadata */
|
||||
class ReadWriteCachedCollectionPersister extends AbstractCollectionPersister
|
||||
{
|
||||
/** @param mixed[] $association The association mapping. */
|
||||
/** @param AssociationMapping $association The association mapping. */
|
||||
public function __construct(CollectionPersister $persister, ConcurrentRegion $region, EntityManagerInterface $em, array $association)
|
||||
{
|
||||
parent::__construct($persister, $region, $em, $association);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function afterTransactionComplete()
|
||||
{
|
||||
@@ -41,7 +43,7 @@ class ReadWriteCachedCollectionPersister extends AbstractCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function afterTransactionRolledBack()
|
||||
{
|
||||
@@ -61,7 +63,7 @@ class ReadWriteCachedCollectionPersister extends AbstractCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function delete(PersistentCollection $collection)
|
||||
{
|
||||
@@ -82,7 +84,7 @@ class ReadWriteCachedCollectionPersister extends AbstractCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function update(PersistentCollection $collection)
|
||||
{
|
||||
|
||||
@@ -98,7 +98,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function addInsert($entity)
|
||||
{
|
||||
@@ -106,7 +106,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getInserts()
|
||||
{
|
||||
@@ -114,7 +114,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSelectSQL($criteria, $assoc = null, $lockMode = null, $limit = null, $offset = null, ?array $orderBy = null)
|
||||
{
|
||||
@@ -130,7 +130,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getInsertSQL()
|
||||
{
|
||||
@@ -138,7 +138,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getResultSetMapping()
|
||||
{
|
||||
@@ -146,7 +146,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSelectConditionStatementSQL($field, $value, $assoc = null, $comparison = null)
|
||||
{
|
||||
@@ -154,7 +154,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function exists($entity, ?Criteria $extraConditions = null)
|
||||
{
|
||||
@@ -170,7 +170,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getCacheRegion()
|
||||
{
|
||||
@@ -184,7 +184,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function storeEntityCache($entity, EntityCacheKey $key)
|
||||
{
|
||||
@@ -262,7 +262,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function expandParameters($criteria)
|
||||
{
|
||||
@@ -270,7 +270,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function expandCriteriaParameters(Criteria $criteria)
|
||||
{
|
||||
@@ -278,7 +278,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getClassMetadata()
|
||||
{
|
||||
@@ -286,7 +286,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getManyToManyCollection(array $assoc, $sourceEntity, $offset = null, $limit = null)
|
||||
{
|
||||
@@ -294,7 +294,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getOneToManyCollection(array $assoc, $sourceEntity, $offset = null, $limit = null)
|
||||
{
|
||||
@@ -302,7 +302,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getOwningTable($fieldName)
|
||||
{
|
||||
@@ -310,7 +310,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function executeInserts()
|
||||
{
|
||||
@@ -320,7 +320,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function load(array $criteria, $entity = null, $assoc = null, array $hints = [], $lockMode = null, $limit = null, ?array $orderBy = null)
|
||||
{
|
||||
@@ -364,7 +364,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function loadAll(array $criteria = [], ?array $orderBy = null, $limit = null, $offset = null)
|
||||
{
|
||||
@@ -400,7 +400,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function loadById(array $identifier, $entity = null)
|
||||
{
|
||||
@@ -464,7 +464,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function loadCriteria(Criteria $criteria)
|
||||
{
|
||||
@@ -503,7 +503,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function loadManyToManyCollection(array $assoc, $sourceEntity, PersistentCollection $collection)
|
||||
{
|
||||
@@ -538,7 +538,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function loadOneToManyCollection(array $assoc, $sourceEntity, PersistentCollection $collection)
|
||||
{
|
||||
@@ -573,7 +573,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function loadOneToOneEntity(array $assoc, $sourceEntity, array $identifier = [])
|
||||
{
|
||||
@@ -581,7 +581,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function lock(array $criteria, $lockMode)
|
||||
{
|
||||
@@ -589,7 +589,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function refresh(array $id, $entity, $lockMode = null)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ use function get_class;
|
||||
class NonStrictReadWriteCachedEntityPersister extends AbstractEntityPersister
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function afterTransactionComplete()
|
||||
{
|
||||
@@ -48,7 +48,7 @@ class NonStrictReadWriteCachedEntityPersister extends AbstractEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function afterTransactionRolledBack()
|
||||
{
|
||||
@@ -56,7 +56,7 @@ class NonStrictReadWriteCachedEntityPersister extends AbstractEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function delete($entity)
|
||||
{
|
||||
@@ -73,7 +73,7 @@ class NonStrictReadWriteCachedEntityPersister extends AbstractEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function update($entity)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ use Doctrine\ORM\Cache\Exception\CannotUpdateReadOnlyEntity;
|
||||
class ReadOnlyCachedEntityPersister extends NonStrictReadWriteCachedEntityPersister
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function update($entity)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ class ReadWriteCachedEntityPersister extends AbstractEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function afterTransactionComplete()
|
||||
{
|
||||
@@ -51,7 +51,7 @@ class ReadWriteCachedEntityPersister extends AbstractEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function afterTransactionRolledBack()
|
||||
{
|
||||
@@ -71,7 +71,7 @@ class ReadWriteCachedEntityPersister extends AbstractEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function delete($entity)
|
||||
{
|
||||
@@ -96,7 +96,7 @@ class ReadWriteCachedEntityPersister extends AbstractEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function update($entity)
|
||||
{
|
||||
|
||||
@@ -91,7 +91,7 @@ class DefaultRegion implements Region
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
@@ -109,7 +109,7 @@ class DefaultRegion implements Region
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function contains(CacheKey $key)
|
||||
{
|
||||
@@ -117,7 +117,7 @@ class DefaultRegion implements Region
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function get(CacheKey $key)
|
||||
{
|
||||
@@ -132,7 +132,7 @@ class DefaultRegion implements Region
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getMultiple(CollectionCacheEntry $collection)
|
||||
{
|
||||
@@ -164,7 +164,7 @@ class DefaultRegion implements Region
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
@@ -182,7 +182,7 @@ class DefaultRegion implements Region
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
@@ -192,7 +192,7 @@ class DefaultRegion implements Region
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
@@ -116,7 +116,7 @@ class FileLockRegion implements ConcurrentRegion
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
@@ -124,7 +124,7 @@ class FileLockRegion implements ConcurrentRegion
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function contains(CacheKey $key)
|
||||
{
|
||||
@@ -136,7 +136,7 @@ class FileLockRegion implements ConcurrentRegion
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function get(CacheKey $key)
|
||||
{
|
||||
@@ -148,7 +148,7 @@ class FileLockRegion implements ConcurrentRegion
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getMultiple(CollectionCacheEntry $collection)
|
||||
{
|
||||
@@ -160,7 +160,7 @@ class FileLockRegion implements ConcurrentRegion
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function put(CacheKey $key, CacheEntry $entry, ?Lock $lock = null)
|
||||
{
|
||||
@@ -172,7 +172,7 @@ class FileLockRegion implements ConcurrentRegion
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function evict(CacheKey $key)
|
||||
{
|
||||
@@ -184,7 +184,7 @@ class FileLockRegion implements ConcurrentRegion
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function evictAll()
|
||||
{
|
||||
@@ -202,7 +202,7 @@ class FileLockRegion implements ConcurrentRegion
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function lock(CacheKey $key)
|
||||
{
|
||||
@@ -223,7 +223,7 @@ class FileLockRegion implements ConcurrentRegion
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function unlock(CacheKey $key, Lock $lock)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ use Doctrine\ORM\Cache\TimestampRegion;
|
||||
class UpdateTimestampCache extends DefaultRegion implements TimestampRegion
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function update(CacheKey $key)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ class TimestampQueryCacheValidator implements QueryCacheValidator
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function isValid(QueryCacheKey $key, QueryCacheEntry $entry)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getConnection()
|
||||
{
|
||||
@@ -39,7 +39,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getExpressionBuilder()
|
||||
{
|
||||
@@ -47,7 +47,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @psalm-param class-string<T> $className
|
||||
*
|
||||
@@ -61,7 +61,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getClassMetadata($className)
|
||||
{
|
||||
@@ -69,7 +69,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function beginTransaction()
|
||||
{
|
||||
@@ -77,7 +77,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function transactional($func)
|
||||
{
|
||||
@@ -85,7 +85,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function wrapInTransaction(callable $func)
|
||||
{
|
||||
@@ -102,7 +102,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function commit()
|
||||
{
|
||||
@@ -110,7 +110,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function rollback()
|
||||
{
|
||||
@@ -118,7 +118,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function createQuery($dql = '')
|
||||
{
|
||||
@@ -126,7 +126,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function createNamedQuery($name)
|
||||
{
|
||||
@@ -134,7 +134,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function createNativeQuery($sql, ResultSetMapping $rsm)
|
||||
{
|
||||
@@ -142,7 +142,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function createNamedNativeQuery($name)
|
||||
{
|
||||
@@ -150,7 +150,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function createQueryBuilder()
|
||||
{
|
||||
@@ -158,7 +158,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getReference($entityName, $id)
|
||||
{
|
||||
@@ -166,7 +166,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getPartialReference($entityName, $identifier)
|
||||
{
|
||||
@@ -174,7 +174,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
@@ -182,7 +182,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function copy($entity, $deep = false)
|
||||
{
|
||||
@@ -190,7 +190,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function lock($entity, $lockMode, $lockVersion = null)
|
||||
{
|
||||
@@ -198,7 +198,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function find($className, $id, $lockMode = null, $lockVersion = null)
|
||||
{
|
||||
@@ -206,7 +206,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function flush($entity = null)
|
||||
{
|
||||
@@ -214,7 +214,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function refresh($object)
|
||||
{
|
||||
@@ -228,7 +228,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getEventManager()
|
||||
{
|
||||
@@ -236,7 +236,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getConfiguration()
|
||||
{
|
||||
@@ -244,7 +244,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function isOpen()
|
||||
{
|
||||
@@ -252,7 +252,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getUnitOfWork()
|
||||
{
|
||||
@@ -260,7 +260,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getHydrator($hydrationMode)
|
||||
{
|
||||
@@ -268,7 +268,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function newHydrator($hydrationMode)
|
||||
{
|
||||
@@ -276,7 +276,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getProxyFactory()
|
||||
{
|
||||
@@ -284,7 +284,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getFilters()
|
||||
{
|
||||
@@ -292,7 +292,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function isFiltersStateClean()
|
||||
{
|
||||
@@ -300,7 +300,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function hasFilters()
|
||||
{
|
||||
@@ -308,7 +308,7 @@ abstract class EntityManagerDecorator extends ObjectManagerDecorator implements
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getCache()
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ use Doctrine\Persistence\ObjectManager;
|
||||
interface EntityManagerInterface extends ObjectManager
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @psalm-param class-string<T> $className
|
||||
*
|
||||
|
||||
@@ -297,7 +297,7 @@ class EntityRepository implements ObjectRepository, Selectable
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ class AssignedGenerator extends AbstractIdGenerator
|
||||
/**
|
||||
* Returns the identifier assigned to the given entity.
|
||||
*
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws EntityMissingAssignedId
|
||||
*/
|
||||
|
||||
@@ -49,7 +49,7 @@ class IdentityGenerator extends AbstractIdGenerator
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function isPostInsertGenerator()
|
||||
{
|
||||
|
||||
@@ -21,20 +21,20 @@ class SequenceGenerator extends AbstractIdGenerator implements Serializable
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_allocationSize;
|
||||
private $allocationSize;
|
||||
|
||||
/**
|
||||
* The name of the sequence.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_sequenceName;
|
||||
private $sequenceName;
|
||||
|
||||
/** @var int */
|
||||
private $_nextValue = 0;
|
||||
private $nextValue = 0;
|
||||
|
||||
/** @var int|null */
|
||||
private $_maxValue = null;
|
||||
private $maxValue = null;
|
||||
|
||||
/**
|
||||
* Initializes a new sequence generator.
|
||||
@@ -44,8 +44,8 @@ class SequenceGenerator extends AbstractIdGenerator implements Serializable
|
||||
*/
|
||||
public function __construct($sequenceName, $allocationSize)
|
||||
{
|
||||
$this->_sequenceName = $sequenceName;
|
||||
$this->_allocationSize = $allocationSize;
|
||||
$this->sequenceName = $sequenceName;
|
||||
$this->allocationSize = $allocationSize;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,20 +53,20 @@ class SequenceGenerator extends AbstractIdGenerator implements Serializable
|
||||
*/
|
||||
public function generateId(EntityManagerInterface $em, $entity)
|
||||
{
|
||||
if ($this->_maxValue === null || $this->_nextValue === $this->_maxValue) {
|
||||
if ($this->maxValue === null || $this->nextValue === $this->maxValue) {
|
||||
// Allocate new values
|
||||
$connection = $em->getConnection();
|
||||
$sql = $connection->getDatabasePlatform()->getSequenceNextValSQL($this->_sequenceName);
|
||||
$sql = $connection->getDatabasePlatform()->getSequenceNextValSQL($this->sequenceName);
|
||||
|
||||
if ($connection instanceof PrimaryReadReplicaConnection) {
|
||||
$connection->ensureConnectedToPrimary();
|
||||
}
|
||||
|
||||
$this->_nextValue = (int) $connection->fetchOne($sql);
|
||||
$this->_maxValue = $this->_nextValue + $this->_allocationSize;
|
||||
$this->nextValue = (int) $connection->fetchOne($sql);
|
||||
$this->maxValue = $this->nextValue + $this->allocationSize;
|
||||
}
|
||||
|
||||
return $this->_nextValue++;
|
||||
return $this->nextValue++;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,7 +76,7 @@ class SequenceGenerator extends AbstractIdGenerator implements Serializable
|
||||
*/
|
||||
public function getCurrentMaxValue()
|
||||
{
|
||||
return $this->_maxValue;
|
||||
return $this->maxValue;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,7 +86,7 @@ class SequenceGenerator extends AbstractIdGenerator implements Serializable
|
||||
*/
|
||||
public function getNextValue()
|
||||
{
|
||||
return $this->_nextValue;
|
||||
return $this->nextValue;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,8 +103,8 @@ class SequenceGenerator extends AbstractIdGenerator implements Serializable
|
||||
public function __serialize(): array
|
||||
{
|
||||
return [
|
||||
'allocationSize' => $this->_allocationSize,
|
||||
'sequenceName' => $this->_sequenceName,
|
||||
'allocationSize' => $this->allocationSize,
|
||||
'sequenceName' => $this->sequenceName,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ class SequenceGenerator extends AbstractIdGenerator implements Serializable
|
||||
/** @param array<string, mixed> $data */
|
||||
public function __unserialize(array $data): void
|
||||
{
|
||||
$this->_sequenceName = $data['sequenceName'];
|
||||
$this->_allocationSize = $data['allocationSize'];
|
||||
$this->sequenceName = $data['sequenceName'];
|
||||
$this->allocationSize = $data['allocationSize'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,19 +14,19 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
class TableGenerator extends AbstractIdGenerator
|
||||
{
|
||||
/** @var string */
|
||||
private $_tableName;
|
||||
private $tableName;
|
||||
|
||||
/** @var string */
|
||||
private $_sequenceName;
|
||||
private $sequenceName;
|
||||
|
||||
/** @var int */
|
||||
private $_allocationSize;
|
||||
private $allocationSize;
|
||||
|
||||
/** @var int|null */
|
||||
private $_nextValue;
|
||||
private $nextValue;
|
||||
|
||||
/** @var int|null */
|
||||
private $_maxValue;
|
||||
private $maxValue;
|
||||
|
||||
/**
|
||||
* @param string $tableName
|
||||
@@ -35,9 +35,9 @@ class TableGenerator extends AbstractIdGenerator
|
||||
*/
|
||||
public function __construct($tableName, $sequenceName = 'default', $allocationSize = 10)
|
||||
{
|
||||
$this->_tableName = $tableName;
|
||||
$this->_sequenceName = $sequenceName;
|
||||
$this->_allocationSize = $allocationSize;
|
||||
$this->tableName = $tableName;
|
||||
$this->sequenceName = $sequenceName;
|
||||
$this->allocationSize = $allocationSize;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,23 +47,23 @@ class TableGenerator extends AbstractIdGenerator
|
||||
EntityManagerInterface $em,
|
||||
$entity
|
||||
) {
|
||||
if ($this->_maxValue === null || $this->_nextValue === $this->_maxValue) {
|
||||
if ($this->maxValue === null || $this->nextValue === $this->maxValue) {
|
||||
// Allocate new values
|
||||
$conn = $em->getConnection();
|
||||
|
||||
if ($conn->getTransactionNestingLevel() === 0) {
|
||||
// use select for update
|
||||
$sql = $conn->getDatabasePlatform()->getTableHiLoCurrentValSql($this->_tableName, $this->_sequenceName);
|
||||
$sql = $conn->getDatabasePlatform()->getTableHiLoCurrentValSql($this->tableName, $this->sequenceName);
|
||||
$currentLevel = $conn->fetchOne($sql);
|
||||
|
||||
if ($currentLevel !== null) {
|
||||
$this->_nextValue = $currentLevel;
|
||||
$this->_maxValue = $this->_nextValue + $this->_allocationSize;
|
||||
$this->nextValue = $currentLevel;
|
||||
$this->maxValue = $this->nextValue + $this->allocationSize;
|
||||
|
||||
$updateSql = $conn->getDatabasePlatform()->getTableHiLoUpdateNextValSql(
|
||||
$this->_tableName,
|
||||
$this->_sequenceName,
|
||||
$this->_allocationSize
|
||||
$this->tableName,
|
||||
$this->sequenceName,
|
||||
$this->allocationSize
|
||||
);
|
||||
|
||||
if ($conn->executeStatement($updateSql, [1 => $currentLevel, 2 => $currentLevel + 1]) !== 1) {
|
||||
@@ -78,6 +78,6 @@ class TableGenerator extends AbstractIdGenerator
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_nextValue++;
|
||||
return $this->nextValue++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,39 +19,39 @@ use function reset;
|
||||
class ArrayHydrator extends AbstractHydrator
|
||||
{
|
||||
/** @var array<string,bool> */
|
||||
private $_rootAliases = [];
|
||||
private $rootAliases = [];
|
||||
|
||||
/** @var bool */
|
||||
private $_isSimpleQuery = false;
|
||||
private $isSimpleQuery = false;
|
||||
|
||||
/** @var mixed[] */
|
||||
private $_identifierMap = [];
|
||||
private $identifierMap = [];
|
||||
|
||||
/** @var mixed[] */
|
||||
private $_resultPointers = [];
|
||||
private $resultPointers = [];
|
||||
|
||||
/** @var array<string,string> */
|
||||
private $_idTemplate = [];
|
||||
private $idTemplate = [];
|
||||
|
||||
/** @var int */
|
||||
private $_resultCounter = 0;
|
||||
private $resultCounter = 0;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function prepare()
|
||||
{
|
||||
$this->_isSimpleQuery = count($this->resultSetMapping()->aliasMap) <= 1;
|
||||
$this->isSimpleQuery = count($this->resultSetMapping()->aliasMap) <= 1;
|
||||
|
||||
foreach ($this->resultSetMapping()->aliasMap as $dqlAlias => $className) {
|
||||
$this->_identifierMap[$dqlAlias] = [];
|
||||
$this->_resultPointers[$dqlAlias] = [];
|
||||
$this->_idTemplate[$dqlAlias] = '';
|
||||
$this->identifierMap[$dqlAlias] = [];
|
||||
$this->resultPointers[$dqlAlias] = [];
|
||||
$this->idTemplate[$dqlAlias] = '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function hydrateAllData()
|
||||
{
|
||||
@@ -65,12 +65,12 @@ class ArrayHydrator extends AbstractHydrator
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function hydrateRowData(array $row, array &$result)
|
||||
{
|
||||
// 1) Initialize
|
||||
$id = $this->_idTemplate; // initialize the id-memory
|
||||
$id = $this->idTemplate; // initialize the id-memory
|
||||
$nonemptyComponents = [];
|
||||
$rowData = $this->gatherRowData($row, $id, $nonemptyComponents);
|
||||
|
||||
@@ -91,14 +91,14 @@ class ArrayHydrator extends AbstractHydrator
|
||||
|
||||
// Get a reference to the right element in the result tree.
|
||||
// This element will get the associated element attached.
|
||||
if ($this->resultSetMapping()->isMixed && isset($this->_rootAliases[$parent])) {
|
||||
$first = reset($this->_resultPointers);
|
||||
if ($this->resultSetMapping()->isMixed && isset($this->rootAliases[$parent])) {
|
||||
$first = reset($this->resultPointers);
|
||||
// TODO: Exception if $key === null ?
|
||||
$baseElement =& $this->_resultPointers[$parent][key($first)];
|
||||
} elseif (isset($this->_resultPointers[$parent])) {
|
||||
$baseElement =& $this->_resultPointers[$parent];
|
||||
$baseElement =& $this->resultPointers[$parent][key($first)];
|
||||
} elseif (isset($this->resultPointers[$parent])) {
|
||||
$baseElement =& $this->resultPointers[$parent];
|
||||
} else {
|
||||
unset($this->_resultPointers[$dqlAlias]); // Ticket #1228
|
||||
unset($this->resultPointers[$dqlAlias]); // Ticket #1228
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -116,8 +116,8 @@ class ArrayHydrator extends AbstractHydrator
|
||||
}
|
||||
|
||||
if (isset($nonemptyComponents[$dqlAlias])) {
|
||||
$indexExists = isset($this->_identifierMap[$path][$id[$parent]][$id[$dqlAlias]]);
|
||||
$index = $indexExists ? $this->_identifierMap[$path][$id[$parent]][$id[$dqlAlias]] : false;
|
||||
$indexExists = isset($this->identifierMap[$path][$id[$parent]][$id[$dqlAlias]]);
|
||||
$index = $indexExists ? $this->identifierMap[$path][$id[$parent]][$id[$dqlAlias]] : false;
|
||||
$indexIsValid = $index !== false ? isset($baseElement[$relationAlias][$index]) : false;
|
||||
|
||||
if (! $indexExists || ! $indexIsValid) {
|
||||
@@ -131,7 +131,7 @@ class ArrayHydrator extends AbstractHydrator
|
||||
|
||||
end($baseElement[$relationAlias]);
|
||||
|
||||
$this->_identifierMap[$path][$id[$parent]][$id[$dqlAlias]] = key($baseElement[$relationAlias]);
|
||||
$this->identifierMap[$path][$id[$parent]][$id[$dqlAlias]] = key($baseElement[$relationAlias]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -155,8 +155,8 @@ class ArrayHydrator extends AbstractHydrator
|
||||
} else {
|
||||
// It's a root result element
|
||||
|
||||
$this->_rootAliases[$dqlAlias] = true; // Mark as root
|
||||
$entityKey = $this->resultSetMapping()->entityMappings[$dqlAlias] ?: 0;
|
||||
$this->rootAliases[$dqlAlias] = true; // Mark as root
|
||||
$entityKey = $this->resultSetMapping()->entityMappings[$dqlAlias] ?: 0;
|
||||
|
||||
// if this row has a NULL value for the root result id then make it a null result.
|
||||
if (! isset($nonemptyComponents[$dqlAlias])) {
|
||||
@@ -164,14 +164,14 @@ class ArrayHydrator extends AbstractHydrator
|
||||
? [$entityKey => null]
|
||||
: null;
|
||||
|
||||
$resultKey = $this->_resultCounter;
|
||||
++$this->_resultCounter;
|
||||
$resultKey = $this->resultCounter;
|
||||
++$this->resultCounter;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check for an existing element
|
||||
if ($this->_isSimpleQuery || ! isset($this->_identifierMap[$dqlAlias][$id[$dqlAlias]])) {
|
||||
if ($this->isSimpleQuery || ! isset($this->identifierMap[$dqlAlias][$id[$dqlAlias]])) {
|
||||
$element = $this->resultSetMapping()->isMixed
|
||||
? [$entityKey => $data]
|
||||
: $data;
|
||||
@@ -180,15 +180,15 @@ class ArrayHydrator extends AbstractHydrator
|
||||
$resultKey = $row[$this->resultSetMapping()->indexByMap[$dqlAlias]];
|
||||
$result[$resultKey] = $element;
|
||||
} else {
|
||||
$resultKey = $this->_resultCounter;
|
||||
$resultKey = $this->resultCounter;
|
||||
$result[] = $element;
|
||||
|
||||
++$this->_resultCounter;
|
||||
++$this->resultCounter;
|
||||
}
|
||||
|
||||
$this->_identifierMap[$dqlAlias][$id[$dqlAlias]] = $resultKey;
|
||||
$this->identifierMap[$dqlAlias][$id[$dqlAlias]] = $resultKey;
|
||||
} else {
|
||||
$index = $this->_identifierMap[$dqlAlias][$id[$dqlAlias]];
|
||||
$index = $this->identifierMap[$dqlAlias][$id[$dqlAlias]];
|
||||
$resultKey = $index;
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ class ArrayHydrator extends AbstractHydrator
|
||||
}
|
||||
|
||||
if (! isset($resultKey)) {
|
||||
$this->_resultCounter++;
|
||||
$this->resultCounter++;
|
||||
}
|
||||
|
||||
// Append scalar values to mixed result sets
|
||||
@@ -206,7 +206,7 @@ class ArrayHydrator extends AbstractHydrator
|
||||
// this only ever happens when no object is fetched (scalar result only)
|
||||
$resultKey = isset($this->resultSetMapping()->indexByMap['scalars'])
|
||||
? $row[$this->resultSetMapping()->indexByMap['scalars']]
|
||||
: $this->_resultCounter - 1;
|
||||
: $this->resultCounter - 1;
|
||||
}
|
||||
|
||||
foreach ($rowData['scalars'] as $name => $value) {
|
||||
@@ -217,7 +217,7 @@ class ArrayHydrator extends AbstractHydrator
|
||||
// Append new object to mixed result sets
|
||||
if (isset($rowData['newObjects'])) {
|
||||
if (! isset($resultKey)) {
|
||||
$resultKey = $this->_resultCounter - 1;
|
||||
$resultKey = $this->resultCounter - 1;
|
||||
}
|
||||
|
||||
$scalarCount = (isset($rowData['scalars']) ? count($rowData['scalars']) : 0);
|
||||
@@ -253,19 +253,19 @@ class ArrayHydrator extends AbstractHydrator
|
||||
bool $oneToOne
|
||||
): void {
|
||||
if ($coll === null) {
|
||||
unset($this->_resultPointers[$dqlAlias]); // Ticket #1228
|
||||
unset($this->resultPointers[$dqlAlias]); // Ticket #1228
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($oneToOne) {
|
||||
$this->_resultPointers[$dqlAlias] =& $coll;
|
||||
$this->resultPointers[$dqlAlias] =& $coll;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($index !== false) {
|
||||
$this->_resultPointers[$dqlAlias] =& $coll[$index];
|
||||
$this->resultPointers[$dqlAlias] =& $coll[$index];
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -275,6 +275,6 @@ class ArrayHydrator extends AbstractHydrator
|
||||
}
|
||||
|
||||
end($coll);
|
||||
$this->_resultPointers[$dqlAlias] =& $coll[key($coll)];
|
||||
$this->resultPointers[$dqlAlias] =& $coll[key($coll)];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,21 +16,21 @@ use ReturnTypeWillChange;
|
||||
class IterableResult implements Iterator
|
||||
{
|
||||
/** @var AbstractHydrator */
|
||||
private $_hydrator;
|
||||
private $hydrator;
|
||||
|
||||
/** @var bool */
|
||||
private $_rewinded = false;
|
||||
private $rewinded = false;
|
||||
|
||||
/** @var int */
|
||||
private $_key = -1;
|
||||
private $key = -1;
|
||||
|
||||
/** @var mixed[]|null */
|
||||
private $_current = null;
|
||||
private $current = null;
|
||||
|
||||
/** @param AbstractHydrator $hydrator */
|
||||
public function __construct($hydrator)
|
||||
{
|
||||
$this->_hydrator = $hydrator;
|
||||
$this->hydrator = $hydrator;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,12 +41,12 @@ class IterableResult implements Iterator
|
||||
#[ReturnTypeWillChange]
|
||||
public function rewind()
|
||||
{
|
||||
if ($this->_rewinded === true) {
|
||||
if ($this->rewinded === true) {
|
||||
throw new HydrationException('Can only iterate a Result once.');
|
||||
}
|
||||
|
||||
$this->_current = $this->next();
|
||||
$this->_rewinded = true;
|
||||
$this->current = $this->next();
|
||||
$this->rewinded = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,30 +57,30 @@ class IterableResult implements Iterator
|
||||
#[ReturnTypeWillChange]
|
||||
public function next()
|
||||
{
|
||||
$this->_current = $this->_hydrator->hydrateRow();
|
||||
$this->_key++;
|
||||
$this->current = $this->hydrator->hydrateRow();
|
||||
$this->key++;
|
||||
|
||||
return $this->_current;
|
||||
return $this->current;
|
||||
}
|
||||
|
||||
/** @return mixed */
|
||||
#[ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
return $this->_current;
|
||||
return $this->current;
|
||||
}
|
||||
|
||||
/** @return int */
|
||||
#[ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
return $this->_key;
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
/** @return bool */
|
||||
#[ReturnTypeWillChange]
|
||||
public function valid()
|
||||
{
|
||||
return $this->_current !== false;
|
||||
return $this->current !== false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ use Doctrine\Persistence\Proxy;
|
||||
|
||||
use function array_fill_keys;
|
||||
use function array_keys;
|
||||
use function array_map;
|
||||
use function count;
|
||||
use function is_array;
|
||||
use function key;
|
||||
@@ -52,7 +53,7 @@ class ObjectHydrator extends AbstractHydrator
|
||||
private $existingCollections = [];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function prepare()
|
||||
{
|
||||
@@ -108,7 +109,7 @@ class ObjectHydrator extends AbstractHydrator
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function cleanup()
|
||||
{
|
||||
@@ -139,7 +140,7 @@ class ObjectHydrator extends AbstractHydrator
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function hydrateAllData()
|
||||
{
|
||||
@@ -284,13 +285,17 @@ class ObjectHydrator extends AbstractHydrator
|
||||
$class = $this->_metadataCache[$className];
|
||||
|
||||
if ($class->isIdentifierComposite) {
|
||||
$idHash = '';
|
||||
|
||||
foreach ($class->identifier as $fieldName) {
|
||||
$idHash .= ' ' . (isset($class->associationMappings[$fieldName])
|
||||
? $data[$class->associationMappings[$fieldName]['joinColumns'][0]['name']]
|
||||
: $data[$fieldName]);
|
||||
}
|
||||
$idHash = UnitOfWork::getIdHashByIdentifier(
|
||||
array_map(
|
||||
/** @return mixed */
|
||||
static function (string $fieldName) use ($data, $class) {
|
||||
return isset($class->associationMappings[$fieldName])
|
||||
? $data[$class->associationMappings[$fieldName]['joinColumns'][0]['name']]
|
||||
: $data[$fieldName];
|
||||
},
|
||||
$class->identifier
|
||||
)
|
||||
);
|
||||
|
||||
return $this->_uow->tryGetByIdHash(ltrim($idHash), $class->rootEntityName);
|
||||
} elseif (isset($class->associationMappings[$class->identifier[0]])) {
|
||||
|
||||
@@ -16,7 +16,7 @@ use function count;
|
||||
final class ScalarColumnHydrator extends AbstractHydrator
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws MultipleSelectorsFoundException
|
||||
* @throws Exception
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Doctrine\ORM\Internal\Hydration;
|
||||
class ScalarHydrator extends AbstractHydrator
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function hydrateAllData()
|
||||
{
|
||||
@@ -26,7 +26,7 @@ class ScalarHydrator extends AbstractHydrator
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function hydrateRowData(array $row, array &$result)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ class SimpleObjectHydrator extends AbstractHydrator
|
||||
private $class;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function prepare()
|
||||
{
|
||||
@@ -44,7 +44,7 @@ class SimpleObjectHydrator extends AbstractHydrator
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function cleanup()
|
||||
{
|
||||
@@ -55,7 +55,7 @@ class SimpleObjectHydrator extends AbstractHydrator
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function hydrateAllData()
|
||||
{
|
||||
@@ -71,7 +71,7 @@ class SimpleObjectHydrator extends AbstractHydrator
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function hydrateRowData(array $row, array &$result)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ use function key;
|
||||
class SingleScalarHydrator extends AbstractHydrator
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function hydrateAllData()
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@ final class HydrationCompleteHandler
|
||||
}
|
||||
|
||||
/**
|
||||
* This method should me called after any hydration cycle completed.
|
||||
* This method should be called after any hydration cycle completed.
|
||||
*
|
||||
* Method fires all deferred invocations of postLoad events
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,7 @@ class AnsiQuoteStrategy implements QuoteStrategy
|
||||
use SQLResultCasing;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getColumnName($fieldName, ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
@@ -24,7 +24,7 @@ class AnsiQuoteStrategy implements QuoteStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getTableName(ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
@@ -32,7 +32,7 @@ class AnsiQuoteStrategy implements QuoteStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSequenceName(array $definition, ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
@@ -40,7 +40,7 @@ class AnsiQuoteStrategy implements QuoteStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
@@ -48,7 +48,7 @@ class AnsiQuoteStrategy implements QuoteStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getReferencedJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
@@ -56,7 +56,7 @@ class AnsiQuoteStrategy implements QuoteStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getJoinTableName(array $association, ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
@@ -64,7 +64,7 @@ class AnsiQuoteStrategy implements QuoteStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getIdentifierColumnNames(ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
@@ -72,7 +72,7 @@ class AnsiQuoteStrategy implements QuoteStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getColumnAlias($columnName, $counter, AbstractPlatform $platform, ?ClassMetadata $class = null)
|
||||
{
|
||||
|
||||
@@ -220,10 +220,11 @@ class ClassMetadataBuilder
|
||||
* @param string $type
|
||||
* @param int $length
|
||||
* @psalm-param class-string<BackedEnum>|null $enumType
|
||||
* @psalm-param array<string, mixed> $options
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDiscriminatorColumn($name, $type = 'string', $length = 255, ?string $columnDefinition = null, ?string $enumType = null)
|
||||
public function setDiscriminatorColumn($name, $type = 'string', $length = 255, ?string $columnDefinition = null, ?string $enumType = null, array $options = [])
|
||||
{
|
||||
$this->cm->setDiscriminatorColumn(
|
||||
[
|
||||
@@ -232,6 +233,7 @@ class ClassMetadataBuilder
|
||||
'length' => $length,
|
||||
'columnDefinition' => $columnDefinition,
|
||||
'enumType' => $enumType,
|
||||
'options' => $options,
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ final class ChainTypedFieldMapper implements TypedFieldMapper
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function validateAndComplete(array $mapping, ReflectionProperty $field): array
|
||||
{
|
||||
|
||||
@@ -4,12 +4,102 @@ declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
use BackedEnum;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @todo remove or rename ClassMetadataInfo to ClassMetadata
|
||||
* @template-covariant T of object
|
||||
* @template-extends ClassMetadataInfo<T>
|
||||
* @psalm-type FieldMapping = array{
|
||||
* type: string,
|
||||
* fieldName: string,
|
||||
* columnName: string,
|
||||
* length?: int,
|
||||
* id?: bool,
|
||||
* nullable?: bool,
|
||||
* notInsertable?: bool,
|
||||
* notUpdatable?: bool,
|
||||
* generated?: int,
|
||||
* enumType?: class-string<BackedEnum>,
|
||||
* columnDefinition?: string,
|
||||
* precision?: int,
|
||||
* scale?: int,
|
||||
* unique?: bool,
|
||||
* inherited?: class-string,
|
||||
* originalClass?: class-string,
|
||||
* originalField?: string,
|
||||
* quoted?: bool,
|
||||
* requireSQLConversion?: bool,
|
||||
* declared?: class-string,
|
||||
* declaredField?: string,
|
||||
* options?: array<string, mixed>,
|
||||
* version?: string,
|
||||
* default?: string|int,
|
||||
* }
|
||||
* @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,
|
||||
* }
|
||||
* @psalm-type DiscriminatorColumnMapping = array{
|
||||
* name: string,
|
||||
* fieldName: string,
|
||||
* type: string,
|
||||
* length?: int,
|
||||
* columnDefinition?: string|null,
|
||||
* enumType?: class-string<BackedEnum>|null,
|
||||
* options?: array<string, mixed>,
|
||||
* }
|
||||
* @psalm-type EmbeddedClassMapping = array{
|
||||
* class: class-string,
|
||||
* columnPrefix: string|null,
|
||||
* declaredField: string|null,
|
||||
* originalField: string|null,
|
||||
* inherited?: class-string,
|
||||
* declared?: class-string,
|
||||
* }
|
||||
*/
|
||||
class ClassMetadata extends ClassMetadataInfo
|
||||
{
|
||||
|
||||
@@ -47,6 +47,9 @@ use function substr;
|
||||
* to a relational database.
|
||||
*
|
||||
* @extends AbstractClassMetadataFactory<ClassMetadata>
|
||||
* @psalm-import-type AssociationMapping from ClassMetadata
|
||||
* @psalm-import-type EmbeddedClassMapping from ClassMetadata
|
||||
* @psalm-import-type FieldMapping from ClassMetadata
|
||||
*/
|
||||
class ClassMetadataFactory extends AbstractClassMetadataFactory
|
||||
{
|
||||
@@ -145,15 +148,21 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
|
||||
}
|
||||
|
||||
if (! $class->isMappedSuperclass) {
|
||||
if ($rootEntityFound && $class->isInheritanceTypeNone()) {
|
||||
Deprecation::trigger(
|
||||
'doctrine/orm',
|
||||
'https://github.com/doctrine/orm/pull/10431',
|
||||
"Entity class '%s' is a subclass of the root entity class '%s', but no inheritance mapping type was declared. This is a misconfiguration and will be an error in Doctrine ORM 3.0.",
|
||||
$class->name,
|
||||
end($nonSuperclassParents)
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($class->embeddedClasses as $property => $embeddableClass) {
|
||||
if (isset($embeddableClass['inherited'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! (isset($embeddableClass['class']) && $embeddableClass['class'])) {
|
||||
throw MappingException::missingEmbeddedClass($property);
|
||||
}
|
||||
|
||||
if (isset($this->embeddablesActiveNesting[$embeddableClass['class']])) {
|
||||
throw MappingException::infiniteEmbeddableNesting($class->name, $property);
|
||||
}
|
||||
@@ -411,20 +420,30 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
|
||||
return strtolower(end($parts));
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts the `inherited` and `declared` values into mapping information for fields, associations
|
||||
* and embedded classes.
|
||||
*
|
||||
* @param AssociationMapping|EmbeddedClassMapping|FieldMapping $mapping
|
||||
*/
|
||||
private function addMappingInheritanceInformation(array &$mapping, ClassMetadata $parentClass): void
|
||||
{
|
||||
if (! isset($mapping['inherited']) && ! $parentClass->isMappedSuperclass) {
|
||||
$mapping['inherited'] = $parentClass->name;
|
||||
}
|
||||
|
||||
if (! isset($mapping['declared'])) {
|
||||
$mapping['declared'] = $parentClass->name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds inherited fields to the subclass mapping.
|
||||
*/
|
||||
private function addInheritedFields(ClassMetadata $subClass, ClassMetadata $parentClass): void
|
||||
{
|
||||
foreach ($parentClass->fieldMappings as $mapping) {
|
||||
if (! isset($mapping['inherited']) && ! $parentClass->isMappedSuperclass) {
|
||||
$mapping['inherited'] = $parentClass->name;
|
||||
}
|
||||
|
||||
if (! isset($mapping['declared'])) {
|
||||
$mapping['declared'] = $parentClass->name;
|
||||
}
|
||||
|
||||
$this->addMappingInheritanceInformation($mapping, $parentClass);
|
||||
$subClass->addInheritedFieldMapping($mapping);
|
||||
}
|
||||
|
||||
@@ -441,14 +460,7 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
|
||||
private function addInheritedRelations(ClassMetadata $subClass, ClassMetadata $parentClass): void
|
||||
{
|
||||
foreach ($parentClass->associationMappings as $field => $mapping) {
|
||||
if (! isset($mapping['inherited']) && ! $parentClass->isMappedSuperclass) {
|
||||
$mapping['inherited'] = $parentClass->name;
|
||||
}
|
||||
|
||||
if (! isset($mapping['declared'])) {
|
||||
$mapping['declared'] = $parentClass->name;
|
||||
}
|
||||
|
||||
$this->addMappingInheritanceInformation($mapping, $parentClass);
|
||||
// When the class inheriting the relation ($subClass) is the first entity class since the
|
||||
// relation has been defined in a mapped superclass (or in a chain
|
||||
// of mapped superclasses) above, then declare this current entity class as the source of
|
||||
@@ -456,10 +468,6 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
|
||||
// According to the definitions given in https://github.com/doctrine/orm/pull/10396/,
|
||||
// this is the case <=> ! isset($mapping['inherited']).
|
||||
if (! isset($mapping['inherited'])) {
|
||||
if ($mapping['type'] & ClassMetadata::TO_MANY && ! $mapping['isOwningSide']) {
|
||||
throw MappingException::illegalToManyAssociationOnMappedSuperclass($parentClass->name, $field);
|
||||
}
|
||||
|
||||
$mapping['sourceEntity'] = $subClass->name;
|
||||
}
|
||||
|
||||
@@ -470,14 +478,7 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
|
||||
private function addInheritedEmbeddedClasses(ClassMetadata $subClass, ClassMetadata $parentClass): void
|
||||
{
|
||||
foreach ($parentClass->embeddedClasses as $field => $embeddedClass) {
|
||||
if (! isset($embeddedClass['inherited']) && ! $parentClass->isMappedSuperclass) {
|
||||
$embeddedClass['inherited'] = $parentClass->name;
|
||||
}
|
||||
|
||||
if (! isset($embeddedClass['declared'])) {
|
||||
$embeddedClass['declared'] = $parentClass->name;
|
||||
}
|
||||
|
||||
$this->addMappingInheritanceInformation($embeddedClass, $parentClass);
|
||||
$subClass->embeddedClasses[$field] = $embeddedClass;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,83 +68,11 @@ use const PHP_VERSION_ID;
|
||||
*
|
||||
* @template-covariant T of object
|
||||
* @template-implements ClassMetadata<T>
|
||||
* @psalm-type FieldMapping = array{
|
||||
* type: string,
|
||||
* fieldName: string,
|
||||
* columnName: string,
|
||||
* length?: int,
|
||||
* id?: bool,
|
||||
* nullable?: bool,
|
||||
* notInsertable?: bool,
|
||||
* notUpdatable?: bool,
|
||||
* generated?: int,
|
||||
* enumType?: class-string<BackedEnum>,
|
||||
* columnDefinition?: string,
|
||||
* precision?: int,
|
||||
* scale?: int,
|
||||
* unique?: bool,
|
||||
* inherited?: class-string,
|
||||
* originalClass?: class-string,
|
||||
* originalField?: string,
|
||||
* quoted?: bool,
|
||||
* requireSQLConversion?: bool,
|
||||
* declared?: class-string,
|
||||
* 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,
|
||||
* }
|
||||
* @psalm-type DiscriminatorColumnMapping = array{
|
||||
* name: string,
|
||||
* fieldName: string,
|
||||
* type: string,
|
||||
* length?: int,
|
||||
* columnDefinition?: string|null,
|
||||
* enumType?: class-string<BackedEnum>|null,
|
||||
* }
|
||||
* @psalm-import-type AssociationMapping from \Doctrine\ORM\Mapping\ClassMetadata
|
||||
* @psalm-import-type FieldMapping from \Doctrine\ORM\Mapping\ClassMetadata
|
||||
* @psalm-import-type EmbeddedClassMapping from \Doctrine\ORM\Mapping\ClassMetadata
|
||||
* @psalm-import-type JoinColumnData from \Doctrine\ORM\Mapping\ClassMetadata
|
||||
* @psalm-import-type DiscriminatorColumnMapping from \Doctrine\ORM\Mapping\ClassMetadata
|
||||
*/
|
||||
class ClassMetadataInfo implements ClassMetadata
|
||||
{
|
||||
@@ -170,6 +98,8 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
/**
|
||||
* TABLE_PER_CLASS means the class will be persisted according to the rules
|
||||
* of <tt>Concrete Table Inheritance</tt>.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public const INHERITANCE_TYPE_TABLE_PER_CLASS = 4;
|
||||
|
||||
@@ -390,7 +320,8 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
public $isEmbeddedClass = false;
|
||||
|
||||
/**
|
||||
* READ-ONLY: The names of the parent classes (ancestors).
|
||||
* READ-ONLY: The names of the parent <em>entity</em> classes (ancestors), starting with the
|
||||
* nearest one and ending with the root entity class.
|
||||
*
|
||||
* @psalm-var list<class-string>
|
||||
*/
|
||||
@@ -442,7 +373,7 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
* declared in another parent <em>entity or mapped superclass</em>. The value is the FQCN
|
||||
* of the topmost non-transient class that contains mapping information for this field.
|
||||
*
|
||||
* @psalm-var array<string, mixed[]>
|
||||
* @psalm-var array<string, EmbeddedClassMapping>
|
||||
*/
|
||||
public $embeddedClasses = [];
|
||||
|
||||
@@ -1166,6 +1097,7 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
|
||||
foreach ($this->embeddedClasses as $property => $embeddedClass) {
|
||||
if (isset($embeddedClass['declaredField'])) {
|
||||
assert($embeddedClass['originalField'] !== null);
|
||||
$childProperty = $this->getAccessibleProperty(
|
||||
$reflService,
|
||||
$this->embeddedClasses[$embeddedClass['declaredField']]['class'],
|
||||
@@ -1651,9 +1583,9 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
/**
|
||||
* Validates & completes the given field mapping based on typed property.
|
||||
*
|
||||
* @param array{fieldName: string, type?: mixed} $mapping The field mapping to validate & complete.
|
||||
* @param array{fieldName: string, type?: string} $mapping The field mapping to validate & complete.
|
||||
*
|
||||
* @return array{fieldName: string, enumType?: string, type?: mixed} The updated mapping.
|
||||
* @return array{fieldName: string, enumType?: class-string<BackedEnum>, type?: string} The updated mapping.
|
||||
*/
|
||||
private function validateAndCompleteTypedFieldMapping(array $mapping): array
|
||||
{
|
||||
@@ -1697,7 +1629,7 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
* enumType?: class-string,
|
||||
* } $mapping The field mapping to validate & complete.
|
||||
*
|
||||
* @return mixed[] The updated mapping.
|
||||
* @return FieldMapping The updated mapping.
|
||||
*
|
||||
* @throws MappingException
|
||||
*/
|
||||
@@ -1923,30 +1855,7 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
* @psalm-param array<string, mixed> $mapping The mapping to validate & complete.
|
||||
*
|
||||
* @return mixed[] The validated & completed mapping.
|
||||
* @psalm-return array{
|
||||
* mappedBy: mixed|null,
|
||||
* inversedBy: mixed|null,
|
||||
* isOwningSide: bool,
|
||||
* sourceEntity: class-string,
|
||||
* targetEntity: string,
|
||||
* fieldName: mixed,
|
||||
* fetch: mixed,
|
||||
* cascade: array<string>,
|
||||
* isCascadeRemove: bool,
|
||||
* isCascadePersist: bool,
|
||||
* isCascadeRefresh: bool,
|
||||
* isCascadeMerge: bool,
|
||||
* isCascadeDetach: bool,
|
||||
* type: int,
|
||||
* originalField: string,
|
||||
* originalClass: class-string,
|
||||
* joinColumns?: array{0: array{name: string, referencedColumnName: string}}|mixed,
|
||||
* id?: mixed,
|
||||
* sourceToTargetKeyColumns?: array<string, string>,
|
||||
* joinColumnFieldNames?: array<string, string>,
|
||||
* targetToSourceKeyColumns?: array<string, string>,
|
||||
* orphanRemoval: bool
|
||||
* }
|
||||
* @psalm-return AssociationMapping
|
||||
*
|
||||
* @throws RuntimeException
|
||||
* @throws MappingException
|
||||
@@ -1955,6 +1864,14 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
{
|
||||
$mapping = $this->_validateAndCompleteAssociationMapping($mapping);
|
||||
|
||||
if (isset($mapping['joinColumns']) && $mapping['joinColumns'] && ! $mapping['isOwningSide']) {
|
||||
Deprecation::trigger(
|
||||
'doctrine/orm',
|
||||
'https://github.com/doctrine/orm/pull/10654',
|
||||
'JoinColumn configuration is not allowed on the inverse side of one-to-one associations, and will throw a MappingException in Doctrine ORM 3.0'
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($mapping['joinColumns']) && $mapping['joinColumns']) {
|
||||
$mapping['isOwningSide'] = true;
|
||||
}
|
||||
@@ -2036,22 +1953,7 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
* @psalm-param array<string, mixed> $mapping The mapping to validate and complete.
|
||||
*
|
||||
* @return mixed[] The validated and completed mapping.
|
||||
* @psalm-return array{
|
||||
* mappedBy: mixed,
|
||||
* inversedBy: mixed,
|
||||
* isOwningSide: bool,
|
||||
* sourceEntity: string,
|
||||
* targetEntity: string,
|
||||
* fieldName: mixed,
|
||||
* fetch: int|mixed,
|
||||
* cascade: array<array-key,string>,
|
||||
* isCascadeRemove: bool,
|
||||
* isCascadePersist: bool,
|
||||
* isCascadeRefresh: bool,
|
||||
* isCascadeMerge: bool,
|
||||
* isCascadeDetach: bool,
|
||||
* orphanRemoval: bool
|
||||
* }
|
||||
* @psalm-return AssociationMapping
|
||||
*
|
||||
* @throws MappingException
|
||||
* @throws InvalidArgumentException
|
||||
@@ -2079,30 +1981,7 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
* @psalm-param array<string, mixed> $mapping The mapping to validate & complete.
|
||||
*
|
||||
* @return mixed[] The validated & completed mapping.
|
||||
* @psalm-return array{
|
||||
* mappedBy: mixed,
|
||||
* inversedBy: mixed,
|
||||
* isOwningSide: bool,
|
||||
* sourceEntity: class-string,
|
||||
* targetEntity: string,
|
||||
* fieldName: mixed,
|
||||
* fetch: mixed,
|
||||
* cascade: array<string>,
|
||||
* isCascadeRemove: bool,
|
||||
* isCascadePersist: bool,
|
||||
* isCascadeRefresh: bool,
|
||||
* isCascadeMerge: bool,
|
||||
* isCascadeDetach: bool,
|
||||
* type: int,
|
||||
* originalField: string,
|
||||
* originalClass: class-string,
|
||||
* joinTable?: array{inverseJoinColumns: mixed}|mixed,
|
||||
* joinTableColumns?: list<mixed>,
|
||||
* isOnDeleteCascade?: true,
|
||||
* relationToSourceKeyColumns?: array,
|
||||
* relationToTargetKeyColumns?: array,
|
||||
* orphanRemoval: bool
|
||||
* }
|
||||
* @psalm-return AssociationMapping
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
@@ -2375,11 +2254,19 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
/**
|
||||
* Checks whether the mapped class uses the TABLE_PER_CLASS inheritance mapping strategy.
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* @return bool TRUE if the class participates in a TABLE_PER_CLASS inheritance mapping,
|
||||
* FALSE otherwise.
|
||||
*/
|
||||
public function isInheritanceTypeTablePerClass()
|
||||
{
|
||||
Deprecation::triggerIfCalledFromOutside(
|
||||
'doctrine/orm',
|
||||
'https://github.com/doctrine/orm/pull/10414/',
|
||||
'Concrete table inheritance has never been implemented, and its stubs will be removed in Doctrine ORM 3.0 with no replacement'
|
||||
);
|
||||
|
||||
return $this->inheritanceType === self::INHERITANCE_TYPE_TABLE_PER_CLASS;
|
||||
}
|
||||
|
||||
@@ -2531,7 +2418,8 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the parent class names.
|
||||
* Sets the parent class names. Only <em>entity</em> classes may be given.
|
||||
*
|
||||
* Assumes that the class names in the passed array are in the order:
|
||||
* directParent -> directParentParent -> directParentParentParent ... -> root.
|
||||
*
|
||||
@@ -2585,12 +2473,16 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
|
||||
$mapping = $this->associationMappings[$fieldName];
|
||||
|
||||
//if (isset($mapping['inherited']) && (count($overrideMapping) !== 1 || ! isset($overrideMapping['fetch']))) {
|
||||
// TODO: Deprecate overriding the fetch mode via association override for 3.0,
|
||||
// users should do this with a listener and a custom attribute/annotation
|
||||
// TODO: Enable this exception in 2.8
|
||||
//throw MappingException::illegalOverrideOfInheritedProperty($this->name, $fieldName);
|
||||
//}
|
||||
if (isset($mapping['inherited'])) {
|
||||
Deprecation::trigger(
|
||||
'doctrine/orm',
|
||||
'https://github.com/doctrine/orm/pull/10470',
|
||||
'Overrides are only allowed for fields or associations declared in mapped superclasses or traits. This is not the case for %s::%s, which was inherited from %s. This is a misconfiguration and will be an error in Doctrine ORM 3.0.',
|
||||
$this->name,
|
||||
$fieldName,
|
||||
$mapping['inherited']
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($overrideMapping['joinColumns'])) {
|
||||
$mapping['joinColumns'] = $overrideMapping['joinColumns'];
|
||||
@@ -2650,10 +2542,17 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
|
||||
$mapping = $this->fieldMappings[$fieldName];
|
||||
|
||||
//if (isset($mapping['inherited'])) {
|
||||
// TODO: Enable this exception in 2.8
|
||||
if (isset($mapping['inherited'])) {
|
||||
Deprecation::trigger(
|
||||
'doctrine/orm',
|
||||
'https://github.com/doctrine/orm/pull/10470',
|
||||
'Overrides are only allowed for fields or associations declared in mapped superclasses or traits. This is not the case for %s::%s, which was inherited from %s. This is a misconfiguration and will be an error in Doctrine ORM 3.0.',
|
||||
$this->name,
|
||||
$fieldName,
|
||||
$mapping['inherited']
|
||||
);
|
||||
//throw MappingException::illegalOverrideOfInheritedProperty($this->name, $fieldName);
|
||||
//}
|
||||
}
|
||||
|
||||
if (isset($mapping['id'])) {
|
||||
$overrideMapping['id'] = $mapping['id'];
|
||||
@@ -2796,6 +2695,14 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
*/
|
||||
private function isInheritanceType(int $type): bool
|
||||
{
|
||||
if ($type === self::INHERITANCE_TYPE_TABLE_PER_CLASS) {
|
||||
Deprecation::trigger(
|
||||
'doctrine/orm',
|
||||
'https://github.com/doctrine/orm/pull/10414/',
|
||||
'Concrete table inheritance has never been implemented, and its stubs will be removed in Doctrine ORM 3.0 with no replacement'
|
||||
);
|
||||
}
|
||||
|
||||
return $type === self::INHERITANCE_TYPE_NONE ||
|
||||
$type === self::INHERITANCE_TYPE_SINGLE_TABLE ||
|
||||
$type === self::INHERITANCE_TYPE_JOINED ||
|
||||
@@ -2848,7 +2755,7 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
* Adds a field mapping without completing/validating it.
|
||||
* This is mainly used to add inherited field mappings to derived classes.
|
||||
*
|
||||
* @psalm-param array<string, mixed> $fieldMapping
|
||||
* @psalm-param FieldMapping $fieldMapping
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@@ -3084,7 +2991,7 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
/**
|
||||
* Stores the association mapping.
|
||||
*
|
||||
* @psalm-param array<string, mixed> $assocMapping
|
||||
* @psalm-param AssociationMapping $assocMapping
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
@@ -3236,7 +3143,7 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
* @see getDiscriminatorColumn()
|
||||
*
|
||||
* @param mixed[]|null $columnDef
|
||||
* @psalm-param array{name: string|null, fieldName?: string, type?: string, length?: int, columnDefinition?: string|null, enumType?: class-string<BackedEnum>|null}|null $columnDef
|
||||
* @psalm-param array{name: string|null, fieldName?: string, type?: string, length?: int, columnDefinition?: string|null, enumType?: class-string<BackedEnum>|null, options?: array<string, mixed>}|null $columnDef
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
@@ -3841,8 +3748,16 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
}
|
||||
}
|
||||
|
||||
if (! (isset($mapping['class']) && $mapping['class'])) {
|
||||
throw MappingException::missingEmbeddedClass($mapping['fieldName']);
|
||||
}
|
||||
|
||||
$fqcn = $this->fullyQualifiedClassName($mapping['class']);
|
||||
|
||||
assert($fqcn !== null);
|
||||
|
||||
$this->embeddedClasses[$mapping['fieldName']] = [
|
||||
'class' => $this->fullyQualifiedClassName($mapping['class']),
|
||||
'class' => $fqcn,
|
||||
'columnPrefix' => $mapping['columnPrefix'] ?? null,
|
||||
'declaredField' => $mapping['declaredField'] ?? null,
|
||||
'originalField' => $mapping['originalField'] ?? null,
|
||||
@@ -3934,7 +3849,7 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
return $sequencePrefix;
|
||||
}
|
||||
|
||||
/** @psalm-param array<string, mixed> $mapping */
|
||||
/** @psalm-param AssociationMapping $mapping */
|
||||
private function assertMappingOrderBy(array $mapping): void
|
||||
{
|
||||
if (isset($mapping['orderBy']) && ! is_array($mapping['orderBy'])) {
|
||||
@@ -3947,7 +3862,14 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
{
|
||||
$reflectionProperty = $reflService->getAccessibleProperty($class, $field);
|
||||
if ($reflectionProperty !== null && PHP_VERSION_ID >= 80100 && $reflectionProperty->isReadOnly()) {
|
||||
$reflectionProperty = new ReflectionReadonlyProperty($reflectionProperty);
|
||||
$declaringClass = $reflectionProperty->getDeclaringClass()->name;
|
||||
if ($declaringClass !== $class) {
|
||||
$reflectionProperty = $reflService->getAccessibleProperty($declaringClass, $field);
|
||||
}
|
||||
|
||||
if ($reflectionProperty !== null) {
|
||||
$reflectionProperty = new ReflectionReadonlyProperty($reflectionProperty);
|
||||
}
|
||||
}
|
||||
|
||||
return $reflectionProperty;
|
||||
|
||||
@@ -21,7 +21,7 @@ class DefaultEntityListenerResolver implements EntityListenerResolver
|
||||
private $instances = [];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function clear($className = null)
|
||||
{
|
||||
@@ -38,7 +38,7 @@ class DefaultEntityListenerResolver implements EntityListenerResolver
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function register($object)
|
||||
{
|
||||
@@ -50,7 +50,7 @@ class DefaultEntityListenerResolver implements EntityListenerResolver
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function resolve($className)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ use function substr;
|
||||
class DefaultNamingStrategy implements NamingStrategy
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function classToTableName($className)
|
||||
{
|
||||
@@ -29,7 +29,7 @@ class DefaultNamingStrategy implements NamingStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function propertyToColumnName($propertyName, $className = null)
|
||||
{
|
||||
@@ -37,7 +37,7 @@ class DefaultNamingStrategy implements NamingStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function embeddedFieldToColumnName($propertyName, $embeddedColumnName, $className = null, $embeddedClassName = null)
|
||||
{
|
||||
@@ -45,7 +45,7 @@ class DefaultNamingStrategy implements NamingStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function referenceColumnName()
|
||||
{
|
||||
@@ -53,7 +53,7 @@ class DefaultNamingStrategy implements NamingStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @param string $propertyName
|
||||
* @param class-string $className
|
||||
@@ -64,7 +64,7 @@ class DefaultNamingStrategy implements NamingStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function joinTableName($sourceEntity, $targetEntity, $propertyName = null)
|
||||
{
|
||||
@@ -73,7 +73,7 @@ class DefaultNamingStrategy implements NamingStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function joinKeyColumnName($entityName, $referencedColumnName = null)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ class DefaultQuoteStrategy implements QuoteStrategy
|
||||
use SQLResultCasing;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getColumnName($fieldName, ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
@@ -31,7 +31,7 @@ class DefaultQuoteStrategy implements QuoteStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @todo Table names should be computed in DBAL depending on the platform
|
||||
*/
|
||||
@@ -53,7 +53,7 @@ class DefaultQuoteStrategy implements QuoteStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSequenceName(array $definition, ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
@@ -63,7 +63,7 @@ class DefaultQuoteStrategy implements QuoteStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
@@ -73,7 +73,7 @@ class DefaultQuoteStrategy implements QuoteStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getReferencedJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
@@ -83,7 +83,7 @@ class DefaultQuoteStrategy implements QuoteStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getJoinTableName(array $association, ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
@@ -104,7 +104,7 @@ class DefaultQuoteStrategy implements QuoteStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getIdentifierColumnNames(ClassMetadata $class, AbstractPlatform $platform)
|
||||
{
|
||||
@@ -135,7 +135,7 @@ class DefaultQuoteStrategy implements QuoteStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getColumnAlias($columnName, $counter, AbstractPlatform $platform, ?ClassMetadata $class = null)
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ final class DefaultTypedFieldMapper implements TypedFieldMapper
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function validateAndComplete(array $mapping, ReflectionProperty $field): array
|
||||
{
|
||||
|
||||
@@ -45,18 +45,29 @@ final class DiscriminatorColumn implements MappingAttribute
|
||||
*/
|
||||
public $enumType = null;
|
||||
|
||||
/** @param class-string<\BackedEnum>|null $enumType */
|
||||
/**
|
||||
* @var array<string, mixed>
|
||||
* @readonly
|
||||
*/
|
||||
public $options = [];
|
||||
|
||||
/**
|
||||
* @param class-string<\BackedEnum>|null $enumType
|
||||
* @param array<string, mixed> $options
|
||||
*/
|
||||
public function __construct(
|
||||
?string $name = null,
|
||||
?string $type = null,
|
||||
?int $length = null,
|
||||
?string $columnDefinition = null,
|
||||
?string $enumType = null
|
||||
?string $enumType = null,
|
||||
array $options = []
|
||||
) {
|
||||
$this->name = $name;
|
||||
$this->type = $type;
|
||||
$this->length = $length;
|
||||
$this->columnDefinition = $columnDefinition;
|
||||
$this->enumType = $enumType;
|
||||
$this->options = $options;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,15 +313,19 @@ class AnnotationDriver extends CompatibilityAnnotationDriver
|
||||
$discrColumnAnnot = $classAnnotations[Mapping\DiscriminatorColumn::class];
|
||||
assert($discrColumnAnnot instanceof Mapping\DiscriminatorColumn);
|
||||
|
||||
$metadata->setDiscriminatorColumn(
|
||||
[
|
||||
'name' => $discrColumnAnnot->name,
|
||||
'type' => $discrColumnAnnot->type ?: 'string',
|
||||
'length' => $discrColumnAnnot->length ?? 255,
|
||||
'columnDefinition' => $discrColumnAnnot->columnDefinition,
|
||||
'enumType' => $discrColumnAnnot->enumType,
|
||||
]
|
||||
);
|
||||
$columnDef = [
|
||||
'name' => $discrColumnAnnot->name,
|
||||
'type' => $discrColumnAnnot->type ?: 'string',
|
||||
'length' => $discrColumnAnnot->length ?? 255,
|
||||
'columnDefinition' => $discrColumnAnnot->columnDefinition,
|
||||
'enumType' => $discrColumnAnnot->enumType,
|
||||
];
|
||||
|
||||
if ($discrColumnAnnot->options) {
|
||||
$columnDef['options'] = $discrColumnAnnot->options;
|
||||
}
|
||||
|
||||
$metadata->setDiscriminatorColumn($columnDef);
|
||||
} else {
|
||||
$metadata->setDiscriminatorColumn(['name' => 'dtype', 'type' => 'string', 'length' => 255]);
|
||||
}
|
||||
|
||||
@@ -265,15 +265,19 @@ class AttributeDriver extends CompatibilityAnnotationDriver
|
||||
if (isset($classAttributes[Mapping\DiscriminatorColumn::class])) {
|
||||
$discrColumnAttribute = $classAttributes[Mapping\DiscriminatorColumn::class];
|
||||
|
||||
$metadata->setDiscriminatorColumn(
|
||||
[
|
||||
'name' => isset($discrColumnAttribute->name) ? (string) $discrColumnAttribute->name : null,
|
||||
'type' => isset($discrColumnAttribute->type) ? (string) $discrColumnAttribute->type : 'string',
|
||||
'length' => isset($discrColumnAttribute->length) ? (int) $discrColumnAttribute->length : 255,
|
||||
'columnDefinition' => isset($discrColumnAttribute->columnDefinition) ? (string) $discrColumnAttribute->columnDefinition : null,
|
||||
'enumType' => isset($discrColumnAttribute->enumType) ? (string) $discrColumnAttribute->enumType : null,
|
||||
]
|
||||
);
|
||||
$columnDef = [
|
||||
'name' => isset($discrColumnAttribute->name) ? (string) $discrColumnAttribute->name : null,
|
||||
'type' => isset($discrColumnAttribute->type) ? (string) $discrColumnAttribute->type : 'string',
|
||||
'length' => isset($discrColumnAttribute->length) ? (int) $discrColumnAttribute->length : 255,
|
||||
'columnDefinition' => isset($discrColumnAttribute->columnDefinition) ? (string) $discrColumnAttribute->columnDefinition : null,
|
||||
'enumType' => isset($discrColumnAttribute->enumType) ? (string) $discrColumnAttribute->enumType : null,
|
||||
];
|
||||
|
||||
if ($discrColumnAttribute->options) {
|
||||
$columnDef['options'] = (array) $discrColumnAttribute->options;
|
||||
}
|
||||
|
||||
$metadata->setDiscriminatorColumn($columnDef);
|
||||
} else {
|
||||
$metadata->setDiscriminatorColumn(['name' => 'dtype', 'type' => 'string', 'length' => 255]);
|
||||
}
|
||||
@@ -433,6 +437,14 @@ class AttributeDriver extends CompatibilityAnnotationDriver
|
||||
if ($joinTableAttribute->options) {
|
||||
$joinTable['options'] = $joinTableAttribute->options;
|
||||
}
|
||||
|
||||
foreach ($joinTableAttribute->joinColumns as $joinColumn) {
|
||||
$joinTable['joinColumns'][] = $this->joinColumnToArray($joinColumn);
|
||||
}
|
||||
|
||||
foreach ($joinTableAttribute->inverseJoinColumns as $joinColumn) {
|
||||
$joinTable['inverseJoinColumns'][] = $this->joinColumnToArray($joinColumn);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->reader->getPropertyAttributeCollection($property, Mapping\JoinColumn::class) as $joinColumn) {
|
||||
|
||||
@@ -61,7 +61,7 @@ class DatabaseDriver implements MappingDriver
|
||||
private const JSON_ARRAY = 'json_array';
|
||||
|
||||
/** @var AbstractSchemaManager */
|
||||
private $_sm;
|
||||
private $sm;
|
||||
|
||||
/** @var array<string,Table>|null */
|
||||
private $tables = null;
|
||||
@@ -90,7 +90,7 @@ class DatabaseDriver implements MappingDriver
|
||||
|
||||
public function __construct(AbstractSchemaManager $schemaManager)
|
||||
{
|
||||
$this->_sm = $schemaManager;
|
||||
$this->sm = $schemaManager;
|
||||
$this->inflector = InflectorFactory::create()->build();
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ class DatabaseDriver implements MappingDriver
|
||||
|
||||
$this->tables = $this->manyToManyTables = $this->classToTableNames = [];
|
||||
|
||||
foreach ($this->_sm->listTables() as $table) {
|
||||
foreach ($this->sm->listTables() as $table) {
|
||||
$tableName = $table->getName();
|
||||
$foreignKeys = $table->getForeignKeys();
|
||||
|
||||
|
||||
@@ -204,15 +204,19 @@ class XmlDriver extends FileDriver
|
||||
// Evaluate <discriminator-column...>
|
||||
if (isset($xmlRoot->{'discriminator-column'})) {
|
||||
$discrColumn = $xmlRoot->{'discriminator-column'};
|
||||
$metadata->setDiscriminatorColumn(
|
||||
[
|
||||
'name' => isset($discrColumn['name']) ? (string) $discrColumn['name'] : null,
|
||||
'type' => isset($discrColumn['type']) ? (string) $discrColumn['type'] : 'string',
|
||||
'length' => isset($discrColumn['length']) ? (int) $discrColumn['length'] : 255,
|
||||
'columnDefinition' => isset($discrColumn['column-definition']) ? (string) $discrColumn['column-definition'] : null,
|
||||
'enumType' => isset($discrColumn['enum-type']) ? (string) $discrColumn['enum-type'] : null,
|
||||
]
|
||||
);
|
||||
$columnDef = [
|
||||
'name' => isset($discrColumn['name']) ? (string) $discrColumn['name'] : null,
|
||||
'type' => isset($discrColumn['type']) ? (string) $discrColumn['type'] : 'string',
|
||||
'length' => isset($discrColumn['length']) ? (int) $discrColumn['length'] : 255,
|
||||
'columnDefinition' => isset($discrColumn['column-definition']) ? (string) $discrColumn['column-definition'] : null,
|
||||
'enumType' => isset($discrColumn['enum-type']) ? (string) $discrColumn['enum-type'] : null,
|
||||
];
|
||||
|
||||
if (isset($discrColumn['options'])) {
|
||||
$columnDef['options'] = $this->parseOptions($discrColumn['options']->children());
|
||||
}
|
||||
|
||||
$metadata->setDiscriminatorColumn($columnDef);
|
||||
} else {
|
||||
$metadata->setDiscriminatorColumn(['name' => 'dtype', 'type' => 'string', 'length' => 255]);
|
||||
}
|
||||
@@ -985,6 +989,7 @@ class XmlDriver extends FileDriver
|
||||
$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));
|
||||
assert($xmlElement !== false);
|
||||
|
||||
if (isset($xmlElement->entity)) {
|
||||
foreach ($xmlElement->entity as $entityElement) {
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace Doctrine\ORM\Mapping;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\Deprecations\Deprecation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
@@ -28,6 +29,14 @@ final class InheritanceType implements MappingAttribute
|
||||
/** @psalm-param 'NONE'|'JOINED'|'SINGLE_TABLE'|'TABLE_PER_CLASS' $value */
|
||||
public function __construct(string $value)
|
||||
{
|
||||
if ($value === 'TABLE_PER_CLASS') {
|
||||
Deprecation::trigger(
|
||||
'doctrine/orm',
|
||||
'https://github.com/doctrine/orm/pull/10414/',
|
||||
'Concrete table inheritance has never been implemented, and its stubs will be removed in Doctrine ORM 3.0 with no replacement'
|
||||
);
|
||||
}
|
||||
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class MappingException extends ORMException
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $entityName
|
||||
* @param class-string $entityName
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
@@ -346,7 +346,7 @@ class MappingException extends ORMException
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param class-string $className
|
||||
*
|
||||
* @return MappingException
|
||||
*/
|
||||
@@ -908,8 +908,7 @@ class MappingException extends ORMException
|
||||
{
|
||||
return new self(
|
||||
sprintf(
|
||||
'Override for %s::%s is only allowed for attributes/associations ' .
|
||||
'declared on a mapped superclass or a trait.',
|
||||
'Overrides are only allowed for fields or associations declared in mapped superclasses or traits, which is not the case for %s::%s.',
|
||||
$className,
|
||||
$propertyName
|
||||
)
|
||||
|
||||
@@ -8,6 +8,9 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
|
||||
/**
|
||||
* A set of rules for determining the column, alias and table quotes.
|
||||
*
|
||||
* @psalm-import-type AssociationMapping from ClassMetadata
|
||||
* @psalm-import-type JoinColumnData from ClassMetadata
|
||||
*/
|
||||
interface QuoteStrategy
|
||||
{
|
||||
@@ -39,7 +42,7 @@ interface QuoteStrategy
|
||||
/**
|
||||
* Gets the (possibly quoted) name of the join table.
|
||||
*
|
||||
* @param mixed[] $association
|
||||
* @param AssociationMapping $association
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -48,7 +51,7 @@ interface QuoteStrategy
|
||||
/**
|
||||
* Gets the (possibly quoted) join column name.
|
||||
*
|
||||
* @param mixed[] $joinColumn
|
||||
* @param JoinColumnData $joinColumn
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -57,7 +60,7 @@ interface QuoteStrategy
|
||||
/**
|
||||
* Gets the (possibly quoted) join column name.
|
||||
*
|
||||
* @param mixed[] $joinColumn
|
||||
* @param JoinColumnData $joinColumn
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\ORM\Mapping;
|
||||
|
||||
use BackedEnum;
|
||||
use ReflectionProperty;
|
||||
|
||||
interface TypedFieldMapper
|
||||
@@ -11,9 +12,9 @@ interface TypedFieldMapper
|
||||
/**
|
||||
* Validates & completes the given field mapping based on typed property.
|
||||
*
|
||||
* @param array{fieldName: string, enumType?: string, type?: mixed} $mapping The field mapping to validate & complete.
|
||||
* @param array{fieldName: string, enumType?: class-string<BackedEnum>, type?: string} $mapping The field mapping to validate & complete.
|
||||
*
|
||||
* @return array{fieldName: string, enumType?: string, type?: mixed} The updated mapping.
|
||||
* @return array{fieldName: string, enumType?: class-string<BackedEnum>, type?: string} The updated mapping.
|
||||
*/
|
||||
public function validateAndComplete(array $mapping, ReflectionProperty $field): array;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class UnderscoreNamingStrategy implements NamingStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function classToTableName($className)
|
||||
{
|
||||
@@ -85,7 +85,7 @@ class UnderscoreNamingStrategy implements NamingStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function propertyToColumnName($propertyName, $className = null)
|
||||
{
|
||||
@@ -93,7 +93,7 @@ class UnderscoreNamingStrategy implements NamingStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function embeddedFieldToColumnName($propertyName, $embeddedColumnName, $className = null, $embeddedClassName = null)
|
||||
{
|
||||
@@ -101,7 +101,7 @@ class UnderscoreNamingStrategy implements NamingStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function referenceColumnName()
|
||||
{
|
||||
@@ -109,7 +109,7 @@ class UnderscoreNamingStrategy implements NamingStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @param string $propertyName
|
||||
* @param class-string $className
|
||||
@@ -120,7 +120,7 @@ class UnderscoreNamingStrategy implements NamingStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function joinTableName($sourceEntity, $targetEntity, $propertyName = null)
|
||||
{
|
||||
@@ -128,7 +128,7 @@ class UnderscoreNamingStrategy implements NamingStrategy
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function joinKeyColumnName($entityName, $referencedColumnName = null)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ final class NativeQuery extends AbstractQuery
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function _doExecute()
|
||||
{
|
||||
|
||||
@@ -22,6 +22,8 @@ use function sprintf;
|
||||
|
||||
/**
|
||||
* Contains exception messages for all invalid lifecycle state exceptions inside UnitOfWork
|
||||
*
|
||||
* @psalm-import-type AssociationMapping from ClassMetadata
|
||||
*/
|
||||
class ORMInvalidArgumentException extends InvalidArgumentException
|
||||
{
|
||||
@@ -80,8 +82,8 @@ class ORMInvalidArgumentException extends InvalidArgumentException
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array[][]|object[][] $newEntitiesWithAssociations non-empty an array
|
||||
* of [array $associationMapping, object $entity] pairs
|
||||
* @psalm-param non-empty-list<array{AssociationMapping, object}> $newEntitiesWithAssociations non-empty an array
|
||||
* of [array $associationMapping, object $entity] pairs
|
||||
*
|
||||
* @return ORMInvalidArgumentException
|
||||
*/
|
||||
@@ -109,7 +111,7 @@ class ORMInvalidArgumentException extends InvalidArgumentException
|
||||
|
||||
/**
|
||||
* @param object $entry
|
||||
* @psalm-param array<string, string> $associationMapping
|
||||
* @psalm-param AssociationMapping $associationMapping
|
||||
*
|
||||
* @return ORMInvalidArgumentException
|
||||
*/
|
||||
@@ -120,7 +122,7 @@ class ORMInvalidArgumentException extends InvalidArgumentException
|
||||
|
||||
/**
|
||||
* @param object $entry
|
||||
* @psalm-param array<string, string> $assoc
|
||||
* @psalm-param AssociationMapping $assoc
|
||||
*
|
||||
* @return ORMInvalidArgumentException
|
||||
*/
|
||||
@@ -220,8 +222,8 @@ EXCEPTION
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed[] $assoc
|
||||
* @param mixed $actualValue
|
||||
* @param AssociationMapping $assoc
|
||||
* @param mixed $actualValue
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
@@ -271,7 +273,7 @@ EXCEPTION
|
||||
|
||||
/**
|
||||
* @param object $entity
|
||||
* @psalm-param array<string,string> $associationMapping
|
||||
* @psalm-param AssociationMapping $associationMapping
|
||||
*/
|
||||
private static function newEntityFoundThroughRelationshipMessage(array $associationMapping, $entity): string
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@ use Doctrine\Common\Collections\Selectable;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use ReturnTypeWillChange;
|
||||
use RuntimeException;
|
||||
use UnexpectedValueException;
|
||||
|
||||
use function array_combine;
|
||||
use function array_diff_key;
|
||||
@@ -36,6 +37,7 @@ use function spl_object_id;
|
||||
* @psalm-template T
|
||||
* @template-extends AbstractLazyCollection<TKey,T>
|
||||
* @template-implements Selectable<TKey,T>
|
||||
* @psalm-import-type AssociationMapping from ClassMetadata
|
||||
*/
|
||||
final class PersistentCollection extends AbstractLazyCollection implements Selectable
|
||||
{
|
||||
@@ -58,7 +60,7 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
* The association mapping the collection belongs to.
|
||||
* This is currently either a OneToManyMapping or a ManyToManyMapping.
|
||||
*
|
||||
* @psalm-var array<string, mixed>|null
|
||||
* @psalm-var AssociationMapping|null
|
||||
*/
|
||||
private $association;
|
||||
|
||||
@@ -113,7 +115,7 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
* describes the association between the owner and the elements of the collection.
|
||||
*
|
||||
* @param object $entity
|
||||
* @psalm-param array<string, mixed> $assoc
|
||||
* @psalm-param AssociationMapping $assoc
|
||||
*/
|
||||
public function setOwner($entity, array $assoc): void
|
||||
{
|
||||
@@ -161,7 +163,7 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
|
||||
// If _backRefFieldName is set and its a one-to-many association,
|
||||
// we need to set the back reference.
|
||||
if ($this->backRefFieldName && $this->association['type'] === ClassMetadata::ONE_TO_MANY) {
|
||||
if ($this->backRefFieldName && $this->getMapping()['type'] === ClassMetadata::ONE_TO_MANY) {
|
||||
assert($this->typeClass !== null);
|
||||
// Set back reference to owner
|
||||
$this->typeClass->reflFields[$this->backRefFieldName]->setValue(
|
||||
@@ -190,7 +192,7 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
|
||||
// If _backRefFieldName is set, then the association is bidirectional
|
||||
// and we need to set the back reference.
|
||||
if ($this->backRefFieldName && $this->association['type'] === ClassMetadata::ONE_TO_MANY) {
|
||||
if ($this->backRefFieldName && $this->getMapping()['type'] === ClassMetadata::ONE_TO_MANY) {
|
||||
assert($this->typeClass !== null);
|
||||
// Set back reference to owner
|
||||
$this->typeClass->reflFields[$this->backRefFieldName]->setValue(
|
||||
@@ -271,10 +273,14 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
/**
|
||||
* INTERNAL: Gets the association mapping of the collection.
|
||||
*
|
||||
* @psalm-return array<string, mixed>|null
|
||||
* @psalm-return AssociationMapping
|
||||
*/
|
||||
public function getMapping(): ?array
|
||||
public function getMapping(): array
|
||||
{
|
||||
if ($this->association === null) {
|
||||
throw new UnexpectedValueException('The underlying association mapping is null although it should not be');
|
||||
}
|
||||
|
||||
return $this->association;
|
||||
}
|
||||
|
||||
@@ -291,8 +297,8 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
|
||||
if (
|
||||
$this->association !== null &&
|
||||
$this->association['isOwningSide'] &&
|
||||
$this->association['type'] === ClassMetadata::MANY_TO_MANY &&
|
||||
$this->getMapping()['isOwningSide'] &&
|
||||
$this->getMapping()['type'] === ClassMetadata::MANY_TO_MANY &&
|
||||
$this->owner &&
|
||||
$this->em !== null &&
|
||||
$this->em->getClassMetadata(get_class($this->owner))->isChangeTrackingNotify()
|
||||
@@ -333,7 +339,7 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function remove($key)
|
||||
{
|
||||
@@ -351,9 +357,9 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
|
||||
if (
|
||||
$this->association !== null &&
|
||||
$this->association['type'] & ClassMetadata::TO_MANY &&
|
||||
$this->getMapping()['type'] & ClassMetadata::TO_MANY &&
|
||||
$this->owner &&
|
||||
$this->association['orphanRemoval']
|
||||
$this->getMapping()['orphanRemoval']
|
||||
) {
|
||||
$this->getUnitOfWork()->scheduleOrphanRemoval($removed);
|
||||
}
|
||||
@@ -362,7 +368,7 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function removeElement($element): bool
|
||||
{
|
||||
@@ -376,9 +382,9 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
|
||||
if (
|
||||
$this->association !== null &&
|
||||
$this->association['type'] & ClassMetadata::TO_MANY &&
|
||||
$this->getMapping()['type'] & ClassMetadata::TO_MANY &&
|
||||
$this->owner &&
|
||||
$this->association['orphanRemoval']
|
||||
$this->getMapping()['orphanRemoval']
|
||||
) {
|
||||
$this->getUnitOfWork()->scheduleOrphanRemoval($element);
|
||||
}
|
||||
@@ -387,15 +393,15 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function containsKey($key): bool
|
||||
{
|
||||
if (
|
||||
! $this->initialized && $this->association['fetch'] === ClassMetadata::FETCH_EXTRA_LAZY
|
||||
&& isset($this->association['indexBy'])
|
||||
! $this->initialized && $this->getMapping()['fetch'] === ClassMetadata::FETCH_EXTRA_LAZY
|
||||
&& isset($this->getMapping()['indexBy'])
|
||||
) {
|
||||
$persister = $this->getUnitOfWork()->getCollectionPersister($this->association);
|
||||
$persister = $this->getUnitOfWork()->getCollectionPersister($this->getMapping());
|
||||
|
||||
return $this->unwrap()->containsKey($key) || $persister->containsKey($this, $key);
|
||||
}
|
||||
@@ -404,14 +410,14 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @template TMaybeContained
|
||||
*/
|
||||
public function contains($element): bool
|
||||
{
|
||||
if (! $this->initialized && $this->association['fetch'] === ClassMetadata::FETCH_EXTRA_LAZY) {
|
||||
$persister = $this->getUnitOfWork()->getCollectionPersister($this->association);
|
||||
if (! $this->initialized && $this->getMapping()['fetch'] === ClassMetadata::FETCH_EXTRA_LAZY) {
|
||||
$persister = $this->getUnitOfWork()->getCollectionPersister($this->getMapping());
|
||||
|
||||
return $this->unwrap()->contains($element) || $persister->contains($this, $element);
|
||||
}
|
||||
@@ -420,22 +426,22 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function get($key)
|
||||
{
|
||||
if (
|
||||
! $this->initialized
|
||||
&& $this->association['fetch'] === ClassMetadata::FETCH_EXTRA_LAZY
|
||||
&& isset($this->association['indexBy'])
|
||||
&& $this->getMapping()['fetch'] === ClassMetadata::FETCH_EXTRA_LAZY
|
||||
&& isset($this->getMapping()['indexBy'])
|
||||
) {
|
||||
assert($this->em !== null);
|
||||
assert($this->typeClass !== null);
|
||||
if (! $this->typeClass->isIdentifierComposite && $this->typeClass->isIdentifier($this->association['indexBy'])) {
|
||||
if (! $this->typeClass->isIdentifierComposite && $this->typeClass->isIdentifier($this->getMapping()['indexBy'])) {
|
||||
return $this->em->find($this->typeClass->name, $key);
|
||||
}
|
||||
|
||||
return $this->getUnitOfWork()->getCollectionPersister($this->association)->get($this, $key);
|
||||
return $this->getUnitOfWork()->getCollectionPersister($this->getMapping())->get($this, $key);
|
||||
}
|
||||
|
||||
return parent::get($key);
|
||||
@@ -443,7 +449,7 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
if (! $this->initialized && $this->association !== null && $this->association['fetch'] === ClassMetadata::FETCH_EXTRA_LAZY) {
|
||||
if (! $this->initialized && $this->association !== null && $this->getMapping()['fetch'] === ClassMetadata::FETCH_EXTRA_LAZY) {
|
||||
$persister = $this->getUnitOfWork()->getCollectionPersister($this->association);
|
||||
|
||||
return $persister->count($this) + ($this->isDirty ? $this->unwrap()->count() : 0);
|
||||
@@ -453,7 +459,7 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function set($key, $value): void
|
||||
{
|
||||
@@ -467,7 +473,7 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function add($value): bool
|
||||
{
|
||||
@@ -485,7 +491,7 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
/* ArrayAccess implementation */
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
@@ -493,7 +499,7 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
@@ -502,7 +508,7 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
@@ -516,7 +522,7 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @return object|null
|
||||
*/
|
||||
@@ -539,11 +545,12 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
return;
|
||||
}
|
||||
|
||||
$uow = $this->getUnitOfWork();
|
||||
$uow = $this->getUnitOfWork();
|
||||
$association = $this->getMapping();
|
||||
|
||||
if (
|
||||
$this->association['type'] & ClassMetadata::TO_MANY &&
|
||||
$this->association['orphanRemoval'] &&
|
||||
$association['type'] & ClassMetadata::TO_MANY &&
|
||||
$association['orphanRemoval'] &&
|
||||
$this->owner
|
||||
) {
|
||||
// we need to initialize here, as orphan removal acts like implicit cascadeRemove,
|
||||
@@ -559,7 +566,7 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
|
||||
$this->initialized = true; // direct call, {@link initialize()} is too expensive
|
||||
|
||||
if ($this->association['isOwningSide'] && $this->owner) {
|
||||
if ($association['isOwningSide'] && $this->owner) {
|
||||
$this->changed();
|
||||
|
||||
$uow->scheduleCollectionDeletion($this);
|
||||
@@ -598,8 +605,8 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
*/
|
||||
public function slice($offset, $length = null): array
|
||||
{
|
||||
if (! $this->initialized && ! $this->isDirty && $this->association['fetch'] === ClassMetadata::FETCH_EXTRA_LAZY) {
|
||||
$persister = $this->getUnitOfWork()->getCollectionPersister($this->association);
|
||||
if (! $this->initialized && ! $this->isDirty && $this->getMapping()['fetch'] === ClassMetadata::FETCH_EXTRA_LAZY) {
|
||||
$persister = $this->getUnitOfWork()->getCollectionPersister($this->getMapping());
|
||||
|
||||
return $persister->slice($this, $offset, $length);
|
||||
}
|
||||
@@ -650,8 +657,9 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
return $this->unwrap()->matching($criteria);
|
||||
}
|
||||
|
||||
if ($this->association['type'] === ClassMetadata::MANY_TO_MANY) {
|
||||
$persister = $this->getUnitOfWork()->getCollectionPersister($this->association);
|
||||
$association = $this->getMapping();
|
||||
if ($association['type'] === ClassMetadata::MANY_TO_MANY) {
|
||||
$persister = $this->getUnitOfWork()->getCollectionPersister($association);
|
||||
|
||||
return new ArrayCollection($persister->loadCriteria($this, $criteria));
|
||||
}
|
||||
@@ -663,11 +671,11 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
|
||||
$criteria = clone $criteria;
|
||||
$criteria->where($expression);
|
||||
$criteria->orderBy($criteria->getOrderings() ?: $this->association['orderBy'] ?? []);
|
||||
$criteria->orderBy($criteria->getOrderings() ?: $association['orderBy'] ?? []);
|
||||
|
||||
$persister = $this->getUnitOfWork()->getEntityPersister($this->association['targetEntity']);
|
||||
$persister = $this->getUnitOfWork()->getEntityPersister($association['targetEntity']);
|
||||
|
||||
return $this->association['fetch'] === ClassMetadata::FETCH_EXTRA_LAZY
|
||||
return $association['fetch'] === ClassMetadata::FETCH_EXTRA_LAZY
|
||||
? new LazyCriteriaCollection($persister, $criteria)
|
||||
: new ArrayCollection($persister->loadCriteria($criteria));
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace Doctrine\ORM\Persisters\Collection;
|
||||
|
||||
use BadMethodCallException;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Doctrine\Common\Collections\Expr\Comparison;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Doctrine\ORM\PersistentCollection;
|
||||
@@ -24,11 +25,13 @@ use function sprintf;
|
||||
|
||||
/**
|
||||
* Persister for many-to-many collections.
|
||||
*
|
||||
* @psalm-import-type AssociationMapping from ClassMetadata
|
||||
*/
|
||||
class ManyToManyPersister extends AbstractCollectionPersister
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function delete(PersistentCollection $collection)
|
||||
{
|
||||
@@ -49,7 +52,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function update(PersistentCollection $collection)
|
||||
{
|
||||
@@ -80,7 +83,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function get(PersistentCollection $collection, $index)
|
||||
{
|
||||
@@ -99,7 +102,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function count(PersistentCollection $collection)
|
||||
{
|
||||
@@ -169,7 +172,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function containsKey(PersistentCollection $collection, $key)
|
||||
{
|
||||
@@ -246,10 +249,15 @@ class ManyToManyPersister extends AbstractCollectionPersister
|
||||
foreach ($parameters as $parameter) {
|
||||
[$name, $value, $operator] = $parameter;
|
||||
|
||||
$field = $this->quoteStrategy->getColumnName($name, $targetClass, $this->platform);
|
||||
$whereClauses[] = sprintf('te.%s %s ?', $field, $operator);
|
||||
$params[] = $value;
|
||||
$paramTypes[] = PersisterHelper::getTypeOfField($name, $targetClass, $this->em)[0];
|
||||
$field = $this->quoteStrategy->getColumnName($name, $targetClass, $this->platform);
|
||||
|
||||
if ($value === null && ($operator === Comparison::EQ || $operator === Comparison::NEQ)) {
|
||||
$whereClauses[] = sprintf('te.%s %s NULL', $field, $operator === Comparison::EQ ? 'IS' : 'IS NOT');
|
||||
} else {
|
||||
$whereClauses[] = sprintf('te.%s %s ?', $field, $operator);
|
||||
$params[] = $value;
|
||||
$paramTypes[] = PersisterHelper::getTypeOfField($name, $targetClass, $this->em)[0];
|
||||
}
|
||||
}
|
||||
|
||||
$tableName = $this->quoteStrategy->getTableName($targetClass, $this->platform);
|
||||
@@ -286,7 +294,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
|
||||
* JOIN.
|
||||
*
|
||||
* @param mixed[] $mapping Array containing mapping information.
|
||||
* @psalm-param array<string, mixed> $mapping
|
||||
* @psalm-param AssociationMapping $mapping
|
||||
*
|
||||
* @return string[] ordered tuple:
|
||||
* - JOIN condition to add to the SQL
|
||||
@@ -339,7 +347,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
|
||||
* Generate ON condition
|
||||
*
|
||||
* @param mixed[] $mapping
|
||||
* @psalm-param array<string, mixed> $mapping
|
||||
* @psalm-param AssociationMapping $mapping
|
||||
*
|
||||
* @return string[]
|
||||
* @psalm-return list<string>
|
||||
|
||||
@@ -24,7 +24,7 @@ use function is_string;
|
||||
class OneToManyPersister extends AbstractCollectionPersister
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
@@ -50,7 +50,7 @@ class OneToManyPersister extends AbstractCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function update(PersistentCollection $collection)
|
||||
{
|
||||
@@ -61,7 +61,7 @@ class OneToManyPersister extends AbstractCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function get(PersistentCollection $collection, $index)
|
||||
{
|
||||
@@ -87,7 +87,7 @@ class OneToManyPersister extends AbstractCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function count(PersistentCollection $collection)
|
||||
{
|
||||
@@ -103,7 +103,7 @@ class OneToManyPersister extends AbstractCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function slice(PersistentCollection $collection, $offset, $length = null)
|
||||
{
|
||||
@@ -114,7 +114,7 @@ class OneToManyPersister extends AbstractCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function containsKey(PersistentCollection $collection, $key)
|
||||
{
|
||||
@@ -138,7 +138,7 @@ class OneToManyPersister extends AbstractCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function contains(PersistentCollection $collection, $element)
|
||||
{
|
||||
@@ -158,7 +158,7 @@ class OneToManyPersister extends AbstractCollectionPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function loadCriteria(PersistentCollection $collection, Criteria $criteria)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ use function sprintf;
|
||||
abstract class AbstractEntityInheritancePersister extends BasicEntityPersister
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function prepareInsertData($entity)
|
||||
{
|
||||
@@ -39,7 +39,7 @@ abstract class AbstractEntityInheritancePersister extends BasicEntityPersister
|
||||
abstract protected function getDiscriminatorColumnTableName();
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getSelectColumnSQL($field, ClassMetadata $class, $alias = 'r')
|
||||
{
|
||||
|
||||
@@ -87,6 +87,8 @@ use function trim;
|
||||
*
|
||||
* Subclasses can be created to provide custom persisting and querying strategies,
|
||||
* i.e. spanning multiple tables.
|
||||
*
|
||||
* @psalm-import-type AssociationMapping from ClassMetadata
|
||||
*/
|
||||
class BasicEntityPersister implements EntityPersister
|
||||
{
|
||||
@@ -217,7 +219,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getClassMetadata()
|
||||
{
|
||||
@@ -225,7 +227,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getResultSetMapping()
|
||||
{
|
||||
@@ -233,7 +235,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function addInsert($entity)
|
||||
{
|
||||
@@ -241,7 +243,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getInserts()
|
||||
{
|
||||
@@ -249,7 +251,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function executeInserts()
|
||||
{
|
||||
@@ -271,6 +273,10 @@ class BasicEntityPersister implements EntityPersister
|
||||
$paramIndex = 1;
|
||||
|
||||
foreach ($insertData[$tableName] as $column => $value) {
|
||||
if ($value instanceof BackedEnum) {
|
||||
$value = $value->value;
|
||||
}
|
||||
|
||||
$stmt->bindValue($paramIndex++, $value, $this->columnTypes[$column]);
|
||||
}
|
||||
}
|
||||
@@ -386,7 +392,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function update($entity)
|
||||
{
|
||||
@@ -587,7 +593,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function delete($entity)
|
||||
{
|
||||
@@ -731,7 +737,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getOwningTable($fieldName)
|
||||
{
|
||||
@@ -739,7 +745,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function load(array $criteria, $entity = null, $assoc = null, array $hints = [], $lockMode = null, $limit = null, ?array $orderBy = null)
|
||||
{
|
||||
@@ -761,7 +767,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function loadById(array $identifier, $entity = null)
|
||||
{
|
||||
@@ -769,7 +775,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function loadOneToOneEntity(array $assoc, $sourceEntity, array $identifier = [])
|
||||
{
|
||||
@@ -829,7 +835,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function refresh(array $id, $entity, $lockMode = null)
|
||||
{
|
||||
@@ -856,7 +862,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function loadCriteria(Criteria $criteria)
|
||||
{
|
||||
@@ -874,7 +880,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function expandCriteriaParameters(Criteria $criteria)
|
||||
{
|
||||
@@ -890,22 +896,24 @@ class BasicEntityPersister implements EntityPersister
|
||||
|
||||
$valueVisitor->dispatch($expression);
|
||||
|
||||
[$params, $types] = $valueVisitor->getParamsAndTypes();
|
||||
|
||||
foreach ($params as $param) {
|
||||
$sqlParams = array_merge($sqlParams, $this->getValues($param));
|
||||
}
|
||||
[, $types] = $valueVisitor->getParamsAndTypes();
|
||||
|
||||
foreach ($types as $type) {
|
||||
[$field, $value] = $type;
|
||||
$sqlTypes = array_merge($sqlTypes, $this->getTypes($field, $value, $this->class));
|
||||
[$field, $value, $operator] = $type;
|
||||
|
||||
if ($value === null && ($operator === Comparison::EQ || $operator === Comparison::NEQ)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$sqlParams = array_merge($sqlParams, $this->getValues($value));
|
||||
$sqlTypes = array_merge($sqlTypes, $this->getTypes($field, $value, $this->class));
|
||||
}
|
||||
|
||||
return [$sqlParams, $sqlTypes];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function loadAll(array $criteria = [], ?array $orderBy = null, $limit = null, $offset = null)
|
||||
{
|
||||
@@ -921,7 +929,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getManyToManyCollection(array $assoc, $sourceEntity, $offset = null, $limit = null)
|
||||
{
|
||||
@@ -979,7 +987,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function loadManyToManyCollection(array $assoc, $sourceEntity, PersistentCollection $collection)
|
||||
{
|
||||
@@ -1065,7 +1073,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSelectSQL($criteria, $assoc = null, $lockMode = null, $limit = null, $offset = null, ?array $orderBy = null)
|
||||
{
|
||||
@@ -1332,9 +1340,9 @@ class BasicEntityPersister implements EntityPersister
|
||||
/**
|
||||
* Gets the SQL join fragment used when selecting entities from an association.
|
||||
*
|
||||
* @param string $field
|
||||
* @param mixed[] $assoc
|
||||
* @param string $alias
|
||||
* @param string $field
|
||||
* @param AssociationMapping $assoc
|
||||
* @param string $alias
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -1366,7 +1374,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
* Gets the SQL join fragment used when selecting entities from a
|
||||
* many-to-many association.
|
||||
*
|
||||
* @psalm-param array<string, mixed> $manyToMany
|
||||
* @psalm-param AssociationMapping $manyToMany
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -1396,7 +1404,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getInsertSQL()
|
||||
{
|
||||
@@ -1546,7 +1554,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function lock(array $criteria, $lockMode)
|
||||
{
|
||||
@@ -1623,7 +1631,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSelectConditionStatementSQL($field, $value, $assoc = null, $comparison = null)
|
||||
{
|
||||
@@ -1694,7 +1702,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
/**
|
||||
* Builds the left-hand-side of a where condition statement.
|
||||
*
|
||||
* @psalm-param array<string, mixed>|null $assoc
|
||||
* @psalm-param AssociationMapping|null $assoc
|
||||
*
|
||||
* @return string[]
|
||||
* @psalm-return list<string>
|
||||
@@ -1767,7 +1775,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
* Subclasses are supposed to override this method if they intend to change
|
||||
* or alter the criteria by which entities are selected.
|
||||
*
|
||||
* @param mixed[]|null $assoc
|
||||
* @param AssociationMapping|null $assoc
|
||||
* @psalm-param array<string, mixed> $criteria
|
||||
* @psalm-param array<string, mixed>|null $assoc
|
||||
*
|
||||
@@ -1785,7 +1793,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getOneToManyCollection(array $assoc, $sourceEntity, $offset = null, $limit = null)
|
||||
{
|
||||
@@ -1797,7 +1805,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function loadOneToManyCollection(array $assoc, $sourceEntity, PersistentCollection $collection)
|
||||
{
|
||||
@@ -1810,7 +1818,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
* Builds criteria and execute SQL statement to fetch the one to many entities from.
|
||||
*
|
||||
* @param object $sourceEntity
|
||||
* @psalm-param array<string, mixed> $assoc
|
||||
* @psalm-param AssociationMapping $assoc
|
||||
*/
|
||||
private function getOneToManyStatement(
|
||||
array $assoc,
|
||||
@@ -1864,7 +1872,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function expandParameters($criteria)
|
||||
{
|
||||
@@ -2027,7 +2035,7 @@ class BasicEntityPersister implements EntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function exists($entity, ?Criteria $extraConditions = null)
|
||||
{
|
||||
|
||||
@@ -14,6 +14,8 @@ use Doctrine\ORM\Query\ResultSetMapping;
|
||||
/**
|
||||
* Entity persister interface
|
||||
* Define the behavior that should be implemented by all entity persisters.
|
||||
*
|
||||
* @psalm-import-type AssociationMapping from ClassMetadata
|
||||
*/
|
||||
interface EntityPersister
|
||||
{
|
||||
@@ -48,11 +50,11 @@ interface EntityPersister
|
||||
* Gets the SELECT SQL to select one or more entities by a set of field criteria.
|
||||
*
|
||||
* @param mixed[]|Criteria $criteria
|
||||
* @param mixed[]|null $assoc
|
||||
* @param int|null $lockMode
|
||||
* @param int|null $limit
|
||||
* @param int|null $offset
|
||||
* @param mixed[]|null $orderBy
|
||||
* @psalm-param AssociationMapping|null $assoc
|
||||
* @psalm-param LockMode::*|null $lockMode
|
||||
*
|
||||
* @return string
|
||||
@@ -87,11 +89,10 @@ interface EntityPersister
|
||||
/**
|
||||
* Gets the SQL WHERE condition for matching a field with a given value.
|
||||
*
|
||||
* @param string $field
|
||||
* @param mixed $value
|
||||
* @param mixed[]|null $assoc
|
||||
* @param string|null $comparison
|
||||
* @psalm-param array<string, mixed>|null $assoc
|
||||
* @param string $field
|
||||
* @param mixed $value
|
||||
* @param AssociationMapping|null $assoc
|
||||
* @param string|null $comparison
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -171,19 +172,18 @@ interface EntityPersister
|
||||
/**
|
||||
* Loads an entity by a list of field criteria.
|
||||
*
|
||||
* @param mixed[] $criteria The criteria by which to load the entity.
|
||||
* @param object|null $entity The entity to load the data into. If not specified,
|
||||
* a new entity is created.
|
||||
* @param mixed[]|null $assoc The association that connects the entity
|
||||
* to load to another entity, if any.
|
||||
* @param mixed[] $hints Hints for entity creation.
|
||||
* @param int|null $lockMode One of the \Doctrine\DBAL\LockMode::* constants
|
||||
* or NULL if no specific lock mode should be used
|
||||
* for loading the entity.
|
||||
* @param int|null $limit Limit number of results.
|
||||
* @param string[]|null $orderBy Criteria to order by.
|
||||
* @param mixed[] $criteria The criteria by which to load the entity.
|
||||
* @param object|null $entity The entity to load the data into. If not specified,
|
||||
* a new entity is created.
|
||||
* @param AssociationMapping|null $assoc The association that connects the entity
|
||||
* to load to another entity, if any.
|
||||
* @param mixed[] $hints Hints for entity creation.
|
||||
* @param int|null $lockMode One of the \Doctrine\DBAL\LockMode::* constants
|
||||
* or NULL if no specific lock mode should be used
|
||||
* for loading the entity.
|
||||
* @param int|null $limit Limit number of results.
|
||||
* @param string[]|null $orderBy Criteria to order by.
|
||||
* @psalm-param array<string, mixed> $criteria
|
||||
* @psalm-param array<string, mixed>|null $assoc
|
||||
* @psalm-param array<string, mixed> $hints
|
||||
* @psalm-param LockMode::*|null $lockMode
|
||||
* @psalm-param array<string, string>|null $orderBy
|
||||
@@ -222,7 +222,7 @@ interface EntityPersister
|
||||
* @psalm-param array<string, mixed> $identifier The identifier of the entity to load. Must be provided if
|
||||
* the association to load represents the owning side, otherwise
|
||||
* the identifier is derived from the $sourceEntity.
|
||||
* @psalm-param array<string, mixed> $assoc The association to load.
|
||||
* @psalm-param AssociationMapping $assoc The association to load.
|
||||
*
|
||||
* @return object The loaded and managed entity instance or NULL if the entity can not be found.
|
||||
*
|
||||
@@ -269,7 +269,7 @@ interface EntityPersister
|
||||
* @param object $sourceEntity
|
||||
* @param int|null $offset
|
||||
* @param int|null $limit
|
||||
* @psalm-param array<string, mixed> $assoc
|
||||
* @psalm-param AssociationMapping $assoc
|
||||
*
|
||||
* @return mixed[]
|
||||
*/
|
||||
@@ -280,7 +280,7 @@ interface EntityPersister
|
||||
*
|
||||
* @param object $sourceEntity The entity that owns the collection.
|
||||
* @param PersistentCollection $collection The collection to fill.
|
||||
* @psalm-param array<string, mixed> $assoc The association mapping of the association being loaded.
|
||||
* @psalm-param AssociationMapping $assoc The association mapping of the association being loaded.
|
||||
*
|
||||
* @return mixed[]
|
||||
*/
|
||||
@@ -291,7 +291,7 @@ interface EntityPersister
|
||||
*
|
||||
* @param object $sourceEntity
|
||||
* @param PersistentCollection $collection The collection to load/fill.
|
||||
* @psalm-param array<string, mixed> $assoc
|
||||
* @psalm-param AssociationMapping $assoc
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
@@ -314,7 +314,7 @@ interface EntityPersister
|
||||
* @param object $sourceEntity
|
||||
* @param int|null $offset
|
||||
* @param int|null $limit
|
||||
* @psalm-param array<string, mixed> $assoc
|
||||
* @psalm-param AssociationMapping $assoc
|
||||
*
|
||||
* @return mixed[]
|
||||
*/
|
||||
|
||||
@@ -41,7 +41,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
|
||||
private $quotedTableMap = [];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getDiscriminatorColumnTableName()
|
||||
{
|
||||
@@ -104,7 +104,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function executeInserts()
|
||||
{
|
||||
@@ -199,7 +199,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function update($entity)
|
||||
{
|
||||
@@ -237,7 +237,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function delete($entity)
|
||||
{
|
||||
@@ -275,7 +275,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSelectSQL($criteria, $assoc = null, $lockMode = null, $limit = null, $offset = null, ?array $orderBy = null)
|
||||
{
|
||||
@@ -369,7 +369,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getLockTablesSql($lockMode)
|
||||
{
|
||||
@@ -498,7 +498,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getInsertColumnList()
|
||||
{
|
||||
@@ -543,7 +543,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function assignDefaultVersionAndUpsertableValues($entity, array $id)
|
||||
{
|
||||
|
||||
@@ -10,6 +10,9 @@ use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Doctrine\ORM\Utility\PersisterHelper;
|
||||
|
||||
use function array_flip;
|
||||
use function array_intersect;
|
||||
use function array_map;
|
||||
use function array_unshift;
|
||||
use function implode;
|
||||
|
||||
/**
|
||||
@@ -23,7 +26,7 @@ class SingleTablePersister extends AbstractEntityInheritancePersister
|
||||
use SQLResultCasing;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getDiscriminatorColumnTableName()
|
||||
{
|
||||
@@ -31,7 +34,7 @@ class SingleTablePersister extends AbstractEntityInheritancePersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getSelectColumnsSQL()
|
||||
{
|
||||
@@ -94,7 +97,7 @@ class SingleTablePersister extends AbstractEntityInheritancePersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getInsertColumnList()
|
||||
{
|
||||
@@ -107,7 +110,7 @@ class SingleTablePersister extends AbstractEntityInheritancePersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getSQLTableAlias($className, $assocName = '')
|
||||
{
|
||||
@@ -115,7 +118,7 @@ class SingleTablePersister extends AbstractEntityInheritancePersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getSelectConditionSQL(array $criteria, $assoc = null)
|
||||
{
|
||||
@@ -129,7 +132,7 @@ class SingleTablePersister extends AbstractEntityInheritancePersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getSelectConditionCriteriaSQL(Criteria $criteria)
|
||||
{
|
||||
@@ -145,16 +148,13 @@ class SingleTablePersister extends AbstractEntityInheritancePersister
|
||||
/** @return string */
|
||||
protected function getSelectConditionDiscriminatorValueSQL()
|
||||
{
|
||||
$values = [];
|
||||
$values = array_map(
|
||||
[$this->conn, 'quote'],
|
||||
array_flip(array_intersect($this->class->discriminatorMap, $this->class->subClasses))
|
||||
);
|
||||
|
||||
if ($this->class->discriminatorValue !== null) { // discriminators can be 0
|
||||
$values[] = $this->conn->quote($this->class->discriminatorValue);
|
||||
}
|
||||
|
||||
$discrValues = array_flip($this->class->discriminatorMap);
|
||||
|
||||
foreach ($this->class->subClasses as $subclassName) {
|
||||
$values[] = $this->conn->quote($discrValues[$subclassName]);
|
||||
array_unshift($values, $this->conn->quote($this->class->discriminatorValue));
|
||||
}
|
||||
|
||||
$discColumnName = $this->class->getDiscriminatorColumn()['name'];
|
||||
@@ -166,7 +166,7 @@ class SingleTablePersister extends AbstractEntityInheritancePersister
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function generateFilterConditionSQL(ClassMetadata $targetEntity, $targetTableAlias)
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@ use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Doctrine\ORM\Persisters\Entity\BasicEntityPersister;
|
||||
use RuntimeException;
|
||||
|
||||
use function defined;
|
||||
use function implode;
|
||||
use function in_array;
|
||||
use function is_object;
|
||||
@@ -81,6 +82,11 @@ class SqlExpressionVisitor extends ExpressionVisitor
|
||||
return '(' . implode(' OR ', $expressionList) . ')';
|
||||
|
||||
default:
|
||||
// Multiversion support for `doctrine/collections` before and after v2.1.0
|
||||
if (defined(CompositeExpression::class . '::TYPE_NOT') && $expr->getType() === CompositeExpression::TYPE_NOT) {
|
||||
return 'NOT (' . $expressionList[0] . ')';
|
||||
}
|
||||
|
||||
throw new RuntimeException('Unknown composite ' . $expr->getType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,18 +27,10 @@ class SqlValueVisitor extends ExpressionVisitor
|
||||
*/
|
||||
public function walkComparison(Comparison $comparison)
|
||||
{
|
||||
$value = $this->getValueFromComparison($comparison);
|
||||
$field = $comparison->getField();
|
||||
$operator = $comparison->getOperator();
|
||||
|
||||
if (($operator === Comparison::EQ || $operator === Comparison::IS) && $value === null) {
|
||||
return null;
|
||||
} elseif ($operator === Comparison::NEQ && $value === null) {
|
||||
return null;
|
||||
}
|
||||
$value = $this->getValueFromComparison($comparison);
|
||||
|
||||
$this->values[] = $value;
|
||||
$this->types[] = [$field, $value, $operator];
|
||||
$this->types[] = [$comparison->getField(), $value, $comparison->getOperator()];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ final class Query extends AbstractQuery
|
||||
* @var int
|
||||
* @psalm-var self::STATE_*
|
||||
*/
|
||||
private $_state = self::STATE_DIRTY;
|
||||
private $state = self::STATE_DIRTY;
|
||||
|
||||
/**
|
||||
* A snapshot of the parameter types the query was parsed with.
|
||||
@@ -210,7 +210,7 @@ final class Query extends AbstractQuery
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @return ResultSetMapping
|
||||
*/
|
||||
@@ -239,11 +239,11 @@ final class Query extends AbstractQuery
|
||||
}
|
||||
|
||||
// Return previous parser result if the query and the filter collection are both clean
|
||||
if ($this->_state === self::STATE_CLEAN && $this->parsedTypes === $types && $this->_em->isFiltersStateClean()) {
|
||||
if ($this->state === self::STATE_CLEAN && $this->parsedTypes === $types && $this->_em->isFiltersStateClean()) {
|
||||
return $this->parserResult;
|
||||
}
|
||||
|
||||
$this->_state = self::STATE_CLEAN;
|
||||
$this->state = self::STATE_CLEAN;
|
||||
$this->parsedTypes = $types;
|
||||
|
||||
$queryCache = $this->queryCache ?? $this->_em->getConfiguration()->getQueryCache();
|
||||
@@ -279,7 +279,7 @@ final class Query extends AbstractQuery
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function _doExecute()
|
||||
{
|
||||
@@ -586,8 +586,8 @@ final class Query extends AbstractQuery
|
||||
{
|
||||
parent::free();
|
||||
|
||||
$this->dql = null;
|
||||
$this->_state = self::STATE_CLEAN;
|
||||
$this->dql = null;
|
||||
$this->state = self::STATE_CLEAN;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -608,8 +608,8 @@ final class Query extends AbstractQuery
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->dql = $dqlQuery;
|
||||
$this->_state = self::STATE_DIRTY;
|
||||
$this->dql = $dqlQuery;
|
||||
$this->state = self::STATE_DIRTY;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -635,7 +635,7 @@ final class Query extends AbstractQuery
|
||||
*/
|
||||
public function getState(): int
|
||||
{
|
||||
return $this->_state;
|
||||
return $this->state;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -670,18 +670,18 @@ final class Query extends AbstractQuery
|
||||
}
|
||||
|
||||
$this->firstResult = $firstResult;
|
||||
$this->_state = self::STATE_DIRTY;
|
||||
$this->state = self::STATE_DIRTY;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the position of the first result the query object was set to retrieve (the "offset").
|
||||
* Returns NULL if {@link setFirstResult} was not applied to this query.
|
||||
* Returns 0 if {@link setFirstResult} was not applied to this query.
|
||||
*
|
||||
* @return int|null The position of the first result.
|
||||
* @return int The position of the first result.
|
||||
*/
|
||||
public function getFirstResult(): ?int
|
||||
public function getFirstResult(): int
|
||||
{
|
||||
return $this->firstResult;
|
||||
}
|
||||
@@ -700,7 +700,7 @@ final class Query extends AbstractQuery
|
||||
}
|
||||
|
||||
$this->maxResults = $maxResults;
|
||||
$this->_state = self::STATE_DIRTY;
|
||||
$this->state = self::STATE_DIRTY;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -743,21 +743,21 @@ final class Query extends AbstractQuery
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setHint($name, $value): self
|
||||
{
|
||||
$this->_state = self::STATE_DIRTY;
|
||||
$this->state = self::STATE_DIRTY;
|
||||
|
||||
return parent::setHint($name, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setHydrationMode($hydrationMode): self
|
||||
{
|
||||
$this->_state = self::STATE_DIRTY;
|
||||
$this->state = self::STATE_DIRTY;
|
||||
|
||||
return parent::setHydrationMode($hydrationMode);
|
||||
}
|
||||
@@ -831,6 +831,6 @@ final class Query extends AbstractQuery
|
||||
{
|
||||
parent::__clone();
|
||||
|
||||
$this->_state = self::STATE_DIRTY;
|
||||
$this->state = self::STATE_DIRTY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class AggregateExpression extends Node
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function dispatch($walker)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ class ArithmeticExpression extends Node
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function dispatch($walker)
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ class ArithmeticFactor extends Node
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ class ArithmeticTerm extends Node
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ class BetweenExpression extends Node
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ class CoalesceExpression extends Node
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ class CollectionMemberExpression extends Node
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function dispatch($walker)
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ class ComparisonExpression extends Node
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ class ConditionalExpression extends Node
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ class ConditionalFactor extends Node
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ class ConditionalPrimary extends Node
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ class ConditionalTerm extends Node
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ class DeleteClause extends Node
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ class DeleteStatement extends Node
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ class EmptyCollectionComparisonExpression extends Node
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function dispatch($sqlWalker)
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user