Compare commits

...

76 Commits

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

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

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

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

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

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

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

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

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

* Remove extra argument

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

* Specify what concrete class is passed

This is important as the signature of the concrete classes don't
necessarily match the one of the interface. Here, an extra argument that
is only defined in the classes is used.
2022-05-10 00:32:30 +02:00
Alexander M. Turek 07ee555279 Exclude /ci from distribution packages (#9732) 2022-05-06 13:07:36 +02:00
Alexander M. Turek 8291a7f09b Allow doctrine/deprecations 1.0 (#9723) 2022-05-02 21:10:07 +02:00
Grégoire Paris 26e274e373 Merge pull request #9708 from michnovka/2.12.x-fix-psalm-repository 2022-05-02 15:26:47 +02:00
Alexander M. Turek 5209184a60 Psalm 4.23, PHPStan 1.6.3 (#9718) 2022-05-02 11:07:33 +02:00
Sergei Morozov 23f54885bc Merge pull request #9706 from morozov/cleanup-test-entity-manager
Remove unused OrmTestCase::getTestEntityManager() parameters
2022-05-01 11:43:07 -07:00
Sergei Morozov 7f29b576d8 Remove some ConnectionMock methods (#9707) 2022-05-01 17:52:10 +02:00
Tomas a8425a5248 Fix psalm annotation 2022-05-01 16:40:44 +02:00
Pierre B 86ce0e5e35 Update ClassMetadataInfo::table definition (#9703)
Everything except the name key might be undefined when accessing to this public property, for instance in a LoadMetadataEvent

Co-authored-by: Pierre Bourdet <pbourdet@worldia.com>
2022-05-01 09:40:00 +02:00
Sergei Morozov 39fd5f4d46 Remove unused OrmTestCase::getTestEntityManager() parameters 2022-04-30 12:35:05 -07:00
Thomas Landauer a9309d748b Add missing use statement (#9699) 2022-04-30 08:04:44 +02:00
Grégoire Paris fe09af6df1 Merge pull request #9701 from doctrine/2.11.x
2.11.x
2022-04-29 22:45:58 +02:00
Grégoire Paris ed50e3d967 Merge pull request #9698 from ThomasLandauer/patch-8 2022-04-29 16:33:49 +02:00
Thomas Landauer 1d59e46245 use valid link syntax 2022-04-29 16:25:10 +02:00
Grégoire Paris a0a0b0e476 Merge pull request #9692 from greg0ire/reference-cmi-even-less
Use ClassMetadata over ClassMetadataInfo in tests
2022-04-28 23:07:56 +02:00
Grégoire Paris 0078a67786 Use ClassMetadata over ClassMetadataInfo in tests
ClassMetadataInfo is deprecated in favor of ClassMetadata.
2022-04-28 21:40:23 +02:00
Grégoire Paris 38d1124be9 Merge pull request #9691 from greg0ire/reference-cmi-less
Reference ClassMetadaInfo less
2022-04-28 07:58:51 +02:00
Grégoire Paris e9d3c218ef Remove explanation about inexistent distinction
ClassMetadataInfo used to be useful during entity generation, because it
allowed the entity not to exist. We no longer do entity generation, and
even if we did, the reflection methods have been moved to
ClassMetadataInfo as of 76e4f5a80b .
2022-04-27 23:28:58 +02:00
Grégoire Paris 6d2ca8fe40 Address mapping driver extraction
This documentation must be very old because this is no longer valid as
of e9e36dcf32 . The interface and abstract
file driver have since then been moved to doctrine/common, and the to
doctrine/persistence.
2022-04-27 23:28:43 +02:00
Grégoire Paris a06011daf3 Refer to ClassMetadata instead of ClassMetadataInfo
Although properties and methods are currently located in
ClassMetadataInfo, it is better to refer to ClassMetadata as the former
is deprecated in favor of the latter.
2022-04-27 23:28:40 +02:00
Alexander M. Turek 0846b8b102 PHPStan 1.6.1 (#9688) 2022-04-26 23:52:07 +02:00
Simon Podlipsky 1dd2b44982 Drop SymfonyStyle[listing] for sqls (#9679)
This was super annoying as UpdateCommand printed sqls prefixed with `*` so it was not possible to copy statements anymore without manually removing those asterisks.

This removes prefixing sqls and makes it consistent with Create and Drop commands.
2022-04-26 15:33:18 +02:00
Alexander M. Turek d9508e97df Remove dynamic property declarations (#9683) 2022-04-26 11:10:50 +02:00
Alexander M. Turek 534ed9c3c2 PHPStan 1.6.0 (#9682) 2022-04-26 11:01:11 +02:00
Grégoire Paris a552df66a9 Merge pull request #9677 from greg0ire/assert-drivers-are-orm-specific
Document ORM drivers only really load ORM metadata
2022-04-24 20:55:13 +02:00
Grégoire Paris 85238d4d98 Document ORM drivers only really load ORM metadata 2022-04-24 20:05:37 +02:00
Fran Moreno b7e9dd023c Fix HydrationException::invalidDiscriminatorValue parameter type (#9676) 2022-04-24 19:32:57 +02:00
Fran Moreno 1ac05f5e4e Fix type on ClassMetadata discriminatorMap (#9675) 2022-04-24 17:52:28 +02:00
264 changed files with 1681 additions and 2408 deletions
+12 -6
View File
@@ -12,21 +12,27 @@
"upcoming": true
},
{
"name": "2.12",
"branchName": "2.12.x",
"slug": "2.12",
"name": "2.13",
"branchName": "2.13.x",
"slug": "2.13",
"upcoming": true
},
{
"name": "2.11",
"branchName": "2.11.x",
"slug": "2.11",
"name": "2.12",
"branchName": "2.12.x",
"slug": "2.12",
"current": true,
"aliases": [
"current",
"stable"
]
},
{
"name": "2.11",
"branchName": "2.11.x",
"slug": "2.11",
"maintained": false
},
{
"name": "2.10",
"branchName": "2.10.x",
+3 -2
View File
@@ -1,7 +1,8 @@
/.github export-ignore
/ci export-ignore
/docs export-ignore
/tests export-ignore
/tools export-ignore
/docs export-ignore
/.github export-ignore
.doctrine-project.json export-ignore
.gitattributes export-ignore
.gitignore export-ignore
@@ -31,6 +31,8 @@ jobs:
dbal-version: "2.13"
- php-version: "8.1"
dbal-version: "3@dev"
- php-version: "8.2"
dbal-version: "3@dev"
steps:
- name: "Checkout"
@@ -52,6 +54,8 @@ jobs:
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
composer-options: "--ignore-platform-req=php+"
- name: "Run PHPUnit"
run: "vendor/bin/phpunit -c ci/github/phpunit/sqlite.xml --coverage-clover=coverage-no-cache.xml"
@@ -88,6 +92,9 @@ jobs:
- php-version: "8.0"
dbal-version: "2.13"
postgres-version: "14"
- php-version: "8.2"
dbal-version: "3@dev"
postgres-version: "14"
services:
postgres:
@@ -120,6 +127,8 @@ jobs:
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
composer-options: "--ignore-platform-req=php+"
- name: "Run PHPUnit"
run: "vendor/bin/phpunit -c ci/github/phpunit/pdo_pgsql.xml --coverage-clover=coverage.xml"
@@ -152,6 +161,14 @@ jobs:
dbal-version: "2.13"
mariadb-version: "10.6"
extension: "pdo_mysql"
- php-version: "8.2"
dbal-version: "3@dev"
mariadb-version: "10.6"
extension: "pdo_mysql"
- php-version: "8.2"
dbal-version: "3@dev"
mariadb-version: "10.6"
extension: "mysqli"
services:
mariadb:
@@ -186,6 +203,8 @@ jobs:
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
composer-options: "--ignore-platform-req=php+"
- name: "Run PHPUnit"
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --coverage-clover=coverage.xml"
@@ -219,6 +238,14 @@ jobs:
dbal-version: "2.13"
mysql-version: "8.0"
extension: "pdo_mysql"
- php-version: "8.2"
dbal-version: "3@dev"
mysql-version: "8.0"
extension: "mysqli"
- php-version: "8.2"
dbal-version: "3@dev"
mysql-version: "8.0"
extension: "pdo_mysql"
services:
mysql:
@@ -252,6 +279,8 @@ jobs:
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
composer-options: "--ignore-platform-req=php+"
- name: "Run PHPUnit"
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --coverage-clover=coverage-no-cache.xml"
+8 -8
View File
@@ -1,11 +1,11 @@
| [3.0.x][3.0] | [2.12.x][2.12] | [2.11.x][2.11] |
| [3.0.x][3.0] | [2.13.x][2.13] | [2.12.x][2.12] |
|:----------------:|:----------------:|:----------:|
| [![Build status][3.0 image]][3.0] | [![Build status][2.12 image]][2.12] | [![Build status][2.11 image]][2.11] |
| [![Coverage Status][3.0 coverage image]][3.0 coverage]| [![Coverage Status][2.12 coverage image]][2.12 coverage] | [![Coverage Status][2.11 coverage image]][2.11 coverage] |
| [![Build status][3.0 image]][3.0] | [![Build status][2.13 image]][2.13] | [![Build status][2.12 image]][2.12] |
| [![Coverage Status][3.0 coverage image]][3.0 coverage]| [![Coverage Status][2.13 coverage image]][2.13 coverage] | [![Coverage Status][2.12 coverage image]][2.12 coverage] |
[<h1 align="center">🇺🇦 UKRAINE NEEDS YOUR HELP NOW!</h1>](https://www.doctrine-project.org/stop-war.html)
Doctrine 2 is an object-relational mapper (ORM) for PHP 7.1+ that provides transparent persistence
Doctrine ORM is an object-relational mapper for PHP 7.1+ that provides transparent persistence
for PHP objects. It sits on top of a powerful database abstraction layer (DBAL). One of its key features
is the option to write database queries in a proprietary object oriented SQL dialect called Doctrine Query Language (DQL),
inspired by Hibernate's HQL. This provides developers with a powerful alternative to SQL that maintains flexibility
@@ -22,11 +22,11 @@ without requiring unnecessary code duplication.
[3.0]: https://github.com/doctrine/orm/tree/3.0.x
[3.0 coverage image]: https://codecov.io/gh/doctrine/orm/branch/3.0.x/graph/badge.svg
[3.0 coverage]: https://codecov.io/gh/doctrine/orm/branch/3.0.x
[2.13 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.13.x
[2.13]: https://github.com/doctrine/orm/tree/2.13.x
[2.13 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.13.x/graph/badge.svg
[2.13 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.13.x
[2.12 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.12.x
[2.12]: https://github.com/doctrine/orm/tree/2.12.x
[2.12 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.12.x/graph/badge.svg
[2.12 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.12.x
[2.11 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.11.x
[2.11]: https://github.com/doctrine/orm/tree/2.11.x
[2.11 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.11.x/graph/badge.svg
[2.11 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.11.x
+5 -5
View File
@@ -27,7 +27,7 @@
"doctrine/collections": "^1.5",
"doctrine/common": "^3.0.3",
"doctrine/dbal": "^2.13.1 || ^3.2",
"doctrine/deprecations": "^0.5.3",
"doctrine/deprecations": "^0.5.3 || ^1",
"doctrine/event-manager": "^1.1",
"doctrine/inflector": "^1.4 || ^2.0",
"doctrine/instantiator": "^1.3",
@@ -42,13 +42,13 @@
"doctrine/annotations": "^1.13",
"doctrine/coding-standard": "^9.0",
"phpbench/phpbench": "^0.16.10 || ^1.0",
"phpstan/phpstan": "~1.4.10 || 1.5.0",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.4",
"phpstan/phpstan": "~1.4.10 || 1.8.2",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"psr/log": "^1 || ^2 || ^3",
"squizlabs/php_codesniffer": "3.6.2",
"squizlabs/php_codesniffer": "3.7.1",
"symfony/cache": "^4.4 || ^5.4 || ^6.0",
"symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0",
"vimeo/psalm": "4.22.0"
"vimeo/psalm": "4.26.0"
},
"conflict": {
"doctrine/annotations": "<1.13 || >= 2.0"
+1 -1
View File
@@ -47,7 +47,7 @@ appropriate autoloaders.
}
foreach ($classMetadata->getAssociationMappings() as $fieldName => $mapping) {
if ($mapping['type'] == \Doctrine\ORM\Mapping\ClassMetadataInfo::MANY_TO_MANY && $mapping['isOwningSide']) {
if ($mapping['type'] == \Doctrine\ORM\Mapping\ClassMetadata::MANY_TO_MANY && $mapping['isOwningSide']) {
$mappedTableName = $mapping['joinTable']['name'];
$classMetadata->associationMappings[$fieldName]['joinTable']['name'] = $this->prefix . $mappedTableName;
}
+36 -13
View File
@@ -79,7 +79,9 @@ array of events it should be subscribed to.
.. code-block:: php
<?php
class TestEventSubscriber implements \Doctrine\Common\EventSubscriber
use Doctrine\Common\EventSubscriber;
class TestEventSubscriber implements EventSubscriber
{
public $preFooInvoked = false;
@@ -211,7 +213,6 @@ specific to a particular entity class's lifecycle.
.. code-block:: attribute
<?php
use Doctrine\DBAL\Types\Types;
use Doctrine\Persistence\Event\LifecycleEventArgs;
@@ -245,7 +246,6 @@ specific to a particular entity class's lifecycle.
.. code-block:: annotation
<?php
use Doctrine\Persistence\Event\LifecycleEventArgs;
/**
@@ -504,7 +504,6 @@ result in an infinite loop.
.. code-block:: php
<?php
use Doctrine\ORM\Event\PreFlushEventArgs;
class PreFlushExampleListener
@@ -590,7 +589,6 @@ This event is not a lifecycle callback.
.. code-block:: php
<?php
use Doctrine\ORM\Event\PostFlushEventArgs;
class PostFlushExampleListener
@@ -615,7 +613,7 @@ Changes to associations of the updated entity are never allowed in
this event, since Doctrine cannot guarantee to correctly handle
referential integrity at this point of the flush operation. This
event has a powerful feature however, it is executed with a
`_PreUpdateEventArgs`_ instance, which contains a reference to the
`PreUpdateEventArgs`_ instance, which contains a reference to the
computed change-set of this entity.
This means you have access to all the fields that have changed for
@@ -637,6 +635,8 @@ A simple example for this event looks like:
.. code-block:: php
<?php
use Doctrine\ORM\Event\PreUpdateEventArgs;
class NeverAliceOnlyBobListener
{
public function preUpdate(PreUpdateEventArgs $eventArgs)
@@ -644,6 +644,9 @@ A simple example for this event looks like:
if ($eventArgs->getEntity() instanceof User) {
if ($eventArgs->hasChangedField('name') && $eventArgs->getNewValue('name') == 'Alice') {
$eventArgs->setNewValue('name', 'Bob');
// The following will only work if `status` is already present in the computed changeset.
// Otherwise it will throw an InvalidArgumentException:
$eventArgs->setNewValue('status', 'active');
}
}
}
@@ -656,6 +659,8 @@ lifecycle callback when there are expensive validations to call:
.. code-block:: php
<?php
use Doctrine\ORM\Event\PreUpdateEventArgs;
class ValidCreditCardListener
{
public function preUpdate(PreUpdateEventArgs $eventArgs)
@@ -807,6 +812,8 @@ An ``Entity Listener`` could be any class, by default it should be a class with
.. code-block:: php
<?php
use Doctrine\ORM\Event\PreUpdateEventArgs;
class UserListener
{
public function preUpdate(User $user, PreUpdateEventArgs $event)
@@ -823,6 +830,10 @@ you need to map the listener method using the event type mapping:
.. code-block:: php
<?php
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\PreUpdateEventArgs;
use Doctrine\ORM\Event\PreFlushEventArgs;
class UserListener
{
/** @PrePersist */
@@ -907,6 +918,8 @@ Specifying an entity listener instance :
.. code-block:: php
<?php
use Doctrine\ORM\Event\PreUpdateEventArgs;
// User.php
/** @Entity @EntityListeners({"UserListener"}) */
@@ -933,12 +946,14 @@ Specifying an entity listener instance :
$listener = $container->get('user_listener');
$em->getConfiguration()->getEntityListenerResolver()->register($listener);
Implementing your own resolver :
Implementing your own resolver:
.. code-block:: php
<?php
class MyEntityListenerResolver extends \Doctrine\ORM\Mapping\DefaultEntityListenerResolver
use Doctrine\ORM\Mapping\DefaultEntityListenerResolver;
class MyEntityListenerResolver extends DefaultEntityListenerResolver
{
public function __construct($container)
{
@@ -972,13 +987,15 @@ This event is not a lifecycle callback.
.. code-block:: php
<?php
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
$test = new TestEventListener();
$evm = $em->getEventManager();
$evm->addEventListener(Doctrine\ORM\Events::loadClassMetadata, $test);
class TestEventListener
{
public function loadClassMetadata(\Doctrine\ORM\Event\LoadClassMetadataEventArgs $eventArgs)
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
{
$classMetadata = $eventArgs->getClassMetadata();
$fieldMapping = array(
@@ -1011,13 +1028,16 @@ instance and class metadata.
.. code-block:: php
<?php
use Doctrine\ORM\Tools\ToolEvents;
use Doctrine\ORM\Tools\Event\GenerateSchemaTableEventArgs;
$test = new TestEventListener();
$evm = $em->getEventManager();
$evm->addEventListener(\Doctrine\ORM\Tools\ToolEvents::postGenerateSchemaTable, $test);
$evm->addEventListener(ToolEvents::postGenerateSchemaTable, $test);
class TestEventListener
{
public function postGenerateSchemaTable(\Doctrine\ORM\Tools\Event\GenerateSchemaTableEventArgs $eventArgs)
public function postGenerateSchemaTable(GenerateSchemaTableEventArgs $eventArgs)
{
$classMetadata = $eventArgs->getClassMetadata();
$schema = $eventArgs->getSchema();
@@ -1035,13 +1055,16 @@ and the EntityManager.
.. code-block:: php
<?php
use Doctrine\ORM\Tools\ToolEvents;
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
$test = new TestEventListener();
$evm = $em->getEventManager();
$evm->addEventListener(\Doctrine\ORM\Tools\ToolEvents::postGenerateSchema, $test);
$evm->addEventListener(ToolEvents::postGenerateSchema, $test);
class TestEventListener
{
public function postGenerateSchema(\Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs $eventArgs)
public function postGenerateSchema(GenerateSchemaEventArgs $eventArgs)
{
$schema = $eventArgs->getSchema();
$em = $eventArgs->getEntityManager();
+48 -42
View File
@@ -55,51 +55,66 @@ Implementing Metadata Drivers
In addition to the included metadata drivers you can very easily
implement your own. All you need to do is define a class which
implements the ``Driver`` interface:
implements the ``MappingDriver`` interface:
.. code-block:: php
<?php
namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
interface Driver
declare(strict_types=1);
namespace Doctrine\Persistence\Mapping\Driver;
use Doctrine\Persistence\Mapping\ClassMetadata;
/**
* Contract for metadata drivers.
*/
interface MappingDriver
{
/**
* Loads the metadata for the specified class into the provided container.
*
* @param string $className
* @param ClassMetadataInfo $metadata
*
* @psalm-param class-string<T> $className
* @psalm-param ClassMetadata<T> $metadata
*
* @return void
*
* @template T of object
*/
function loadMetadataForClass($className, ClassMetadataInfo $metadata);
public function loadMetadataForClass(string $className, ClassMetadata $metadata);
/**
* Gets the names of all mapped classes known to this driver.
*
* @return array The names of all mapped classes known to this driver.
*/
function getAllClassNames();
/**
* Whether the class with the specified name should have its metadata loaded.
* This is only the case if it is either mapped as an Entity or a
* MappedSuperclass.
*
* @param string $className
* @return boolean
* @return array<int, string> The names of all mapped classes known to this driver.
* @psalm-return list<class-string>
*/
function isTransient($className);
public function getAllClassNames();
/**
* Returns whether the class with the specified name should have its metadata loaded.
* This is only the case if it is either mapped as an Entity or a MappedSuperclass.
*
* @psalm-param class-string $className
*
* @return bool
*/
public function isTransient(string $className);
}
If you want to write a metadata driver to parse information from
some file format we've made your life a little easier by providing
the ``AbstractFileDriver`` implementation for you to extend from:
the ``FileDriver`` implementation for you to extend from:
.. code-block:: php
<?php
class MyMetadataDriver extends AbstractFileDriver
use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\Persistence\Mapping\Driver\FileDriver;
class MyMetadataDriver extends FileDriver
{
/**
* {@inheritdoc}
@@ -109,11 +124,11 @@ the ``AbstractFileDriver`` implementation for you to extend from:
/**
* {@inheritdoc}
*/
public function loadMetadataForClass($className, ClassMetadataInfo $metadata)
public function loadMetadataForClass($className, ClassMetadata $metadata)
{
$data = $this->_loadMappingFile($file);
// populate ClassMetadataInfo instance from $data
// populate ClassMetadata instance from $data
}
/**
@@ -127,13 +142,12 @@ the ``AbstractFileDriver`` implementation for you to extend from:
.. note::
When using the ``AbstractFileDriver`` it requires that you
only have one entity defined per file and the file named after the
class described inside where namespace separators are replaced by
periods. So if you have an entity named ``Entities\User`` and you
wanted to write a mapping file for your driver above you would need
to name the file ``Entities.User.dcm.ext`` for it to be
recognized.
When using the ``FileDriver`` it requires that you only have one
entity defined per file and the file named after the class described
inside where namespace separators are replaced by periods. So if you
have an entity named ``Entities\User`` and you wanted to write a
mapping file for your driver above you would need to name the file
``Entities.User.dcm.ext`` for it to be recognized.
Now you can use your ``MyMetadataDriver`` implementation by setting
@@ -156,14 +170,6 @@ entity when needed.
You have all the methods you need to manually specify the mapping
information instead of using some mapping file to populate it from.
The base ``ClassMetadataInfo`` class is responsible for only data
storage and is not meant for runtime use. It does not require that
the class actually exists yet so it is useful for describing some
entity before it exists and using that information to generate for
example the entities themselves. The class ``ClassMetadata``
extends ``ClassMetadataInfo`` and adds some functionality required
for runtime usage and requires that the PHP class is present and
can be autoloaded.
You can read more about the API of the ``ClassMetadata`` classes in
the PHP Mapping chapter.
+11 -12
View File
@@ -96,6 +96,8 @@ For this you just need to use the ``StaticPHPDriver``:
.. code-block:: php
<?php
use Doctrine\Persistence\Mapping\Driver\StaticPHPDriver;
$driver = new StaticPHPDriver('/path/to/entities');
$em->getConfiguration()->setMetadataDriverImpl($driver);
@@ -185,13 +187,12 @@ It also has several methods that create builders (which are necessary for advanc
- ``createManyToMany($name, $targetEntity)`` returns an ``ManyToManyAssociationBuilder`` instance
- ``createOneToMany($name, $targetEntity)`` returns an ``OneToManyAssociationBuilder`` instance
ClassMetadataInfo API
---------------------
ClassMetadata API
-----------------
The ``ClassMetadataInfo`` class is the base data object for storing
the mapping metadata for a single entity. It contains all the
getters and setters you need populate and retrieve information for
an entity.
The ``ClassMetadata`` class is the data object for storing the mapping
metadata for a single entity. It contains all the getters and setters
you need populate and retrieve information for an entity.
General Setters
~~~~~~~~~~~~~~~
@@ -309,13 +310,11 @@ Lifecycle Callback Getters
- ``hasLifecycleCallbacks($lifecycleEvent)``
- ``getLifecycleCallbacks($event)``
ClassMetadata API
-----------------
Runtime reflection methods
~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``ClassMetadata`` class extends ``ClassMetadataInfo`` and adds
the runtime functionality required by Doctrine. It adds a few extra
methods related to runtime reflection for working with the entities
themselves.
These are methods related to runtime reflection for working with the
entities themselves.
- ``getReflectionClass()``
+6 -6
View File
@@ -149,7 +149,7 @@ When using the SchemaTool class directly, create your schema using
the ``createSchema()`` method. First create an instance of the
``SchemaTool`` and pass it an instance of the ``EntityManager``
that you want to use to create the schema. This method receives an
array of ``ClassMetadataInfo`` instances.
array of ``ClassMetadata`` instances.
.. code-block:: php
@@ -180,8 +180,8 @@ tables of the current model to clean up with orphaned tables.
You can also use database introspection to update your schema
easily with the ``updateSchema()`` method. It will compare your
existing database schema to the passed array of
``ClassMetadataInfo`` instances.
existing database schema to the passed array of ``ClassMetadata``
instances.
.. code-block:: php
@@ -324,9 +324,9 @@ convert to and the path to generate it:
Reverse Engineering
-------------------
You can use the ``DatabaseDriver`` to reverse engineer a database
to an array of ``ClassMetadataInfo`` instances and generate YAML,
XML, etc. from them.
You can use the ``DatabaseDriver`` to reverse engineer a database to an
array of ``ClassMetadata`` instances and generate YAML, XML, etc. from
them.
.. note::
+9 -7
View File
@@ -36,6 +36,7 @@ use function is_array;
use function is_numeric;
use function is_object;
use function is_scalar;
use function is_string;
use function iterator_count;
use function iterator_to_array;
use function ksort;
@@ -196,7 +197,7 @@ abstract class AbstractQuery
}
/**
* @return bool TRUE if the query results are enable for second level cache, FALSE otherwise.
* @return bool TRUE if the query results are enabled for second level cache, FALSE otherwise.
*/
public function isCacheable()
{
@@ -282,7 +283,7 @@ abstract class AbstractQuery
* The returned SQL syntax depends on the connection driver that is used
* by this query object at the time of this method call.
*
* @return string SQL query
* @return list<string>|string SQL query
*/
abstract public function getSQL();
@@ -353,7 +354,6 @@ abstract class AbstractQuery
*/
public function setParameters($parameters)
{
// BC compatibility with 2.3-
if (is_array($parameters)) {
/** @psalm-var ArrayCollection<int, Parameter> $parameterCollection */
$parameterCollection = new ArrayCollection();
@@ -401,8 +401,8 @@ abstract class AbstractQuery
*
* @param mixed $value
*
* @return mixed[]|string|int|float|bool
* @psalm-return array|scalar
* @return mixed[]|string|int|float|bool|object|null
* @psalm-return array|scalar|object|null
*
* @throws ORMInvalidArgumentException
*/
@@ -1302,7 +1302,8 @@ abstract class AbstractQuery
$parameters[$parameter->getName()] = $this->processParameterValue($parameter->getValue());
}
$sql = $this->getSQL();
$sql = $this->getSQL();
assert(is_string($sql));
$queryCacheProfile = $this->getHydrationCacheProfile();
$hints = $this->getHints();
$hints['hydrationMode'] = $this->getHydrationMode();
@@ -1374,7 +1375,8 @@ abstract class AbstractQuery
*/
protected function getHash()
{
$query = $this->getSQL();
$query = $this->getSQL();
assert(is_string($query));
$hints = $this->getHints();
$params = array_map(function (Parameter $parameter) {
$value = $parameter->getValue();
@@ -12,6 +12,7 @@ use Doctrine\ORM\UnitOfWork;
use Doctrine\ORM\Utility\IdentifierFlattener;
use function array_merge;
use function assert;
use function is_array;
use function is_object;
use function reset;
@@ -57,6 +58,7 @@ class DefaultEntityHydrator implements EntityHydrator
if ($metadata->requiresFetchAfterChange) {
if ($metadata->isVersioned) {
assert($metadata->versionField !== null);
$data[$metadata->versionField] = $metadata->getFieldValue($entity, $metadata->versionField);
}
+7 -8
View File
@@ -607,8 +607,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
*
* @param string $name
*
* @return string|null
* @psalm-return ?class-string
* @return string|callable|null
* @psalm-return class-string|callable|null
*/
public function getCustomStringFunction($name)
{
@@ -625,8 +625,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
*
* Any previously added string functions are discarded.
*
* @psalm-param array<string, class-string> $functions The map of custom
* DQL string functions.
* @psalm-param array<string, class-string|callable> $functions The map of custom DQL string functions.
*
* @return void
*/
@@ -659,8 +658,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
*
* @param string $name
*
* @return string|null
* @psalm-return ?class-string
* @return string|callable|null
* @psalm-return class-string|callable|null
*/
public function getCustomNumericFunction($name)
{
@@ -712,8 +711,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
*
* @param string $name
*
* @return string|null
* @psalm-return ?class-string $name
* @return string|callable|null
* @psalm-return class-string|callable|null $name
*/
public function getCustomDatetimeFunction($name)
{
+1 -1
View File
@@ -62,7 +62,7 @@ class SequenceGenerator extends AbstractIdGenerator implements Serializable
$connection->ensureConnectedToPrimary();
}
$this->_nextValue = (int) $connection->executeQuery($sql)->fetchOne();
$this->_nextValue = (int) $connection->fetchOne($sql);
$this->_maxValue = $this->_nextValue + $this->_allocationSize;
}
@@ -83,18 +83,17 @@ class HydrationException extends ORMException
}
/**
* @param string $discrValue
* @param string[] $discrMap
* @psalm-param array<string, string> $discrMap
* @param string $discrValue
* @param list<int|string> $discrValues
*
* @return HydrationException
*/
public static function invalidDiscriminatorValue($discrValue, $discrMap)
public static function invalidDiscriminatorValue($discrValue, $discrValues)
{
return new self(sprintf(
'The discriminator value "%s" is invalid. It must be one of "%s".',
$discrValue,
implode('", "', $discrMap)
implode('", "', $discrValues)
));
}
}
@@ -44,6 +44,9 @@ class ObjectHydrator extends AbstractHydrator
/** @var mixed[] */
private $initializedCollections = [];
/** @var array<string, PersistentCollection> */
private $uninitializedCollections = [];
/** @var mixed[] */
private $existingCollections = [];
@@ -112,10 +115,11 @@ class ObjectHydrator extends AbstractHydrator
parent::cleanup();
$this->identifierMap =
$this->initializedCollections =
$this->existingCollections =
$this->resultPointers = [];
$this->identifierMap =
$this->initializedCollections =
$this->uninitializedCollections =
$this->existingCollections =
$this->resultPointers = [];
if ($eagerLoad) {
$this->_uow->triggerEagerLoads();
@@ -126,10 +130,11 @@ class ObjectHydrator extends AbstractHydrator
protected function cleanupAfterRowIteration(): void
{
$this->identifierMap =
$this->initializedCollections =
$this->existingCollections =
$this->resultPointers = [];
$this->identifierMap =
$this->initializedCollections =
$this->uninitializedCollections =
$this->existingCollections =
$this->resultPointers = [];
}
/**
@@ -148,6 +153,12 @@ class ObjectHydrator extends AbstractHydrator
$coll->takeSnapshot();
}
foreach ($this->uninitializedCollections as $coll) {
if (! $coll->isInitialized()) {
$coll->setInitialized(true);
}
}
return $result;
}
@@ -411,8 +422,8 @@ class ObjectHydrator extends AbstractHydrator
}
} elseif (! $reflFieldValue) {
$this->initRelatedCollection($parentObject, $parentClass, $relationField, $parentAlias);
} elseif ($reflFieldValue instanceof PersistentCollection && $reflFieldValue->isInitialized() === false) {
$reflFieldValue->setInitialized(true);
} elseif ($reflFieldValue instanceof PersistentCollection && $reflFieldValue->isInitialized() === false && ! isset($this->uninitializedCollections[$oid . $relationField])) {
$this->uninitializedCollections[$oid . $relationField] = $reflFieldValue;
}
} else {
// PATH B: Single-valued association
+12 -12
View File
@@ -519,7 +519,9 @@ class ClassMetadataInfo implements ClassMetadata
*
* @see discriminatorColumn
*
* @var mixed
* @var array<int|string, string>
*
* @psalm-var array<int|string, class-string>
*/
public $discriminatorMap = [];
@@ -543,10 +545,10 @@ class ClassMetadataInfo implements ClassMetadata
* @var mixed[]
* @psalm-var array{
* name: string,
* schema: string,
* indexes: array,
* uniqueConstraints: array,
* options: array<string, mixed>,
* schema?: string,
* indexes?: array,
* uniqueConstraints?: array,
* options?: array<string, mixed>,
* quoted?: bool
* }
*/
@@ -711,7 +713,7 @@ class ClassMetadataInfo implements ClassMetadata
/**
* READ-ONLY: The name of the field which is used for versioning in optimistic locking (if any).
*
* @var mixed
* @var string|null
*/
public $versionField;
@@ -3217,7 +3219,7 @@ class ClassMetadataInfo implements ClassMetadata
* Sets the discriminator values used by this class.
* Used for JOINED and SINGLE_TABLE inheritance mapping strategies.
*
* @psalm-param array<string, class-string> $map
* @param array<int|string, string> $map
*
* @return void
*/
@@ -3231,9 +3233,8 @@ class ClassMetadataInfo implements ClassMetadata
/**
* Adds one entry of the discriminator map with a new class and corresponding name.
*
* @param string $name
* @param string $className
* @psalm-param class-string $className
* @param int|string $name
* @param string $className
*
* @return void
*
@@ -3517,7 +3518,7 @@ class ClassMetadataInfo implements ClassMetadata
* Sets the name of the field that is to be used for versioning if this class is
* versioned for optimistic locking.
*
* @param string $versionField
* @param string|null $versionField
*
* @return void
*/
@@ -3707,7 +3708,6 @@ class ClassMetadataInfo implements ClassMetadata
/**
* @param string|null $className
* @psalm-param string|class-string|null $className
*
* @return string|null null if the input value is null
* @psalm-return class-string|null
@@ -15,15 +15,11 @@ use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
#[Attribute(Attribute::TARGET_CLASS)]
final class DiscriminatorMap implements Annotation
{
/**
* @var array<string, string>
* @psalm-var array<string, class-string>
*/
/** @var array<int|string, string> */
public $value;
/**
* @param array<string, string> $value
* @psalm-param array<string, class-string> $value
* @param array<int|string, string> $value
*/
public function __construct(array $value)
{
@@ -10,9 +10,9 @@ use Doctrine\Deprecations\Deprecation;
use Doctrine\ORM\Events;
use Doctrine\ORM\Mapping;
use Doctrine\ORM\Mapping\Builder\EntityListenerBuilder;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\MappingException;
use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\Persistence\Mapping\ClassMetadata as PersistenceClassMetadata;
use Doctrine\Persistence\Mapping\Driver\ColocatedMappingDriver;
use ReflectionClass;
use ReflectionMethod;
@@ -69,10 +69,14 @@ class AnnotationDriver extends CompatibilityAnnotationDriver
/**
* {@inheritDoc}
*
* @psalm-param class-string<T> $className
* @psalm-param ClassMetadata<T> $metadata
*
* @template T of object
*/
public function loadMetadataForClass($className, ClassMetadata $metadata)
public function loadMetadataForClass($className, PersistenceClassMetadata $metadata)
{
assert($metadata instanceof Mapping\ClassMetadata);
$class = $metadata->getReflectionClass()
// this happens when running annotation driver in combination with
// static reflection services. This is not the nicest fix
@@ -298,7 +302,7 @@ class AnnotationDriver extends CompatibilityAnnotationDriver
constant('Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_' . $inheritanceTypeAnnot->value)
);
if ($metadata->inheritanceType !== ClassMetadataInfo::INHERITANCE_TYPE_NONE) {
if ($metadata->inheritanceType !== ClassMetadata::INHERITANCE_TYPE_NONE) {
// Evaluate DiscriminatorColumn annotation
if (isset($classAnnotations[Mapping\DiscriminatorColumn::class])) {
$discrColumnAnnot = $classAnnotations[Mapping\DiscriminatorColumn::class];
@@ -543,7 +547,7 @@ class AnnotationDriver extends CompatibilityAnnotationDriver
private function loadRelationShipMapping(
ReflectionProperty $property,
array &$mapping,
ClassMetadata $metadata,
PersistenceClassMetadata $metadata,
array $joinColumns,
string $className
): void {
@@ -647,7 +651,7 @@ class AnnotationDriver extends CompatibilityAnnotationDriver
/**
* Attempts to resolve the fetch mode.
*
* @psalm-return \Doctrine\ORM\Mapping\ClassMetadata::FETCH_* The fetch mode as defined in ClassMetadata.
* @psalm-return ClassMetadata::FETCH_* The fetch mode as defined in ClassMetadata.
*
* @throws MappingException If the fetch mode is not valid.
*/
@@ -663,7 +667,7 @@ class AnnotationDriver extends CompatibilityAnnotationDriver
/**
* Attempts to resolve the generated mode.
*
* @psalm-return ClassMetadataInfo::GENERATED_*
* @psalm-return ClassMetadata::GENERATED_*
*
* @throws MappingException If the fetch mode is not valid.
*/
@@ -763,7 +767,7 @@ class AnnotationDriver extends CompatibilityAnnotationDriver
* precision: int,
* notInsertable?: bool,
* notUpdateble?: bool,
* generated?: ClassMetadataInfo::GENERATED_*,
* generated?: ClassMetadata::GENERATED_*,
* enumType?: class-string,
* options?: mixed[],
* columnName?: string,
@@ -8,9 +8,9 @@ use Doctrine\Deprecations\Deprecation;
use Doctrine\ORM\Events;
use Doctrine\ORM\Mapping;
use Doctrine\ORM\Mapping\Builder\EntityListenerBuilder;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\MappingException;
use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\Persistence\Mapping\ClassMetadata as PersistenceClassMetadata;
use Doctrine\Persistence\Mapping\Driver\ColocatedMappingDriver;
use LogicException;
use ReflectionClass;
@@ -98,11 +98,20 @@ class AttributeDriver extends CompatibilityAnnotationDriver
return true;
}
public function loadMetadataForClass($className, ClassMetadata $metadata): void
/**
* {@inheritDoc}
*
* @psalm-param class-string<T> $className
* @psalm-param ClassMetadata<T> $metadata
*
* @template T of object
*/
public function loadMetadataForClass($className, PersistenceClassMetadata $metadata): void
{
assert($metadata instanceof ClassMetadataInfo);
$reflectionClass = $metadata->getReflectionClass();
$reflectionClass = $metadata->getReflectionClass()
// this happens when running annotation driver in combination with
// static reflection services. This is not the nicest fix
?? new ReflectionClass($metadata->name);
$classAttributes = $this->reader->getClassAnnotations($reflectionClass);
@@ -238,7 +247,7 @@ class AttributeDriver extends CompatibilityAnnotationDriver
constant('Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_' . $inheritanceTypeAttribute->value)
);
if ($metadata->inheritanceType !== Mapping\ClassMetadata::INHERITANCE_TYPE_NONE) {
if ($metadata->inheritanceType !== ClassMetadata::INHERITANCE_TYPE_NONE) {
// Evaluate DiscriminatorColumn annotation
if (isset($classAttributes[Mapping\DiscriminatorColumn::class])) {
$discrColumnAttribute = $classAttributes[Mapping\DiscriminatorColumn::class];
@@ -491,7 +500,7 @@ class AttributeDriver extends CompatibilityAnnotationDriver
// Check for `fetch`
if ($associationOverride->fetch) {
$override['fetch'] = constant(Mapping\ClassMetadata::class . '::FETCH_' . $associationOverride->fetch);
$override['fetch'] = constant(ClassMetadata::class . '::FETCH_' . $associationOverride->fetch);
}
$metadata->setAssociationOverride($fieldName, $override);
@@ -558,7 +567,7 @@ class AttributeDriver extends CompatibilityAnnotationDriver
* @param string $className The class name.
* @param string $fetchMode The fetch mode.
*
* @return int The fetch mode as defined in ClassMetadata.
* @return ClassMetadata::FETCH_* The fetch mode as defined in ClassMetadata.
*
* @throws MappingException If the fetch mode is not valid.
*/
@@ -9,18 +9,18 @@ use Doctrine\Persistence\Mapping\Driver\MappingDriver;
use function class_exists;
if (class_exists(PersistenceAnnotationDriver::class)) {
/**
* @internal This class will be removed in ORM 3.0.
*/
abstract class CompatibilityAnnotationDriver extends PersistenceAnnotationDriver
{
}
} else {
if (! class_exists(PersistenceAnnotationDriver::class)) {
/**
* @internal This class will be removed in ORM 3.0.
*/
abstract class CompatibilityAnnotationDriver implements MappingDriver
{
}
} else {
/**
* @internal This class will be removed in ORM 3.0.
*/
abstract class CompatibilityAnnotationDriver extends PersistenceAnnotationDriver
{
}
}
@@ -12,9 +12,10 @@ use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\Types;
use Doctrine\Inflector\Inflector;
use Doctrine\Inflector\InflectorFactory;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\MappingException;
use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\Persistence\Mapping\ClassMetadata as PersistenceClassMetadata;
use Doctrine\Persistence\Mapping\Driver\MappingDriver;
use InvalidArgumentException;
@@ -166,8 +167,13 @@ class DatabaseDriver implements MappingDriver
/**
* {@inheritDoc}
*
* @psalm-param class-string<T> $className
* @psalm-param ClassMetadata<T> $metadata
*
* @template T of object
*/
public function loadMetadataForClass($className, ClassMetadata $metadata)
public function loadMetadataForClass($className, PersistenceClassMetadata $metadata)
{
$this->reverseEngineerMappingFromDatabase();
+10 -5
View File
@@ -6,9 +6,9 @@ namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\Common\Collections\Criteria;
use Doctrine\ORM\Mapping\Builder\EntityListenerBuilder;
use Doctrine\ORM\Mapping\ClassMetadata as Metadata;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\MappingException;
use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\Persistence\Mapping\ClassMetadata as PersistenceClassMetadata;
use Doctrine\Persistence\Mapping\Driver\FileDriver;
use InvalidArgumentException;
use LogicException;
@@ -53,8 +53,13 @@ class XmlDriver extends FileDriver
/**
* {@inheritDoc}
*
* @psalm-param class-string<T> $className
* @psalm-param ClassMetadata<T> $metadata
*
* @template T of object
*/
public function loadMetadataForClass($className, ClassMetadata $metadata)
public function loadMetadataForClass($className, PersistenceClassMetadata $metadata)
{
$xmlRoot = $this->getElement($className);
assert($xmlRoot instanceof SimpleXMLElement);
@@ -168,7 +173,7 @@ class XmlDriver extends FileDriver
$inheritanceType = (string) $xmlRoot['inheritance-type'];
$metadata->setInheritanceType(constant('Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_' . $inheritanceType));
if ($metadata->inheritanceType !== Metadata::INHERITANCE_TYPE_NONE) {
if ($metadata->inheritanceType !== ClassMetadata::INHERITANCE_TYPE_NONE) {
// Evaluate <discriminator-column...>
if (isset($xmlRoot->{'discriminator-column'})) {
$discrColumn = $xmlRoot->{'discriminator-column'};
@@ -685,7 +690,7 @@ class XmlDriver extends FileDriver
// Check for `fetch`
if (isset($overrideElement['fetch'])) {
$override['fetch'] = constant(Metadata::class . '::FETCH_' . (string) $overrideElement['fetch']);
$override['fetch'] = constant(ClassMetadata::class . '::FETCH_' . (string) $overrideElement['fetch']);
}
$metadata->setAssociationOverride($fieldName, $override);
+10 -5
View File
@@ -6,9 +6,9 @@ namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\Deprecations\Deprecation;
use Doctrine\ORM\Mapping\Builder\EntityListenerBuilder;
use Doctrine\ORM\Mapping\ClassMetadata as Metadata;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\MappingException;
use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\Persistence\Mapping\ClassMetadata as PersistenceClassMetadata;
use Doctrine\Persistence\Mapping\Driver\FileDriver;
use InvalidArgumentException;
use LogicException;
@@ -60,8 +60,13 @@ class YamlDriver extends FileDriver
/**
* {@inheritDoc}
*
* @psalm-param class-string<T> $className
* @psalm-param ClassMetadata<T> $metadata
*
* @template T of object
*/
public function loadMetadataForClass($className, ClassMetadata $metadata)
public function loadMetadataForClass($className, PersistenceClassMetadata $metadata)
{
$element = $this->getElement($className);
@@ -186,7 +191,7 @@ class YamlDriver extends FileDriver
if (isset($element['inheritanceType'])) {
$metadata->setInheritanceType(constant('Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_' . strtoupper($element['inheritanceType'])));
if ($metadata->inheritanceType !== Metadata::INHERITANCE_TYPE_NONE) {
if ($metadata->inheritanceType !== ClassMetadata::INHERITANCE_TYPE_NONE) {
// Evaluate discriminatorColumn
if (isset($element['discriminatorColumn'])) {
$discrColumn = $element['discriminatorColumn'];
@@ -683,7 +688,7 @@ class YamlDriver extends FileDriver
// Check for `fetch`
if (isset($associationOverrideElement['fetch'])) {
$override['fetch'] = constant(Metadata::class . '::FETCH_' . $associationOverrideElement['fetch']);
$override['fetch'] = constant(ClassMetadata::class . '::FETCH_' . $associationOverrideElement['fetch']);
}
$metadata->setAssociationOverride($fieldName, $override);
+3 -2
View File
@@ -12,13 +12,14 @@ use Doctrine\ORM\EntityRepository;
* @Annotation
* @NamedArgumentConstructor()
* @Target("CLASS")
* @template T of object
*/
#[Attribute(Attribute::TARGET_CLASS)]
final class Entity implements Annotation
{
/**
* @var string|null
* @psalm-var class-string<EntityRepository>|null
* @psalm-var class-string<EntityRepository<T>>|null
*/
public $repositoryClass;
@@ -26,7 +27,7 @@ final class Entity implements Annotation
public $readOnly = false;
/**
* @psalm-param class-string<EntityRepository>|null $repositoryClass
* @psalm-param class-string<EntityRepository<T>>|null $repositoryClass
*/
public function __construct(?string $repositoryClass = null, bool $readOnly = false)
{
+1 -3
View File
@@ -34,11 +34,9 @@ final class NativeQuery extends AbstractQuery
/**
* Gets the SQL query.
*
* @return mixed The built SQL query or an array of all SQL queries.
*
* @override
*/
public function getSQL()
public function getSQL(): string
{
return $this->sql;
}
@@ -14,7 +14,9 @@ use Doctrine\ORM\Utility\PersisterHelper;
use function array_merge;
use function array_reverse;
use function array_values;
use function assert;
use function implode;
use function is_string;
/**
* Persister for one-to-many collections.
@@ -225,7 +227,9 @@ class OneToManyPersister extends AbstractCollectionPersister
. ' FROM ' . $targetClass->name . ' t0 WHERE t0.' . $mapping['mappedBy'] . ' = :owner'
)->setParameter('owner', $collection->getOwner());
$statement = 'INSERT INTO ' . $tempTable . ' (' . $idColumnList . ') ' . $query->getSQL();
$sql = $query->getSQL();
assert(is_string($sql));
$statement = 'INSERT INTO ' . $tempTable . ' (' . $idColumnList . ') ' . $sql;
$parameters = array_values($sourceClass->getIdentifierValues($collection->getOwner()));
$numDeleted = $this->conn->executeStatement($statement, $parameters);
@@ -494,7 +494,8 @@ class BasicEntityPersister implements EntityPersister
}
if ($versioned) {
$versionField = $this->class->versionField;
$versionField = $this->class->versionField;
assert($versionField !== null);
$versionFieldType = $this->class->fieldMappings[$versionField]['type'];
$versionColumn = $this->quoteStrategy->getColumnName($versionField, $this->class, $this->platform);
+4 -4
View File
@@ -174,7 +174,7 @@ final class Query extends AbstractQuery
/**
* The query cache lifetime.
*
* @var int
* @var int|null
*/
private $queryCacheTTL;
@@ -188,7 +188,7 @@ final class Query extends AbstractQuery
/**
* Gets the SQL query/queries that correspond to this DQL query.
*
* @return mixed The built sql query or an array of all sql queries.
* @return list<string>|string The built sql query or an array of all sql queries.
*
* @override
*/
@@ -537,7 +537,7 @@ final class Query extends AbstractQuery
/**
* Defines how long the query cache will be active before expire.
*
* @param int $timeToLive How long the cache entry is valid.
* @param int|null $timeToLive How long the cache entry is valid.
*
* @return $this
*/
@@ -596,7 +596,7 @@ final class Query extends AbstractQuery
/**
* Sets a DQL query string.
*
* @param string $dqlQuery DQL Query.
* @param string|null $dqlQuery DQL Query.
*/
public function setDQL($dqlQuery): self
{
@@ -18,7 +18,7 @@ use Doctrine\DBAL\Types\Type;
*/
abstract class AbstractSqlExecutor
{
/** @var mixed[]|string */
/** @var list<string>|string */
protected $_sqlStatements;
/** @var QueryCacheProfile */
@@ -98,7 +98,7 @@ class MultiTableDeleteExecutor extends AbstractSqlExecutor
}
$this->_createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable . ' ('
. $platform->getColumnDeclarationListSQL($columnDefinitions) . ')';
. $platform->getColumnDeclarationListSQL($columnDefinitions) . ', PRIMARY KEY(' . implode(',', $idColumnNames) . '))';
$this->_dropTempTableSql = $platform->getDropTemporaryTableSQL($tempTable);
}
@@ -139,7 +139,7 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
}
$this->_createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable . ' ('
. $platform->getColumnDeclarationListSQL($columnDefinitions) . ')';
. $platform->getColumnDeclarationListSQL($columnDefinitions) . ', PRIMARY KEY(' . implode(',', $idColumnNames) . '))';
$this->_dropTempTableSql = $platform->getDropTemporaryTableSQL($tempTable);
}
@@ -90,7 +90,9 @@ EOT
if ($dumpSql) {
$ui->text('The following SQL statements will be executed:');
$ui->newLine();
$ui->listing($sqls);
foreach ($sqls as $sql) {
$ui->text(sprintf(' %s;', $sql));
}
}
if ($force) {
@@ -81,7 +81,9 @@ class ValidateSchemaCommand extends AbstractEntityManagerCommand
if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
$sqls = $validator->getUpdateSchemaList();
$ui->comment(sprintf('<info>%d</info> schema diff(s) detected:', count($sqls)));
$ui->listing($sqls);
foreach ($sqls as $sql) {
$ui->text(sprintf(' %s;', $sql));
}
}
$exit += 2;
@@ -82,7 +82,7 @@ class XmlExporter extends AbstractExporter
foreach ($metadata->discriminatorMap as $value => $className) {
$discriminatorMappingXml = $discriminatorMapXml->addChild('discriminator-mapping');
$discriminatorMappingXml->addAttribute('value', $value);
$discriminatorMappingXml->addAttribute('value', (string) $value);
$discriminatorMappingXml->addAttribute('class', $className);
}
}
+5
View File
@@ -54,6 +54,7 @@ use function array_merge;
use function array_pop;
use function array_sum;
use function array_values;
use function assert;
use function count;
use function current;
use function get_class;
@@ -1612,6 +1613,8 @@ class UnitOfWork implements PropertyChangedListener
case $class->isIdentifierNatural():
// Check for a version field, if available, to avoid a db lookup.
if ($class->isVersioned) {
assert($class->versionField !== null);
return $class->getFieldValue($entity, $class->versionField)
? self::STATE_DETACHED
: self::STATE_NEW;
@@ -2061,6 +2064,7 @@ class UnitOfWork implements PropertyChangedListener
return;
}
assert($class->versionField !== null);
$reflField = $class->reflFields[$class->versionField];
$managedCopyVersion = $reflField->getValue($managedCopy);
$entityVersion = $reflField->getValue($entity);
@@ -2495,6 +2499,7 @@ class UnitOfWork implements PropertyChangedListener
$entity->__load();
}
assert($class->versionField !== null);
$entityVersion = $class->reflFields[$class->versionField]->getValue($entity);
// phpcs:ignore SlevomatCodingStandard.Operators.DisallowEqualOperators.DisallowedNotEqualOperator
@@ -11,7 +11,7 @@ use Doctrine\Persistence\Mapping\ClassMetadataFactory;
use function assert;
use function implode;
use function is_object;
use function is_a;
/**
* The IdentifierFlattener utility now houses some of the identifier manipulation logic from unit of work, so that it
@@ -55,7 +55,7 @@ final class IdentifierFlattener
$flatId = [];
foreach ($class->identifier as $field) {
if (isset($class->associationMappings[$field]) && isset($id[$field]) && is_object($id[$field])) {
if (isset($class->associationMappings[$field]) && isset($id[$field]) && is_a($id[$field], $class->associationMappings[$field]['targetEntity'])) {
$targetClassMetadata = $this->metadataFactory->getMetadataFor(
$class->associationMappings[$field]['targetEntity']
);
-17
View File
@@ -266,21 +266,4 @@
<!-- https://github.com/doctrine/orm/issues/8537 -->
<exclude-pattern>lib/Doctrine/ORM/QueryBuilder.php</exclude-pattern>
</rule>
<rule ref="Generic.WhiteSpace.ScopeIndent.Incorrect">
<!-- see https://github.com/squizlabs/PHP_CodeSniffer/issues/3474 -->
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/AccessLevel.php</exclude-pattern>
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/City.php</exclude-pattern>
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/Suit.php</exclude-pattern>
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/Unit.php</exclude-pattern>
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/UserStatus.php</exclude-pattern>
</rule>
<rule ref="Generic.WhiteSpace.ScopeIndent.IncorrectExact">
<!-- see https://github.com/squizlabs/PHP_CodeSniffer/issues/3474 -->
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/AccessLevel.php</exclude-pattern>
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/City.php</exclude-pattern>
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/Suit.php</exclude-pattern>
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/Unit.php</exclude-pattern>
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/UserStatus.php</exclude-pattern>
</rule>
</ruleset>
+17 -473
View File
@@ -1,10 +1,5 @@
parameters:
ignoreErrors:
-
message: "#^Method Doctrine\\\\ORM\\\\AbstractQuery\\:\\:processParameterValue\\(\\) should return array\\|bool\\|float\\|int\\|string but returns mixed\\.$#"
count: 1
path: lib/Doctrine/ORM/AbstractQuery.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\Persisters\\\\Entity\\\\EntityPersister\\:\\:getCacheRegion\\(\\)\\.$#"
count: 1
@@ -170,26 +165,6 @@ parameters:
count: 1
path: lib/Doctrine/ORM/Id/TableGenerator.php
-
message: "#^Parameter \\#2 \\$discrMap of static method Doctrine\\\\ORM\\\\Internal\\\\Hydration\\\\HydrationException\\:\\:invalidDiscriminatorValue\\(\\) expects array\\<string, string\\>, array\\<int, int\\|string\\> given\\.$#"
count: 1
path: lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php
-
message: "#^Parameter \\#2 \\$discrMap of static method Doctrine\\\\ORM\\\\Internal\\\\Hydration\\\\HydrationException\\:\\:invalidDiscriminatorValue\\(\\) expects array\\<string, string\\>, array\\<int, int\\|string\\> given\\.$#"
count: 1
path: lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php
-
message: "#^Offset 'indexes' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Builder/ClassMetadataBuilder.php
-
message: "#^Offset 'uniqueConstraints' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Builder/ClassMetadataBuilder.php
-
message: "#^If condition is always true\\.$#"
count: 2
@@ -200,11 +175,6 @@ parameters:
count: 1
path: lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
-
message: "#^Offset 'indexes'\\|'uniqueConstraints' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
-
message: "#^Parameter \\#2 \\$class of method Doctrine\\\\ORM\\\\Mapping\\\\QuoteStrategy\\:\\:getSequenceName\\(\\) expects Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadata, Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadataInfo given\\.$#"
count: 2
@@ -220,11 +190,6 @@ parameters:
count: 1
path: lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
-
message: "#^Offset 'schema' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} on left side of \\?\\? always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\:\\:mapEmbedded\\(\\)\\.$#"
count: 1
@@ -256,190 +221,10 @@ parameters:
path: lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
-
message: "#^Parameter \\#1 \\$metadata of static method Doctrine\\\\ORM\\\\Mapping\\\\Builder\\\\EntityListenerBuilder\\:\\:bindEntityListener\\(\\) expects Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadata, Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadataInfo&Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\> given\\.$#"
message: "#^Expression on left side of \\?\\? is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php
-
message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:\\$name\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php
-
message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:\\$table\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:mapManyToMany\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php
-
message: "#^Parameter \\#1 \\$metadata of method Doctrine\\\\ORM\\\\Mapping\\\\Driver\\\\DatabaseDriver\\:\\:buildFieldMappings\\(\\) expects Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadataInfo, Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\> given\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php
-
message: "#^Parameter \\#1 \\$metadata of method Doctrine\\\\ORM\\\\Mapping\\\\Driver\\\\DatabaseDriver\\:\\:buildIndexes\\(\\) expects Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadataInfo, Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\> given\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php
-
message: "#^Parameter \\#1 \\$metadata of method Doctrine\\\\ORM\\\\Mapping\\\\Driver\\\\DatabaseDriver\\:\\:buildToOneAssociationMappings\\(\\) expects Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadataInfo, Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\> given\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php
-
message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:\\$inheritanceType\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:\\$isEmbeddedClass\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:\\$isMappedSuperclass\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:\\$table\\.$#"
count: 3
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:addEntityListener\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:addLifecycleCallback\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:addNamedNativeQuery\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:addNamedQuery\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:addSqlResultSetMapping\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:enableCache\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:getAssociationCacheDefaults\\(\\)\\.$#"
count: 4
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:mapEmbedded\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:mapField\\(\\)\\.$#"
count: 3
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:mapManyToMany\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:mapManyToOne\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:mapOneToMany\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:mapOneToOne\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:markReadOnly\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setAssociationOverride\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setAttributeOverride\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setChangeTrackingPolicy\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setCustomGeneratorDefinition\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setCustomRepositoryClass\\(\\)\\.$#"
count: 2
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setDiscriminatorColumn\\(\\)\\.$#"
count: 2
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setDiscriminatorMap\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setIdGeneratorType\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setInheritanceType\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setPrimaryTable\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setSequenceGeneratorDefinition\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setVersionMapping\\(\\)\\.$#"
count: 2
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Empty array passed to foreach\\.$#"
count: 1
@@ -450,171 +235,11 @@ parameters:
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Parameter \\#1 \\$metadata of static method Doctrine\\\\ORM\\\\Mapping\\\\Builder\\\\EntityListenerBuilder\\:\\:bindEntityListener\\(\\) expects Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadata, Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\> given\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
-
message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:\\$inheritanceType\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:\\$isEmbeddedClass\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:\\$isMappedSuperclass\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:\\$table\\.$#"
count: 3
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:addEntityListener\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:addLifecycleCallback\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:addNamedNativeQuery\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:addNamedQuery\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:addSqlResultSetMapping\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:enableCache\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:getAssociationCacheDefaults\\(\\)\\.$#"
count: 4
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:mapEmbedded\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:mapField\\(\\)\\.$#"
count: 2
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:mapManyToMany\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:mapManyToOne\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:mapOneToMany\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:mapOneToOne\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:markReadOnly\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setAssociationOverride\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setAttributeOverride\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setChangeTrackingPolicy\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setCustomGeneratorDefinition\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setCustomRepositoryClass\\(\\)\\.$#"
count: 2
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setDiscriminatorColumn\\(\\)\\.$#"
count: 2
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setDiscriminatorMap\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setIdGeneratorType\\(\\)\\.$#"
count: 2
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setInheritanceType\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setPrimaryTable\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setSequenceGeneratorDefinition\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:setVersionMapping\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Offset 'usage' on array\\{usage\\: string, region\\?\\: string\\} in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Parameter \\#1 \\$metadata of static method Doctrine\\\\ORM\\\\Mapping\\\\Builder\\\\EntityListenerBuilder\\:\\:bindEntityListener\\(\\) expects Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadata, Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\> given\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
-
message: "#^Call to function is_int\\(\\) with string will always evaluate to false\\.$#"
count: 1
@@ -701,37 +326,37 @@ parameters:
path: lib/Doctrine/ORM/Query/AST/Functions/DateAddFunction.php
-
message: "#^Parameter \\#2 \\$days of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddDaysExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$days of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddDaysExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateAddFunction.php
-
message: "#^Parameter \\#2 \\$hours of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddHourExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$hours of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddHourExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateAddFunction.php
-
message: "#^Parameter \\#2 \\$minutes of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddMinutesExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$minutes of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddMinutesExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateAddFunction.php
-
message: "#^Parameter \\#2 \\$months of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddMonthExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$months of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddMonthExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateAddFunction.php
-
message: "#^Parameter \\#2 \\$seconds of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddSecondsExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$seconds of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddSecondsExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateAddFunction.php
-
message: "#^Parameter \\#2 \\$weeks of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddWeeksExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$weeks of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddWeeksExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateAddFunction.php
-
message: "#^Parameter \\#2 \\$years of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddYearsExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$years of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateAddYearsExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateAddFunction.php
@@ -741,37 +366,37 @@ parameters:
path: lib/Doctrine/ORM/Query/AST/Functions/DateSubFunction.php
-
message: "#^Parameter \\#2 \\$days of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubDaysExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$days of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubDaysExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateSubFunction.php
-
message: "#^Parameter \\#2 \\$hours of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubHourExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$hours of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubHourExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateSubFunction.php
-
message: "#^Parameter \\#2 \\$minutes of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubMinutesExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$minutes of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubMinutesExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateSubFunction.php
-
message: "#^Parameter \\#2 \\$months of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubMonthExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$months of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubMonthExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateSubFunction.php
-
message: "#^Parameter \\#2 \\$seconds of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubSecondsExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$seconds of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubSecondsExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateSubFunction.php
-
message: "#^Parameter \\#2 \\$weeks of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubWeeksExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$weeks of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubWeeksExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateSubFunction.php
-
message: "#^Parameter \\#2 \\$years of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubYearsExpression\\(\\) expects int, string given\\.$#"
message: "#^Parameter \\#2 \\$years of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getDateSubYearsExpression\\(\\) expects int\\|numeric\\-string, string given\\.$#"
count: 1
path: lib/Doctrine/ORM/Query/AST/Functions/DateSubFunction.php
@@ -850,11 +475,6 @@ parameters:
count: 1
path: lib/Doctrine/ORM/Query/Expr/Select.php
-
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
count: 3
path: lib/Doctrine/ORM/Query/Parser.php
-
message: "#^Method Doctrine\\\\ORM\\\\Query\\\\Parser\\:\\:ArithmeticFactor\\(\\) should return Doctrine\\\\ORM\\\\Query\\\\AST\\\\ArithmeticFactor but returns Doctrine\\\\ORM\\\\Query\\\\AST\\\\Node\\|string\\.$#"
count: 1
@@ -1490,28 +1110,13 @@ parameters:
count: 1
path: lib/Doctrine/ORM/Tools/EntityGenerator.php
-
message: "#^Offset 'indexes' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Tools/EntityGenerator.php
-
message: "#^Offset 'initialValue' on array\\{sequenceName\\: string, allocationSize\\: string, initialValue\\: string, quoted\\?\\: mixed\\} in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Tools/EntityGenerator.php
-
message: "#^Offset 'name' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Tools/EntityGenerator.php
-
message: "#^Offset 'options' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Tools/EntityGenerator.php
-
message: "#^Offset 'schema' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
message: "#^Offset 'name' on array\\{name\\: string, schema\\?\\: string, indexes\\?\\: array, uniqueConstraints\\?\\: array, options\\?\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Tools/EntityGenerator.php
@@ -1520,11 +1125,6 @@ parameters:
count: 1
path: lib/Doctrine/ORM/Tools/EntityGenerator.php
-
message: "#^Offset 'uniqueConstraints' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Tools/EntityGenerator.php
-
message: "#^Property Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadataInfo\\<object\\>\\:\\:\\$lifecycleCallbacks \\(array\\<string, array\\<int, string\\>\\>\\) in isset\\(\\) is not nullable\\.$#"
count: 1
@@ -1561,27 +1161,7 @@ parameters:
path: lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php
-
message: "#^Offset 'indexes' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php
-
message: "#^Offset 'name' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php
-
message: "#^Offset 'options' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php
-
message: "#^Offset 'schema' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php
-
message: "#^Offset 'uniqueConstraints' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
message: "#^Offset 'name' on array\\{name\\: string, schema\\?\\: string, indexes\\?\\: array, uniqueConstraints\\?\\: array, options\\?\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php
@@ -1605,26 +1185,6 @@ parameters:
count: 2
path: lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php
-
message: "#^Offset 'indexes' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php
-
message: "#^Offset 'options' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php
-
message: "#^Offset 'schema' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php
-
message: "#^Offset 'uniqueConstraints' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php
-
message: "#^Property Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadataInfo\\<object\\>\\:\\:\\$lifecycleCallbacks \\(array\\<string, array\\<int, string\\>\\>\\) in isset\\(\\) is not nullable\\.$#"
count: 1
@@ -1675,21 +1235,6 @@ parameters:
count: 1
path: lib/Doctrine/ORM/Tools/SchemaTool.php
-
message: "#^Offset 'indexes' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Tools/SchemaTool.php
-
message: "#^Offset 'options' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Tools/SchemaTool.php
-
message: "#^Offset 'uniqueConstraints' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Tools/SchemaTool.php
-
message: "#^Binary operation \"&\" between string and 3 results in an error\\.$#"
count: 1
@@ -1734,4 +1279,3 @@ parameters:
message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\:\\:\\$subClasses\\.$#"
count: 1
path: lib/Doctrine/ORM/Utility/HierarchyDiscriminatorResolver.php
+14 -1
View File
@@ -3,6 +3,8 @@ includes:
- phpstan-params.neon
parameters:
reportUnmatchedIgnoredErrors: false
ignoreErrors:
# https://github.com/doctrine/collections/pull/282
- '/Variable \$offset in isset\(\) always exists and is not nullable\./'
@@ -11,7 +13,7 @@ parameters:
# Class name will change in DBAL 3.
- '/^Class Doctrine\\DBAL\\Platforms\\PostgreSQLPlatform not found\.$/'
# Forward compatibility for DBAL 3.2
# Forward compatibility for DBAL 3.4
- '/^Call to an undefined method Doctrine\\DBAL\\Cache\\QueryCacheProfile::[gs]etResultCache\(\)\.$/'
-
message: '/^Call to an undefined static method Doctrine\\DBAL\\Configuration::[gs]etResultCache\(\)\.$/'
@@ -19,6 +21,12 @@ parameters:
-
message: '/^Parameter #3 \$resultCache of class Doctrine\\DBAL\\Cache\\QueryCacheProfile constructor/'
path: lib/Doctrine/ORM/AbstractQuery.php
-
message: '/^Parameter #2 \$\w+ of method Doctrine\\DBAL\\Platforms\\AbstractPlatform::getDateAdd\w+Expression\(\) expects int, string given\.$/'
path: lib/Doctrine/ORM/Query/AST/Functions/DateAddFunction.php
-
message: '/^Parameter #2 \$\w+ of method Doctrine\\DBAL\\Platforms\\AbstractPlatform::getDateSub\w+Expression\(\) expects int, string given\.$/'
path: lib/Doctrine/ORM/Query/AST/Functions/DateSubFunction.php
# False positive
-
@@ -55,3 +63,8 @@ parameters:
-
message: '#^Call to method injectObjectManager\(\) on an unknown class Doctrine\\Persistence\\ObjectManagerAware\.$#'
path: lib/Doctrine/ORM/UnitOfWork.php
# https://github.com/phpstan/phpstan/issues/7292
-
message: '#^Offset class\-string on array\<class\-string, array\<string, mixed\>\> in isset\(\) always exists and is not nullable\.$#'
path: lib/Doctrine/ORM/UnitOfWork.php
+5 -10
View File
@@ -15,7 +15,8 @@ parameters:
message: '/Application::add\(\) expects Symfony\\Component\\Console\\Command\\Command/'
path: lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php
- '/^Class Doctrine\\DBAL\\Platforms\\(PostgreSQL|SQLServer|SQLAnywhere)Platform not found\.$/'
- '/^Class Doctrine\\DBAL\\Platforms\\SQLAnywherePlatform not found\.$/'
- '/^Call to method \w+\(\) on an unknown class Doctrine\\DBAL\\Platforms\\SQLAnywherePlatform\.$/'
-
message: '/^Call to an undefined method Doctrine\\DBAL\\Platforms\\AbstractPlatform::getSQLResultCasing\(\)\.$/'
@@ -42,13 +43,7 @@ parameters:
# Symfony cache supports passing a key prefix to the clear method.
- '/^Method Psr\\Cache\\CacheItemPoolInterface\:\:clear\(\) invoked with 1 parameter, 0 required\.$/'
# Compatibility layer for AttributeDriver
# https://github.com/phpstan/phpstan/issues/7292
-
message: "#^PHPDoc type Doctrine\\\\ORM\\\\Mapping\\\\Driver\\\\AttributeReader of property Doctrine\\\\ORM\\\\Mapping\\\\Driver\\\\AttributeDriver\\:\\:\\$reader is not covariant with PHPDoc type Doctrine\\\\Common\\\\Annotations\\\\Reader of overridden property Doctrine\\\\Persistence\\\\Mapping\\\\Driver\\\\AnnotationDriver\\:\\:\\$reader\\.$#"
path: lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php
-
message: "#^PHPDoc type array\\<string, int\\> of property Doctrine\\\\ORM\\\\Mapping\\\\Driver\\\\AttributeDriver\\:\\:\\$entityAnnotationClasses is not covariant with PHPDoc type array\\<class\\-string, bool\\|int\\> of overridden property Doctrine\\\\Persistence\\\\Mapping\\\\Driver\\\\AnnotationDriver\\:\\:\\$entityAnnotationClasses\\.$#"
path: lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php
-
message: "#^Return type \\(Doctrine\\\\ORM\\\\Mapping\\\\Driver\\\\AttributeReader\\) of method Doctrine\\\\ORM\\\\Mapping\\\\Driver\\\\AttributeDriver\\:\\:getReader\\(\\) should be compatible with return type \\(Doctrine\\\\Common\\\\Annotations\\\\Reader\\) of method Doctrine\\\\Persistence\\\\Mapping\\\\Driver\\\\AnnotationDriver\\:\\:getReader\\(\\)$#"
path: lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php
message: '#^Offset class\-string on array\<class\-string, array\<string, mixed\>\> in isset\(\) always exists and is not nullable\.$#'
path: lib/Doctrine/ORM/UnitOfWork.php
+7 -1
View File
@@ -15,7 +15,8 @@ parameters:
message: '/Application::add\(\) expects Symfony\\Component\\Console\\Command\\Command/'
path: lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php
- '/^Class Doctrine\\DBAL\\Platforms\\(PostgreSQL|SQLServer|SQLAnywhere)Platform not found\.$/'
- '/^Class Doctrine\\DBAL\\Platforms\\SQLAnywherePlatform not found\.$/'
- '/^Call to method \w+\(\) on an unknown class Doctrine\\DBAL\\Platforms\\SQLAnywherePlatform\.$/'
-
message: '/^Call to an undefined method Doctrine\\DBAL\\Platforms\\AbstractPlatform::getSQLResultCasing\(\)\.$/'
@@ -52,3 +53,8 @@ parameters:
-
message: '#^Call to method injectObjectManager\(\) on an unknown class Doctrine\\Persistence\\ObjectManagerAware\.$#'
path: lib/Doctrine/ORM/UnitOfWork.php
# https://github.com/phpstan/phpstan/issues/7292
-
message: '#^Offset class\-string on array\<class\-string, array\<string, mixed\>\> in isset\(\) always exists and is not nullable\.$#'
path: lib/Doctrine/ORM/UnitOfWork.php
+82 -168
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.22.0@fc2c6ab4d5fa5d644d8617089f012f3bb84b8703">
<files psalm-version="4.26.0@6998fabb2bf528b65777bf9941920888d23c03ac">
<file src="lib/Doctrine/ORM/AbstractQuery.php">
<DeprecatedClass occurrences="1">
<code>IterableResult</code>
@@ -264,13 +264,10 @@
</TooManyArguments>
</file>
<file src="lib/Doctrine/ORM/EntityManager.php">
<ArgumentTypeCoercion occurrences="6">
<ArgumentTypeCoercion occurrences="3">
<code>$className</code>
<code>$connection</code>
<code>$entityName</code>
<code>ltrim($className, '\\')</code>
<code>ltrim($entityName, '\\')</code>
<code>ltrim($entityName, '\\')</code>
</ArgumentTypeCoercion>
<DeprecatedMethod occurrences="2">
<code>getMetadataCacheImpl</code>
@@ -421,9 +418,6 @@
</RedundantConditionGivenDocblockType>
</file>
<file src="lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php">
<InvalidScalarArgument occurrences="1">
<code>array_keys($discrMap)</code>
</InvalidScalarArgument>
<PossiblyFalseArgument occurrences="1">
<code>$index</code>
</PossiblyFalseArgument>
@@ -452,9 +446,6 @@
</PossiblyUndefinedArrayOffset>
</file>
<file src="lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php">
<InvalidScalarArgument occurrences="1">
<code>array_keys($discrMap)</code>
</InvalidScalarArgument>
<PropertyNotSetInConstructor occurrences="1">
<code>$class</code>
</PropertyNotSetInConstructor>
@@ -465,8 +456,7 @@
</PropertyNotSetInConstructor>
</file>
<file src="lib/Doctrine/ORM/Mapping/Builder/ClassMetadataBuilder.php">
<ArgumentTypeCoercion occurrences="2">
<code>$class</code>
<ArgumentTypeCoercion occurrences="1">
<code>$repositoryClassName</code>
</ArgumentTypeCoercion>
<DeprecatedMethod occurrences="1">
@@ -523,6 +513,9 @@
<InvalidArrayOffset occurrences="1">
<code>$subClass-&gt;table[$indexType][$indexName]</code>
</InvalidArrayOffset>
<InvalidPropertyAssignmentValue occurrences="1">
<code>$subClass-&gt;table</code>
</InvalidPropertyAssignmentValue>
<MissingConstructor occurrences="2">
<code>$driver</code>
<code>$evm</code>
@@ -548,9 +541,6 @@
<code>getConfiguration</code>
<code>getConnection</code>
</PossiblyNullReference>
<PropertyTypeCoercion occurrences="1">
<code>$subClass-&gt;table</code>
</PropertyTypeCoercion>
</file>
<file src="lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php">
<DeprecatedConstant occurrences="1">
@@ -575,15 +565,20 @@
<code>protected function _validateAndCompleteManyToManyMapping(array $mapping)</code>
<code>protected function _validateAndCompleteOneToOneMapping(array $mapping)</code>
</InvalidDocblock>
<InvalidNullableReturnType occurrences="3">
<InvalidNullableReturnType occurrences="2">
<code>ReflectionProperty</code>
<code>ReflectionProperty</code>
<code>getReflectionClass</code>
</InvalidNullableReturnType>
<InvalidPropertyAssignmentValue occurrences="2">
<code>$definition</code>
<code>$this-&gt;subClasses</code>
</InvalidPropertyAssignmentValue>
<InvalidReturnStatement occurrences="1">
<code>$this-&gt;reflClass</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="1">
<code>getReflectionClass</code>
</InvalidReturnType>
<LessSpecificReturnStatement occurrences="4">
<code>$cache</code>
<code>$className</code>
@@ -729,6 +724,9 @@
<LessSpecificReturnStatement occurrences="1">
<code>$mapping</code>
</LessSpecificReturnStatement>
<MoreSpecificImplementedParamType occurrences="1">
<code>$metadata</code>
</MoreSpecificImplementedParamType>
<MoreSpecificReturnType occurrences="1"/>
<PossiblyNullArgument occurrences="1">
<code>$listenerClassName</code>
@@ -749,9 +747,9 @@
</UndefinedInterfaceMethod>
</file>
<file src="lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php">
<ArgumentTypeCoercion occurrences="1">
<code>$metadata</code>
</ArgumentTypeCoercion>
<DocblockTypeContradiction occurrences="1">
<code>new ReflectionClass($metadata-&gt;name)</code>
</DocblockTypeContradiction>
<InvalidArrayAccess occurrences="4">
<code>$value[0]</code>
<code>$value[0]</code>
@@ -761,6 +759,9 @@
<LessSpecificReturnStatement occurrences="1">
<code>$mapping</code>
</LessSpecificReturnStatement>
<MoreSpecificImplementedParamType occurrences="1">
<code>$metadata</code>
</MoreSpecificImplementedParamType>
<MoreSpecificReturnType occurrences="1"/>
<PossiblyNullArgument occurrences="1">
<code>$listenerClassName</code>
@@ -770,27 +771,22 @@
<code>assert($method instanceof ReflectionMethod)</code>
<code>assert($property instanceof ReflectionProperty)</code>
</RedundantCondition>
<RedundantConditionGivenDocblockType occurrences="1">
<RedundantConditionGivenDocblockType occurrences="2">
<code>$metadata-&gt;getReflectionClass()</code>
<code>assert($cacheAttribute instanceof Mapping\Cache)</code>
</RedundantConditionGivenDocblockType>
</file>
<file src="lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php">
<ArgumentTypeCoercion occurrences="3">
<code>$metadata</code>
<code>$metadata</code>
<code>$metadata</code>
</ArgumentTypeCoercion>
<LessSpecificReturnStatement occurrences="2">
<code>$this-&gt;namespace . $this-&gt;classNamesForTables[$tableName]</code>
<code>$this-&gt;namespace . $this-&gt;inflector-&gt;classify(strtolower($tableName))</code>
</LessSpecificReturnStatement>
<MoreSpecificImplementedParamType occurrences="1">
<code>$metadata</code>
</MoreSpecificImplementedParamType>
<MoreSpecificReturnType occurrences="1">
<code>class-string</code>
</MoreSpecificReturnType>
<NoInterfaceProperties occurrences="2">
<code>$metadata-&gt;name</code>
<code>$metadata-&gt;table</code>
</NoInterfaceProperties>
<PossiblyNullArgument occurrences="2">
<code>$this-&gt;tables[$tableName]</code>
<code>$this-&gt;tables[$tableName]</code>
@@ -806,9 +802,9 @@
<code>getColumns</code>
<code>getIndexes</code>
</PossiblyNullReference>
<UndefinedInterfaceMethod occurrences="1">
<code>mapManyToMany</code>
</UndefinedInterfaceMethod>
<PropertyTypeCoercion occurrences="1">
<code>$metadata-&gt;table</code>
</PropertyTypeCoercion>
</file>
<file src="lib/Doctrine/ORM/Mapping/Driver/PHPDriver.php">
<PropertyNotSetInConstructor occurrences="1">
@@ -828,34 +824,41 @@
</MissingParamType>
</file>
<file src="lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php">
<ArgumentTypeCoercion occurrences="1">
<code>$metadata</code>
<ArgumentTypeCoercion occurrences="2">
<code>(string) $xmlRoot['repository-class']</code>
<code>isset($xmlRoot['repository-class']) ? (string) $xmlRoot['repository-class'] : null</code>
</ArgumentTypeCoercion>
<DeprecatedMethod occurrences="2">
<code>addNamedNativeQuery</code>
<code>addNamedQuery</code>
</DeprecatedMethod>
<DocblockTypeContradiction occurrences="3">
<code>$xmlRoot-&gt;getName() === 'embeddable'</code>
<code>$xmlRoot-&gt;getName() === 'entity'</code>
<code>$xmlRoot-&gt;getName() === 'mapped-superclass'</code>
</DocblockTypeContradiction>
<InvalidArgument occurrences="4">
<code>$this-&gt;cacheToArray($manyToManyElement-&gt;cache)</code>
<code>$this-&gt;cacheToArray($manyToOneElement-&gt;cache)</code>
<code>$this-&gt;cacheToArray($oneToManyElement-&gt;cache)</code>
<code>$this-&gt;cacheToArray($oneToOneElement-&gt;cache)</code>
</InvalidArgument>
<InvalidPropertyAssignmentValue occurrences="1">
<code>$metadata-&gt;table</code>
</InvalidPropertyAssignmentValue>
<LessSpecificReturnStatement occurrences="1"/>
<MissingParamType occurrences="2">
<code>$fileExtension</code>
<code>$locator</code>
</MissingParamType>
<MoreSpecificImplementedParamType occurrences="1">
<code>$metadata</code>
</MoreSpecificImplementedParamType>
<MoreSpecificReturnType occurrences="1">
<code>array{usage: int|null, region?: string}</code>
</MoreSpecificReturnType>
<NoInterfaceProperties occurrences="12">
<NoInterfaceProperties occurrences="2">
<code>$indexXml-&gt;options</code>
<code>$metadata-&gt;inheritanceType</code>
<code>$metadata-&gt;isEmbeddedClass</code>
<code>$metadata-&gt;isMappedSuperclass</code>
<code>$metadata-&gt;table</code>
<code>$metadata-&gt;table</code>
<code>$metadata-&gt;table</code>
<code>$metadata-&gt;table</code>
<code>$metadata-&gt;table</code>
<code>$metadata-&gt;table</code>
<code>$metadata-&gt;table</code>
<code>$uniqueXml-&gt;options</code>
</NoInterfaceProperties>
<PossiblyInvalidPropertyFetch occurrences="2">
@@ -883,47 +886,12 @@
<code>isset($xmlRoot-&gt;{'sql-result-set-mappings'})</code>
<code>isset($xmlRoot-&gt;{'unique-constraints'})</code>
</RedundantCondition>
<UndefinedInterfaceMethod occurrences="34">
<code>addEntityListener</code>
<code>addLifecycleCallback</code>
<code>addNamedNativeQuery</code>
<code>addNamedQuery</code>
<code>addSqlResultSetMapping</code>
<code>enableCache</code>
<code>getAssociationCacheDefaults</code>
<code>getAssociationCacheDefaults</code>
<code>getAssociationCacheDefaults</code>
<code>getAssociationCacheDefaults</code>
<code>mapEmbedded</code>
<code>mapField</code>
<code>mapField</code>
<code>mapField</code>
<code>mapManyToMany</code>
<code>mapManyToOne</code>
<code>mapOneToMany</code>
<code>mapOneToOne</code>
<code>markReadOnly</code>
<code>setAssociationOverride</code>
<code>setAttributeOverride</code>
<code>setChangeTrackingPolicy</code>
<code>setCustomGeneratorDefinition</code>
<code>setCustomRepositoryClass</code>
<code>setCustomRepositoryClass</code>
<code>setDiscriminatorColumn</code>
<code>setDiscriminatorColumn</code>
<code>setDiscriminatorMap</code>
<code>setIdGeneratorType</code>
<code>setInheritanceType</code>
<code>setPrimaryTable</code>
<code>setSequenceGeneratorDefinition</code>
<code>setVersionMapping</code>
<code>setVersionMapping</code>
</UndefinedInterfaceMethod>
</file>
<file src="lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php">
<ArgumentTypeCoercion occurrences="1">
<code>$metadata</code>
</ArgumentTypeCoercion>
<DeprecatedMethod occurrences="2">
<code>addNamedNativeQuery</code>
<code>addNamedQuery</code>
</DeprecatedMethod>
<InvalidDocblock occurrences="1">
<code>private function cacheToArray(array $cacheMapping): array</code>
</InvalidDocblock>
@@ -931,14 +899,9 @@
<code>$fileExtension</code>
<code>$locator</code>
</MissingParamType>
<NoInterfaceProperties occurrences="6">
<code>$metadata-&gt;inheritanceType</code>
<code>$metadata-&gt;isEmbeddedClass</code>
<code>$metadata-&gt;isMappedSuperclass</code>
<code>$metadata-&gt;table</code>
<code>$metadata-&gt;table</code>
<code>$metadata-&gt;table</code>
</NoInterfaceProperties>
<MoreSpecificImplementedParamType occurrences="1">
<code>$metadata</code>
</MoreSpecificImplementedParamType>
<PossiblyUndefinedMethod occurrences="18">
<code>$element</code>
<code>$element</code>
@@ -959,7 +922,10 @@
<code>$element</code>
<code>$element</code>
</PossiblyUndefinedMethod>
<UndefinedInterfaceMethod occurrences="43">
<PropertyTypeCoercion occurrences="1">
<code>$metadata-&gt;table</code>
</PropertyTypeCoercion>
<UndefinedInterfaceMethod occurrences="10">
<code>$element</code>
<code>$element</code>
<code>$element</code>
@@ -970,39 +936,6 @@
<code>$element</code>
<code>$element</code>
<code>$element</code>
<code>addEntityListener</code>
<code>addLifecycleCallback</code>
<code>addNamedNativeQuery</code>
<code>addNamedQuery</code>
<code>addSqlResultSetMapping</code>
<code>enableCache</code>
<code>getAssociationCacheDefaults</code>
<code>getAssociationCacheDefaults</code>
<code>getAssociationCacheDefaults</code>
<code>getAssociationCacheDefaults</code>
<code>mapEmbedded</code>
<code>mapField</code>
<code>mapField</code>
<code>mapManyToMany</code>
<code>mapManyToOne</code>
<code>mapOneToMany</code>
<code>mapOneToOne</code>
<code>markReadOnly</code>
<code>setAssociationOverride</code>
<code>setAttributeOverride</code>
<code>setChangeTrackingPolicy</code>
<code>setCustomGeneratorDefinition</code>
<code>setCustomRepositoryClass</code>
<code>setCustomRepositoryClass</code>
<code>setDiscriminatorColumn</code>
<code>setDiscriminatorColumn</code>
<code>setDiscriminatorMap</code>
<code>setIdGeneratorType</code>
<code>setIdGeneratorType</code>
<code>setInheritanceType</code>
<code>setPrimaryTable</code>
<code>setSequenceGeneratorDefinition</code>
<code>setVersionMapping</code>
</UndefinedInterfaceMethod>
</file>
<file src="lib/Doctrine/ORM/Mapping/Embedded.php">
@@ -1049,6 +982,10 @@
</MissingParamType>
</file>
<file src="lib/Doctrine/ORM/Mapping/MappingException.php">
<ArgumentTypeCoercion occurrences="2">
<code>$className</code>
<code>$entityName</code>
</ArgumentTypeCoercion>
<MissingParamType occurrences="4">
<code>$className</code>
<code>$className</code>
@@ -1114,9 +1051,6 @@
</PossiblyFalseOperand>
</file>
<file src="lib/Doctrine/ORM/NativeQuery.php">
<LessSpecificImplementedReturnType occurrences="1">
<code>mixed</code>
</LessSpecificImplementedReturnType>
<PropertyNotSetInConstructor occurrences="1">
<code>$sql</code>
</PropertyNotSetInConstructor>
@@ -1454,9 +1388,6 @@
<InvalidScalarArgument occurrences="1">
<code>$sqlParams</code>
</InvalidScalarArgument>
<LessSpecificImplementedReturnType occurrences="1">
<code>mixed</code>
</LessSpecificImplementedReturnType>
<LessSpecificReturnStatement occurrences="2">
<code>parent::setHint($name, $value)</code>
<code>parent::setHydrationMode($hydrationMode)</code>
@@ -1471,20 +1402,12 @@
<PossiblyNullArgument occurrences="1">
<code>$this-&gt;getDQL()</code>
</PossiblyNullArgument>
<PossiblyNullPropertyAssignmentValue occurrences="1">
<code>$timeToLive</code>
</PossiblyNullPropertyAssignmentValue>
<PossiblyNullReference occurrences="1">
<code>evictEntityRegion</code>
</PossiblyNullReference>
<PropertyNotSetInConstructor occurrences="2">
<PropertyNotSetInConstructor occurrences="1">
<code>$parserResult</code>
<code>$queryCacheTTL</code>
</PropertyNotSetInConstructor>
<RedundantConditionGivenDocblockType occurrences="2">
<code>$dqlQuery !== null</code>
<code>$timeToLive !== null</code>
</RedundantConditionGivenDocblockType>
</file>
<file src="lib/Doctrine/ORM/Query/AST/ArithmeticFactor.php">
<ParamNameMismatch occurrences="1">
@@ -1618,7 +1541,7 @@
</PropertyNotSetInConstructor>
</file>
<file src="lib/Doctrine/ORM/Query/AST/Functions/DateAddFunction.php">
<InvalidScalarArgument occurrences="7">
<ArgumentTypeCoercion occurrences="7">
<code>$this-&gt;intervalExpression-&gt;dispatch($sqlWalker)</code>
<code>$this-&gt;intervalExpression-&gt;dispatch($sqlWalker)</code>
<code>$this-&gt;intervalExpression-&gt;dispatch($sqlWalker)</code>
@@ -1626,7 +1549,7 @@
<code>$this-&gt;intervalExpression-&gt;dispatch($sqlWalker)</code>
<code>$this-&gt;intervalExpression-&gt;dispatch($sqlWalker)</code>
<code>$this-&gt;intervalExpression-&gt;dispatch($sqlWalker)</code>
</InvalidScalarArgument>
</ArgumentTypeCoercion>
<PossiblyInvalidPropertyAssignmentValue occurrences="2">
<code>$parser-&gt;ArithmeticPrimary()</code>
<code>$parser-&gt;ArithmeticPrimary()</code>
@@ -1651,7 +1574,7 @@
</PropertyNotSetInConstructor>
</file>
<file src="lib/Doctrine/ORM/Query/AST/Functions/DateSubFunction.php">
<InvalidScalarArgument occurrences="7">
<ArgumentTypeCoercion occurrences="7">
<code>$this-&gt;intervalExpression-&gt;dispatch($sqlWalker)</code>
<code>$this-&gt;intervalExpression-&gt;dispatch($sqlWalker)</code>
<code>$this-&gt;intervalExpression-&gt;dispatch($sqlWalker)</code>
@@ -1659,7 +1582,7 @@
<code>$this-&gt;intervalExpression-&gt;dispatch($sqlWalker)</code>
<code>$this-&gt;intervalExpression-&gt;dispatch($sqlWalker)</code>
<code>$this-&gt;intervalExpression-&gt;dispatch($sqlWalker)</code>
</InvalidScalarArgument>
</ArgumentTypeCoercion>
<UndefinedPropertyFetch occurrences="1">
<code>$this-&gt;unit-&gt;value</code>
</UndefinedPropertyFetch>
@@ -2040,6 +1963,9 @@
<PropertyNotSetInConstructor occurrences="1">
<code>MultiTableUpdateExecutor</code>
</PropertyNotSetInConstructor>
<PropertyTypeCoercion occurrences="1">
<code>$this-&gt;_sqlStatements</code>
</PropertyTypeCoercion>
</file>
<file src="lib/Doctrine/ORM/Query/Exec/SingleSelectExecutor.php">
<PossiblyInvalidArgument occurrences="1">
@@ -2131,11 +2057,6 @@
<ArgumentTypeCoercion occurrences="1">
<code>$stringPattern</code>
</ArgumentTypeCoercion>
<DocblockTypeContradiction occurrences="3">
<code>call_user_func($functionClass, $functionName)</code>
<code>call_user_func($functionClass, $functionName)</code>
<code>call_user_func($functionClass, $functionName)</code>
</DocblockTypeContradiction>
<InvalidArgument occurrences="1">
<code>$lookaheadType</code>
</InvalidArgument>
@@ -2187,6 +2108,11 @@
<code>$this-&gt;lexer-&gt;token['value']</code>
<code>$this-&gt;lexer-&gt;token['value']</code>
</InvalidScalarArgument>
<InvalidStringClass occurrences="3">
<code>new $functionClass($functionName)</code>
<code>new $functionClass($functionName)</code>
<code>new $functionClass($functionName)</code>
</InvalidStringClass>
<LessSpecificReturnStatement occurrences="4">
<code>$function</code>
<code>$function</code>
@@ -2320,11 +2246,8 @@
<PossiblyUndefinedVariable occurrences="1">
<code>$args</code>
</PossiblyUndefinedVariable>
<RedundantConditionGivenDocblockType occurrences="4">
<RedundantConditionGivenDocblockType occurrences="1">
<code>$AST instanceof AST\SelectStatement</code>
<code>is_string($functionClass)</code>
<code>is_string($functionClass)</code>
<code>is_string($functionClass)</code>
</RedundantConditionGivenDocblockType>
<UnsafeInstantiation occurrences="3">
<code>new $funcClass($funcNameLower)</code>
@@ -2648,7 +2571,8 @@
</RedundantConditionGivenDocblockType>
</file>
<file src="lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php">
<InvalidReturnStatement occurrences="1">
<InvalidReturnStatement occurrences="2">
<code>$this-&gt;repositoryList[$repositoryHash]</code>
<code>$this-&gt;repositoryList[$repositoryHash] = $this-&gt;createRepository($entityManager, $entityName)</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="1">
@@ -2853,21 +2777,12 @@
<code>$this-&gt;getClassToExtend() ?: $metadata-&gt;name</code>
<code>array_map('strlen', $paramTypes)</code>
</ArgumentTypeCoercion>
<DeprecatedConstant occurrences="1">
<code>ClassMetadataInfo::GENERATOR_TYPE_UUID</code>
</DeprecatedConstant>
<DocblockTypeContradiction occurrences="1">
<code>class_exists($metadata-&gt;name)</code>
</DocblockTypeContradiction>
<InvalidDocblock occurrences="1">
<code>public function setFieldVisibility($visibility)</code>
</InvalidDocblock>
<MissingParamType occurrences="1">
<code>$visibility</code>
</MissingParamType>
<MissingReturnType occurrences="1">
<code>setFieldVisibility</code>
</MissingReturnType>
<PossiblyFalseArgument occurrences="2">
<code>$last</code>
<code>strrpos($metadata-&gt;name, '\\')</code>
@@ -3217,8 +3132,7 @@
<code>setValue</code>
<code>setValue</code>
</PossiblyNullReference>
<PossiblyUndefinedMethod occurrences="4">
<code>addPropertyChangedListener</code>
<PossiblyUndefinedMethod occurrences="3">
<code>unwrap</code>
<code>unwrap</code>
<code>unwrap</code>
+15
View File
@@ -24,6 +24,11 @@
<referencedClass name="Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper"/>
<!-- The exception is thrown by a deprecated method. -->
<referencedClass name="Doctrine\ORM\Cache\Exception\InvalidResultCacheDriver"/>
<!-- We wire the command as long as DBAL ships it -->
<referencedClass name="Doctrine\DBAL\Tools\Console\Command\ReservedWordsCommand" />
<!-- Remove on 2.13.x -->
<referencedClass name="Doctrine\DBAL\Schema\Visitor\DropSchemaSqlCollector"/>
<referencedClass name="Doctrine\DBAL\Schema\Visitor\RemoveNamespacedAssets"/>
<!-- Remove on 3.0.x -->
<referencedClass name="Doctrine\Common\Persistence\PersistentObject"/>
<referencedClass name="Doctrine\ORM\Exception\UnknownEntityNamespace"/>
@@ -42,6 +47,9 @@
<file name="lib/Doctrine/ORM/Configuration.php"/>
<file name="lib/Doctrine/ORM/Query/Lexer.php"/>
<file name="lib/Doctrine/ORM/Query/Parser.php"/>
<file name="lib/Doctrine/ORM/Tools/EntityGenerator.php"/>
<!-- Remove on 2.13.x. -->
<file name="lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php" />
</errorLevel>
</DeprecatedConstant>
<DeprecatedInterface>
@@ -53,6 +61,8 @@
<errorLevel type="suppress">
<!-- We're calling the deprecated method for BC here. -->
<file name="lib/Doctrine/ORM/Internal/SQLResultCasing.php"/>
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::getIdentitySequenceName"/>
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::usesSequenceEmulatedIdentityColumns"/>
<!-- We need to keep the calls for DBAL 2.13 compatibility. -->
<referencedMethod name="Doctrine\DBAL\Cache\QueryCacheProfile::getResultCacheDriver"/>
<referencedMethod name="Doctrine\DBAL\Cache\QueryCacheProfile::setResultCacheDriver"/>
@@ -60,6 +70,11 @@
<referencedMethod name="Doctrine\DBAL\Configuration::setResultCacheImpl"/>
<referencedMethod name="Doctrine\DBAL\Connection::getSchemaManager"/>
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::getGuidExpression"/>
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::supportsForeignKeyConstraints"/>
<referencedMethod name="Doctrine\DBAL\Types\Type::getName"/>
<!-- Remove on 2.13.x -->
<referencedMethod name="Doctrine\DBAL\Schema\AbstractSchemaManager::getDatabasePlatform"/>
<referencedMethod name="Doctrine\DBAL\Schema\Schema::visit"/>
<!-- Remove on 3.0.x -->
<referencedMethod name="Doctrine\ORM\Internal\Hydration\AbstractHydrator::hydrateRow"/>
<referencedMethod name="Doctrine\ORM\Configuration::ensureProductionSettings"/>
@@ -6,13 +6,11 @@ namespace Doctrine\Tests\Mocks;
use BadMethodCallException;
use Doctrine\Common\EventManager;
use Doctrine\DBAL\Cache\QueryCacheProfile;
use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Result;
use Exception;
use function is_string;
use function sprintf;
@@ -22,24 +20,9 @@ use function sprintf;
*/
class ConnectionMock extends Connection
{
/** @var mixed */
private $_fetchOneResult;
/** @var Exception|null */
private $_fetchOneException;
/** @var Result|null */
private $_queryResult;
/** @var DatabasePlatformMock */
private $_platformMock;
/** @var int */
private $_lastInsertId = 0;
/** @var array */
private $_inserts = [];
/** @var array */
private $_executeStatements = [];
@@ -51,9 +34,6 @@ class ConnectionMock extends Connection
$this->_platformMock = new DatabasePlatformMock();
parent::__construct($params, $driver ?? new DriverMock(), $config, $eventManager);
// Override possible assignment of platform to database platform mock
$this->_platform = $this->_platformMock;
}
public function getDatabase(): string
@@ -74,7 +54,6 @@ class ConnectionMock extends Connection
*/
public function insert($tableName, array $data, array $types = [])
{
$this->_inserts[$tableName][] = $data;
}
/**
@@ -103,26 +82,6 @@ class ConnectionMock extends Connection
$this->_deletes[] = ['table' => $table, 'criteria' => $criteria, 'types' => $types];
}
/**
* {@inheritdoc}
*/
public function lastInsertId($seqName = null)
{
return $this->_lastInsertId;
}
/**
* {@inheritdoc}
*/
public function fetchOne(string $sql, array $params = [], array $types = [])
{
if ($this->_fetchOneException !== null) {
throw $this->_fetchOneException;
}
return $this->_fetchOneResult;
}
/**
* {@inheritdoc}
*/
@@ -136,11 +95,6 @@ class ConnectionMock extends Connection
throw new BadMethodCallException('Call to deprecated method.');
}
public function executeQuery($sql, array $params = [], $types = [], ?QueryCacheProfile $qcp = null): Result
{
return $this->_queryResult ?? parent::executeQuery($sql, $params, $types, $qcp);
}
/**
* {@inheritdoc}
*/
@@ -153,44 +107,11 @@ class ConnectionMock extends Connection
return $input;
}
/* Mock API */
/**
* @param mixed $fetchOneResult
*/
public function setFetchOneResult($fetchOneResult): void
{
$this->_fetchOneResult = $fetchOneResult;
}
public function setFetchOneException(?Exception $exception = null): void
{
$this->_fetchOneException = $exception;
}
public function setDatabasePlatform(AbstractPlatform $platform): void
{
$this->_platformMock = $platform;
}
public function setLastInsertId(int $id): void
{
$this->_lastInsertId = $id;
}
public function setQueryResult(Result $result): void
{
$this->_queryResult = $result;
}
/**
* @return array
*/
public function getInserts(): array
{
return $this->_inserts;
}
/**
* @return array
*/
@@ -206,10 +127,4 @@ class ConnectionMock extends Connection
{
return $this->_deletes;
}
public function reset(): void
{
$this->_inserts = [];
$this->_lastInsertId = 0;
}
}
@@ -6,7 +6,7 @@ namespace Doctrine\Tests\Models\CMS;
use Doctrine\ORM\Events;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\ColumnResult;
use Doctrine\ORM\Mapping\Entity;
@@ -157,7 +157,7 @@ class CmsAddress
}
}
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->setPrimaryTable(
['name' => 'company_person']
+2 -2
View File
@@ -6,7 +6,7 @@ namespace Doctrine\Tests\Models\CMS;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\ColumnResult;
use Doctrine\ORM\Mapping\Entity;
@@ -336,7 +336,7 @@ class CmsUser
}
}
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->setPrimaryTable(
['name' => 'cms_users']
+2 -2
View File
@@ -8,7 +8,7 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\Cache;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
@@ -136,7 +136,7 @@ class City
return $this->attractions;
}
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
include __DIR__ . '/../../ORM/Mapping/php/Doctrine.Tests.Models.Cache.City.php';
}
@@ -9,7 +9,6 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Events;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\DiscriminatorColumn;
use Doctrine\ORM\Mapping\DiscriminatorMap;
@@ -170,7 +169,7 @@ abstract class CompanyContract
abstract public function calculatePrice(): int;
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->setInheritanceType(ClassMetadata::INHERITANCE_TYPE_JOINED);
$metadata->setTableName('company_contracts');
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Doctrine\Tests\Models\Company;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
@@ -36,7 +36,7 @@ class CompanyFixContract extends CompanyContract
$this->fixPrice = $fixPrice;
}
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->mapField(
[
@@ -6,7 +6,7 @@ namespace Doctrine\Tests\Models\Company;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\EntityResult;
@@ -140,7 +140,7 @@ class CompanyFlexContract extends CompanyContract
$this->managers->removeElement($manager);
}
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->mapField(
[
@@ -6,7 +6,7 @@ namespace Doctrine\Tests\Models\Company;
use Doctrine\ORM\Events;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\EntityListeners;
@@ -42,7 +42,7 @@ class CompanyFlexUltraContract extends CompanyFlexContract
$this->maxPrice = $maxPrice;
}
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->mapField(
[
@@ -6,7 +6,7 @@ namespace Doctrine\Tests\Models\Company;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\DiscriminatorColumn;
use Doctrine\ORM\Mapping\DiscriminatorMap;
@@ -153,7 +153,7 @@ class CompanyPerson
}
}
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->setPrimaryTable(
['name' => 'company_person']
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Doctrine\Tests\Models\DDC1476;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
@@ -48,7 +48,7 @@ class DDC1476EntityWithDefaultFieldType
$this->name = $name;
}
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->mapField(
[
@@ -60,6 +60,6 @@ class DDC1476EntityWithDefaultFieldType
['fieldName' => 'name']
);
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_NONE);
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
}
}
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Doctrine\Tests\Models\DDC3579;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
@@ -105,6 +105,6 @@ class DDC3579User
]
);
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_AUTO);
}
}
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Doctrine\Tests\Models\DDC869;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
@@ -22,7 +22,7 @@ class DDC869ChequePayment extends DDC869Payment
#[ORM\Column(type: 'string')]
protected $serialNumber;
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->mapField(
[
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Doctrine\Tests\Models\DDC869;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
@@ -22,7 +22,7 @@ class DDC869CreditCardPayment extends DDC869Payment
#[ORM\Column(type: 'string')]
protected $creditCardNumber;
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->mapField(
[
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Doctrine\Tests\Models\DDC869;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
@@ -33,7 +33,7 @@ class DDC869Payment
#[ORM\Column(type: 'float')]
protected $value;
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->mapField(
[
@@ -51,6 +51,6 @@ class DDC869Payment
);
$metadata->isMappedSuperclass = true;
$metadata->setCustomRepositoryClass(DDC869PaymentRepository::class);
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_AUTO);
}
}
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Doctrine\Tests\Models\DDC889;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
@@ -19,7 +19,7 @@ class DDC889Class extends DDC889SuperClass
*/
protected $id;
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->mapField(
[
@@ -30,6 +30,6 @@ class DDC889Class extends DDC889SuperClass
]
);
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_AUTO);
}
}
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Doctrine\Tests\Models\DDC889;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Entity;
/**
@@ -14,7 +14,7 @@ use Doctrine\ORM\Mapping\Entity;
#[ORM\Entity]
class DDC889Entity extends DDC889SuperClass
{
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
}
}
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Doctrine\Tests\Models\DDC889;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\MappedSuperclass;
@@ -22,13 +22,13 @@ class DDC889SuperClass
#[ORM\Column]
protected $name;
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->mapField(
['fieldName' => 'name']
);
$metadata->isMappedSuperclass = true;
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_NONE);
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
}
}
@@ -6,7 +6,7 @@ namespace Doctrine\Tests\Models\DDC964;
use Doctrine\ORM\Mapping\AssociationOverride;
use Doctrine\ORM\Mapping\AssociationOverrides;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\JoinColumn;
use Doctrine\ORM\Mapping\JoinTable;
@@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping\JoinTable;
#[AssociationOverrides([new AssociationOverride(name: 'groups', joinTable: new JoinTable(name: 'ddc964_users_admingroups'), joinColumns: [new JoinColumn(name: 'adminuser_id')], inverseJoinColumns: [new JoinColumn(name: 'admingroup_id')]), new AssociationOverride(name: 'address', joinColumns: [new JoinColumn(name: 'adminaddress_id', referencedColumnName: 'id')])])]
class DDC964Admin extends DDC964User
{
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->setAssociationOverride(
'address',
@@ -6,7 +6,7 @@ namespace Doctrine\Tests\Models\DDC964;
use Doctrine\ORM\Mapping\AttributeOverride;
use Doctrine\ORM\Mapping\AttributeOverrides;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
@@ -34,7 +34,7 @@ use Doctrine\ORM\Mapping\Entity;
#[AttributeOverrides([new AttributeOverride(name: 'id', column: new Column(name: 'guest_id', type: 'integer', length: 140)), new AttributeOverride(name: 'name', column: new Column(name: 'guest_name', nullable: false, unique: true, length: 240))])]
class DDC964Guest extends DDC964User
{
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->setAttributeOverride('id', [
'columnName' => 'guest_id',
@@ -6,7 +6,7 @@ namespace Doctrine\Tests\Models\DDC964;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
@@ -107,7 +107,7 @@ class DDC964User
$this->address = $address;
}
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->isMappedSuperclass = true;
@@ -164,6 +164,6 @@ class DDC964User
]
);
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_AUTO);
}
}
@@ -6,7 +6,7 @@ namespace Doctrine\Tests\Models\Enums;
enum AccessLevel: int
{
case Admin = 1;
case User = 2;
case Admin = 1;
case User = 2;
case Guests = 3;
}
+2 -2
View File
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Doctrine\Tests\Models\Enums;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
@@ -28,7 +28,7 @@ class Card
#[Column(type: 'string', enumType: Suit::class)]
public $suit;
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->mapField(
[
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Doctrine\Tests\Models\Enums;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
@@ -28,7 +28,7 @@ class CardWithNullable
#[Column(type: 'string', nullable: true, enumType: Suit::class)]
public $suit;
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->mapField(
[
+2 -2
View File
@@ -6,7 +6,7 @@ namespace Doctrine\Tests\Models\Enums;
enum City: string
{
case Paris = 'Paris';
case Cannes = 'Cannes';
case Paris = 'Paris';
case Cannes = 'Cannes';
case StJulien = 'St Julien';
}
+2 -2
View File
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Doctrine\Tests\Models\Enums;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
@@ -28,7 +28,7 @@ class Scale
#[Column(type: 'simple_array', enumType: Unit::class)]
public $supportedUnits;
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->mapField(
[
+3 -3
View File
@@ -6,8 +6,8 @@ namespace Doctrine\Tests\Models\Enums;
enum Suit: string
{
case Hearts = 'H';
case Hearts = 'H';
case Diamonds = 'D';
case Clubs = 'C';
case Spades = 'S';
case Clubs = 'C';
case Spades = 'S';
}
+1 -1
View File
@@ -6,6 +6,6 @@ namespace Doctrine\Tests\Models\Enums;
enum Unit: string
{
case Gram = 'g';
case Gram = 'g';
case Meter = 'm';
}
@@ -6,6 +6,6 @@ namespace Doctrine\Tests\Models\Enums;
enum UserStatus: string
{
case Active = 'active';
case Active = 'active';
case Inactive = 'inactive';
}
@@ -8,7 +8,7 @@ use DateInterval;
use DateTime;
use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Embedded;
use Doctrine\ORM\Mapping\Entity;
@@ -82,9 +82,9 @@ class UserTyped
#[ORM\Embedded]
public ?Contact $contact = null;
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_NONE);
$metadata->setInheritanceType(ClassMetadata::INHERITANCE_TYPE_NONE);
$metadata->setPrimaryTable(
['name' => 'cms_users_typed']
);
@@ -95,7 +95,7 @@ class UserTyped
'fieldName' => 'id',
]
);
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_AUTO);
$metadata->mapField(
[
@@ -5,7 +5,6 @@ declare(strict_types=1);
namespace Doctrine\Tests\Models\Upsertable;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
@@ -62,7 +61,7 @@ class Insertable
'fieldName' => 'nonInsertableContent',
'notInsertable' => true,
'options' => ['default' => '1234'],
'generated' => ClassMetadataInfo::GENERATED_INSERT,
'generated' => ClassMetadata::GENERATED_INSERT,
]
);
$metadata->mapField(
@@ -5,7 +5,6 @@ declare(strict_types=1);
namespace Doctrine\Tests\Models\Upsertable;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
@@ -60,7 +59,7 @@ class Updatable
[
'fieldName' => 'nonUpdatableContent',
'notUpdatable' => true,
'generated' => ClassMetadataInfo::GENERATED_ALWAYS,
'generated' => ClassMetadata::GENERATED_ALWAYS,
]
);
$metadata->mapField(
@@ -1209,7 +1209,7 @@ class BasicFunctionalTest extends OrmFunctionalTestCase
$article1 = new CmsArticle();
$article1->topic = 'Foo';
$article1->text = 'Foo Text';
$article1->author = $user;
$article1->user = $user;
$user->articles[] = $article1;
$this->expectException(InvalidArgumentException::class);
@@ -9,7 +9,7 @@ use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\Table;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use function array_change_key_case;
use function count;
@@ -117,7 +117,7 @@ class DatabaseDriverTest extends DatabaseDriverTestCase
$bazMetadata->associationMappings = array_change_key_case($bazMetadata->associationMappings, CASE_LOWER);
self::assertArrayHasKey('bar', $bazMetadata->associationMappings);
self::assertEquals(ClassMetadataInfo::MANY_TO_ONE, $bazMetadata->associationMappings['bar']['type']);
self::assertEquals(ClassMetadata::MANY_TO_ONE, $bazMetadata->associationMappings['bar']['type']);
}
public function testDetectManyToManyTables(): void
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Doctrine\Tests\ORM\Functional;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Driver\DatabaseDriver;
use Doctrine\Tests\OrmFunctionalTestCase;
@@ -21,7 +21,7 @@ use function strtolower;
abstract class DatabaseDriverTestCase extends OrmFunctionalTestCase
{
/**
* @psalm-return array<string, ClassMetadataInfo>
* @psalm-return array<string, ClassMetadata>
*/
protected function convertToClassMetadata(array $entityTables, array $manyTables = []): array
{
@@ -31,7 +31,7 @@ abstract class DatabaseDriverTestCase extends OrmFunctionalTestCase
$metadatas = [];
foreach ($driver->getAllClassNames() as $className) {
$class = new ClassMetadataInfo($className);
$class = new ClassMetadata($className);
$driver->loadMetadataForClass($className, $class);
$metadatas[$className] = $class;
}
@@ -42,7 +42,7 @@ abstract class DatabaseDriverTestCase extends OrmFunctionalTestCase
/**
* @param string[] $classNames
*
* @psalm-return array<class-string, ClassMetadataInfo>
* @psalm-return array<class-string, ClassMetadata>
*/
protected function extractClassMetadata(array $classNames): array
{
@@ -57,7 +57,7 @@ abstract class DatabaseDriverTestCase extends OrmFunctionalTestCase
continue;
}
$class = new ClassMetadataInfo($className);
$class = new ClassMetadata($className);
$driver->loadMetadataForClass($className, $class);
$metadatas[$className] = $class;
}
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Doctrine\Tests\ORM\Functional;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\Tests\Models\CMS\CmsArticle;
use Doctrine\Tests\Models\CMS\CmsGroup;
use Doctrine\Tests\Models\CMS\CmsPhonenumber;
@@ -51,6 +51,9 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
/** @var CmsPhonenumber */
private $phonenumber;
/** @var array<string, mixed> */
private $previousCacheConfig = [];
protected function setUp(): void
{
$this->useModelSet('tweet');
@@ -59,11 +62,11 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
parent::setUp();
$class = $this->_em->getClassMetadata(CmsUser::class);
$class->associationMappings['groups']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY;
$class->associationMappings['groups']['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY;
$class->associationMappings['groups']['indexBy'] = 'name';
$class->associationMappings['articles']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY;
$class->associationMappings['articles']['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY;
$class->associationMappings['articles']['indexBy'] = 'topic';
$class->associationMappings['phonenumbers']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY;
$class->associationMappings['phonenumbers']['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY;
$class->associationMappings['phonenumbers']['indexBy'] = 'phonenumber';
foreach (['phonenumbers', 'articles', 'users'] as $field) {
@@ -75,7 +78,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
}
$class = $this->_em->getClassMetadata(CmsGroup::class);
$class->associationMappings['users']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY;
$class->associationMappings['users']['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY;
$class->associationMappings['users']['indexBy'] = 'username';
$this->loadFixture();
@@ -86,9 +89,9 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
parent::tearDown();
$class = $this->_em->getClassMetadata(CmsUser::class);
$class->associationMappings['groups']['fetch'] = ClassMetadataInfo::FETCH_LAZY;
$class->associationMappings['articles']['fetch'] = ClassMetadataInfo::FETCH_LAZY;
$class->associationMappings['phonenumbers']['fetch'] = ClassMetadataInfo::FETCH_LAZY;
$class->associationMappings['groups']['fetch'] = ClassMetadata::FETCH_LAZY;
$class->associationMappings['articles']['fetch'] = ClassMetadata::FETCH_LAZY;
$class->associationMappings['phonenumbers']['fetch'] = ClassMetadata::FETCH_LAZY;
foreach (['phonenumbers', 'articles', 'users'] as $field) {
if (isset($this->previousCacheConfig[$field])) {
@@ -102,7 +105,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
unset($class->associationMappings['phonenumbers']['indexBy']);
$class = $this->_em->getClassMetadata(CmsGroup::class);
$class->associationMappings['users']['fetch'] = ClassMetadataInfo::FETCH_LAZY;
$class->associationMappings['users']['fetch'] = ClassMetadata::FETCH_LAZY;
unset($class->associationMappings['users']['indexBy']);
}
@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace Doctrine\Tests\ORM\Functional;
use Doctrine\ORM\Tools\ToolsException;
use Doctrine\Tests\Models\Upsertable\Insertable;
use Doctrine\Tests\Models\Upsertable\Updatable;
use Doctrine\Tests\OrmFunctionalTestCase;
@@ -15,15 +14,7 @@ class InsertableUpdatableTest extends OrmFunctionalTestCase
{
parent::setUp();
try {
$this->_schemaTool->createSchema(
[
$this->_em->getClassMetadata(Updatable::class),
$this->_em->getClassMetadata(Insertable::class),
]
);
} catch (ToolsException $e) {
}
$this->createSchemaForModels(Updatable::class, Insertable::class);
}
public function testNotInsertableIsFetchedFromDatabase(): void
@@ -23,8 +23,6 @@ class LockTest extends OrmFunctionalTestCase
{
$this->useModelSet('cms');
parent::setUp();
$this->handles = [];
}
/**
@@ -21,7 +21,7 @@ use const DIRECTORY_SEPARATOR;
*/
class ManyToOneOrphanRemovalTest extends OrmFunctionalTestCase
{
/** @var int */
/** @var string */
private $personId;
/** @var array<string, list<class-string>> */
@@ -16,11 +16,9 @@ class MergeCompositeToOneKeyTest extends OrmFunctionalTestCase
{
parent::setUp();
$this->_schemaTool->createSchema(
[
$this->_em->getClassMetadata(Country::class),
$this->_em->getClassMetadata(CompositeToOneKeyState::class),
]
$this->createSchemaForModels(
Country::class,
CompositeToOneKeyState::class
);
}
@@ -10,7 +10,6 @@ use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\ManyToOne;
use Doctrine\ORM\Mapping\MappedSuperclass;
use Doctrine\ORM\Tools\ToolsException;
use Doctrine\Tests\OrmFunctionalTestCase;
use function serialize;
@@ -22,15 +21,7 @@ class MergeSharedEntitiesTest extends OrmFunctionalTestCase
{
parent::setUp();
try {
$this->_schemaTool->createSchema(
[
$this->_em->getClassMetadata(MSEFile::class),
$this->_em->getClassMetadata(MSEPicture::class),
]
);
} catch (ToolsException $ignored) {
}
$this->createSchemaForModels(MSEFile::class, MSEPicture::class);
}
public function testMergeSharedNewEntities(): void
@@ -30,10 +30,7 @@ class NotifyPolicyTest extends OrmFunctionalTestCase
$this->expectDeprecationWithIdentifier('https://github.com/doctrine/orm/issues/8383');
$this->_schemaTool->createSchema([
$this->_em->getClassMetadata(NotifyUser::class),
$this->_em->getClassMetadata(NotifyGroup::class),
]);
$this->createSchemaForModels(NotifyUser::class, NotifyGroup::class);
}
public function testChangeTracking(): void
@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace Doctrine\Tests\ORM\Functional;
use Doctrine\ORM\Tools\ToolsException;
use Doctrine\Tests\Models\OneToOneInverseSideLoad\InverseSide;
use Doctrine\Tests\Models\OneToOneInverseSideLoad\OwningSide;
use Doctrine\Tests\OrmFunctionalTestCase;
@@ -17,14 +16,7 @@ class OneToOneInverseSideLoadAfterDqlQueryTest extends OrmFunctionalTestCase
{
parent::setUp();
try {
$this->_schemaTool->createSchema([
$this->_em->getClassMetadata(OwningSide::class),
$this->_em->getClassMetadata(InverseSide::class),
]);
} catch (ToolsException $e) {
// ignored
}
$this->createSchemaForModels(OwningSide::class, InverseSide::class);
}
/**
@@ -98,9 +98,7 @@ class OneToOneSelfReferentialAssociationTest extends OrmFunctionalTestCase
public function testMultiSelfReference(): void
{
$this->_schemaTool->createSchema([
$this->_em->getClassMetadata(MultiSelfReference::class),
]);
$this->createSchemaForModels(MultiSelfReference::class);
$entity1 = new MultiSelfReference();
$this->_em->persist($entity1);
@@ -17,11 +17,11 @@ class OneToOneSingleTableInheritanceTest extends OrmFunctionalTestCase
{
parent::setUp();
$this->_schemaTool->createSchema([
$this->_em->getClassMetadata(Pet::class),
$this->_em->getClassMetadata(Cat::class),
$this->_em->getClassMetadata(LitterBox::class),
]);
$this->createSchemaForModels(
Pet::class,
Cat::class,
LitterBox::class
);
}
/**
@@ -27,11 +27,11 @@ class OrderedJoinedTableInheritanceCollectionTest extends OrmFunctionalTestCase
protected function setUp(): void
{
parent::setUp();
$this->_schemaTool->createSchema([
$this->_em->getClassMetadata(OJTICPet::class),
$this->_em->getClassMetadata(OJTICCat::class),
$this->_em->getClassMetadata(OJTICDog::class),
]);
$this->createSchemaForModels(
OJTICPet::class,
OJTICCat::class,
OJTICDog::class
);
$dog = new OJTICDog();
$dog->name = 'Poofy';
@@ -5,7 +5,6 @@ declare(strict_types=1);
namespace Doctrine\Tests\ORM\Functional;
use Doctrine\Common\Util\ClassUtils;
use Doctrine\ORM\Proxy\ProxyFactory;
use Doctrine\Persistence\Proxy;
use Doctrine\Tests\Models\Company\CompanyAuction;
use Doctrine\Tests\Models\ECommerce\ECommerceProduct;
@@ -31,12 +30,6 @@ class ReferenceProxyTest extends OrmFunctionalTestCase
$this->useModelSet('ecommerce');
$this->useModelSet('company');
parent::setUp();
$this->_factory = new ProxyFactory(
$this->_em,
__DIR__ . '/../../Proxies',
'Doctrine\Tests\Proxies',
true
);
}
public function createProduct(): int
@@ -9,7 +9,6 @@ use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Configuration;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Query\Filter\FilterException;
use Doctrine\ORM\Query\Filter\SQLFilter;
use Doctrine\ORM\Query\FilterCollection;
@@ -93,8 +92,8 @@ class SQLFilterTest extends OrmFunctionalTestCase
parent::tearDown();
$class = $this->_em->getClassMetadata(CmsUser::class);
$class->associationMappings['groups']['fetch'] = ClassMetadataInfo::FETCH_LAZY;
$class->associationMappings['articles']['fetch'] = ClassMetadataInfo::FETCH_LAZY;
$class->associationMappings['groups']['fetch'] = ClassMetadata::FETCH_LAZY;
$class->associationMappings['articles']['fetch'] = ClassMetadata::FETCH_LAZY;
}
public function testConfigureFilter(): void
@@ -589,8 +588,8 @@ class SQLFilterTest extends OrmFunctionalTestCase
private function loadLazyFixtureData(): void
{
$class = $this->_em->getClassMetadata(CmsUser::class);
$class->associationMappings['articles']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY;
$class->associationMappings['groups']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY;
$class->associationMappings['articles']['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY;
$class->associationMappings['groups']['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY;
$this->loadFixtureData();
}
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Doctrine\Tests\ORM\Functional\SchemaTool;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Tests\Models\Company\CompanyManager;
use Doctrine\Tests\OrmFunctionalTestCase;
@@ -55,8 +56,8 @@ class CompanySchemaTest extends OrmFunctionalTestCase
*/
public function testDropPartSchemaWithForeignKeys(): void
{
if (! $this->_em->getConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) {
self::markTestSkipped('Foreign Key test');
if ($this->_em->getConnection()->getDatabasePlatform() instanceof SqlitePlatform) {
self::markTestSkipped('SQLite does not support dropping foreign keys.');
}
$sql = $this->_schemaTool->getDropSchemaSQL(
@@ -8,7 +8,6 @@ use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Tools;
use Doctrine\Tests\OrmFunctionalTestCase;
use function array_filter;
@@ -16,25 +15,16 @@ use function str_contains;
class DBAL483Test extends OrmFunctionalTestCase
{
protected function setUp(): void
{
parent::setUp();
$this->_em->getConnection();
$this->schemaTool = new Tools\SchemaTool($this->_em);
}
/**
* @group DBAL-483
*/
public function testDefaultValueIsComparedCorrectly(): void
{
$class = $this->_em->getClassMetadata(DBAL483Default::class);
$class = DBAL483Default::class;
$this->schemaTool->createSchema([$class]);
$this->createSchemaForModels($class);
$updateSql = $this->schemaTool->getUpdateSchemaSql([$class]);
$updateSql = $this->getUpdateSchemaSqlForModels($class);
$updateSql = array_filter($updateSql, static function ($sql) {
return str_contains($sql, 'DBAL483');
@@ -6,10 +6,8 @@ namespace Doctrine\Tests\ORM\Functional\SchemaTool;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\ORM\Tools;
use Doctrine\Tests\Models;
use Doctrine\Tests\OrmFunctionalTestCase;
use Exception;
use function array_filter;
use function implode;
@@ -23,12 +21,6 @@ use const PHP_EOL;
*/
class DDC214Test extends OrmFunctionalTestCase
{
/** @psalm-var list<class-string> */
private $classes = [];
/** @var Tools\SchemaTool */
private $schemaTool = null;
protected function setUp(): void
{
parent::setUp();
@@ -38,8 +30,6 @@ class DDC214Test extends OrmFunctionalTestCase
if ($conn->getDriver()->getDatabasePlatform() instanceof SqlitePlatform) {
self::markTestSkipped('SQLite does not support ALTER TABLE statements.');
}
$this->schemaTool = new Tools\SchemaTool($this->_em);
}
/**
@@ -47,16 +37,14 @@ class DDC214Test extends OrmFunctionalTestCase
*/
public function testCmsAddressModel(): void
{
$this->classes = [
$this->assertCreatedSchemaNeedsNoUpdates(
Models\CMS\CmsUser::class,
Models\CMS\CmsPhonenumber::class,
Models\CMS\CmsAddress::class,
Models\CMS\CmsGroup::class,
Models\CMS\CmsArticle::class,
Models\CMS\CmsEmail::class,
];
$this->assertCreatedSchemaNeedsNoUpdates($this->classes);
Models\CMS\CmsEmail::class
);
}
/**
@@ -64,7 +52,7 @@ class DDC214Test extends OrmFunctionalTestCase
*/
public function testCompanyModel(): void
{
$this->classes = [
$this->assertCreatedSchemaNeedsNoUpdates(
Models\Company\CompanyPerson::class,
Models\Company\CompanyEmployee::class,
Models\Company\CompanyManager::class,
@@ -72,29 +60,21 @@ class DDC214Test extends OrmFunctionalTestCase
Models\Company\CompanyEvent::class,
Models\Company\CompanyAuction::class,
Models\Company\CompanyRaffle::class,
Models\Company\CompanyCar::class,
];
$this->assertCreatedSchemaNeedsNoUpdates($this->classes);
Models\Company\CompanyCar::class
);
}
public function assertCreatedSchemaNeedsNoUpdates($classes): void
/**
* @param class-string ...$classes
*/
public function assertCreatedSchemaNeedsNoUpdates(string ...$classes): void
{
$classMetadata = [];
foreach ($classes as $class) {
$classMetadata[] = $this->_em->getClassMetadata($class);
}
try {
$this->schemaTool->createSchema($classMetadata);
} catch (Exception $e) {
// was already created
}
$this->createSchemaForModels(...$classes);
$sm = $this->createSchemaManager();
$fromSchema = $sm->createSchema();
$toSchema = $this->schemaTool->getSchemaFromMetadata($classMetadata);
$toSchema = $this->getSchemaForModels(...$classes);
if (method_exists($sm, 'createComparator')) {
$comparator = $sm->createComparator();
@@ -12,12 +12,10 @@ use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\JoinColumn;
use Doctrine\ORM\Mapping\ManyToOne;
use Doctrine\ORM\Mapping\Table;
use Doctrine\ORM\Tools\SchemaTool;
use Doctrine\Tests\Models;
use Doctrine\Tests\OrmFunctionalTestCase;
use function array_filter;
use function array_shift;
use function implode;
use function str_starts_with;
@@ -40,108 +38,15 @@ class PostgreSqlSchemaToolTest extends OrmFunctionalTestCase
self::assertEquals(1, $address->sequenceGeneratorDefinition['allocationSize']);
}
public function testGetCreateSchemaSql(): void
{
$classes = [
$this->_em->getClassMetadata(Models\CMS\CmsAddress::class),
$this->_em->getClassMetadata(Models\CMS\CmsUser::class),
$this->_em->getClassMetadata(Models\CMS\CmsPhonenumber::class),
];
$tool = new SchemaTool($this->_em);
$sql = $tool->getCreateSchemaSql($classes);
self::assertCount(22, $sql, 'Total of 22 queries should be executed');
self::assertEquals('CREATE TABLE cms_addresses (id INT NOT NULL, user_id INT DEFAULT NULL, country VARCHAR(50) NOT NULL, zip VARCHAR(50) NOT NULL, city VARCHAR(50) NOT NULL, PRIMARY KEY(id))', array_shift($sql));
self::assertEquals('CREATE UNIQUE INDEX UNIQ_ACAC157BA76ED395 ON cms_addresses (user_id)', array_shift($sql));
self::assertEquals('CREATE TABLE cms_users (id INT NOT NULL, email_id INT DEFAULT NULL, status VARCHAR(50) DEFAULT NULL, username VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))', array_shift($sql));
self::assertEquals('CREATE UNIQUE INDEX UNIQ_3AF03EC5F85E0677 ON cms_users (username)', array_shift($sql));
self::assertEquals('CREATE UNIQUE INDEX UNIQ_3AF03EC5A832C1C9 ON cms_users (email_id)', array_shift($sql));
self::assertEquals('CREATE TABLE cms_users_groups (user_id INT NOT NULL, group_id INT NOT NULL, PRIMARY KEY(user_id, group_id))', array_shift($sql));
self::assertEquals('CREATE INDEX IDX_7EA9409AA76ED395 ON cms_users_groups (user_id)', array_shift($sql));
self::assertEquals('CREATE INDEX IDX_7EA9409AFE54D947 ON cms_users_groups (group_id)', array_shift($sql));
self::assertEquals('CREATE TABLE cms_users_tags (user_id INT NOT NULL, tag_id INT NOT NULL, PRIMARY KEY(user_id, tag_id))', array_shift($sql));
self::assertEquals('CREATE INDEX IDX_93F5A1ADA76ED395 ON cms_users_tags (user_id)', array_shift($sql));
self::assertEquals('CREATE INDEX IDX_93F5A1ADBAD26311 ON cms_users_tags (tag_id)', array_shift($sql));
self::assertEquals('CREATE TABLE cms_phonenumbers (phonenumber VARCHAR(50) NOT NULL, user_id INT DEFAULT NULL, PRIMARY KEY(phonenumber))', array_shift($sql));
self::assertEquals('CREATE INDEX IDX_F21F790FA76ED395 ON cms_phonenumbers (user_id)', array_shift($sql));
self::assertEquals('CREATE SEQUENCE cms_addresses_id_seq INCREMENT BY 1 MINVALUE 1 START 1', array_shift($sql));
self::assertEquals('CREATE SEQUENCE cms_users_id_seq INCREMENT BY 1 MINVALUE 1 START 1', array_shift($sql));
self::assertEquals('ALTER TABLE cms_addresses ADD CONSTRAINT FK_ACAC157BA76ED395 FOREIGN KEY (user_id) REFERENCES cms_users (id) NOT DEFERRABLE INITIALLY IMMEDIATE', array_shift($sql));
self::assertEquals('ALTER TABLE cms_users ADD CONSTRAINT FK_3AF03EC5A832C1C9 FOREIGN KEY (email_id) REFERENCES cms_emails (id) NOT DEFERRABLE INITIALLY IMMEDIATE', array_shift($sql));
self::assertEquals('ALTER TABLE cms_users_groups ADD CONSTRAINT FK_7EA9409AA76ED395 FOREIGN KEY (user_id) REFERENCES cms_users (id) NOT DEFERRABLE INITIALLY IMMEDIATE', array_shift($sql));
self::assertEquals('ALTER TABLE cms_users_groups ADD CONSTRAINT FK_7EA9409AFE54D947 FOREIGN KEY (group_id) REFERENCES cms_groups (id) NOT DEFERRABLE INITIALLY IMMEDIATE', array_shift($sql));
self::assertEquals('ALTER TABLE cms_users_tags ADD CONSTRAINT FK_93F5A1ADA76ED395 FOREIGN KEY (user_id) REFERENCES cms_users (id) NOT DEFERRABLE INITIALLY IMMEDIATE', array_shift($sql));
self::assertEquals('ALTER TABLE cms_users_tags ADD CONSTRAINT FK_93F5A1ADBAD26311 FOREIGN KEY (tag_id) REFERENCES cms_tags (id) NOT DEFERRABLE INITIALLY IMMEDIATE', array_shift($sql));
self::assertEquals('ALTER TABLE cms_phonenumbers ADD CONSTRAINT FK_F21F790FA76ED395 FOREIGN KEY (user_id) REFERENCES cms_users (id) NOT DEFERRABLE INITIALLY IMMEDIATE', array_shift($sql));
self::assertEquals([], $sql, 'SQL Array should be empty now.');
}
public function testGetCreateSchemaSql2(): void
{
$classes = [$this->_em->getClassMetadata(Models\Generic\DecimalModel::class)];
$tool = new SchemaTool($this->_em);
$sql = $tool->getCreateSchemaSql($classes);
self::assertCount(2, $sql);
self::assertEquals('CREATE TABLE decimal_model (id INT NOT NULL, "decimal" NUMERIC(5, 2) NOT NULL, "high_scale" NUMERIC(14, 4) NOT NULL, PRIMARY KEY(id))', $sql[0]);
self::assertEquals('CREATE SEQUENCE decimal_model_id_seq INCREMENT BY 1 MINVALUE 1 START 1', $sql[1]);
}
public function testGetCreateSchemaSql3(): void
{
$classes = [$this->_em->getClassMetadata(Models\Generic\BooleanModel::class)];
$tool = new SchemaTool($this->_em);
$sql = $tool->getCreateSchemaSql($classes);
self::assertCount(2, $sql);
self::assertEquals('CREATE TABLE boolean_model (id INT NOT NULL, booleanField BOOLEAN NOT NULL, PRIMARY KEY(id))', $sql[0]);
self::assertEquals('CREATE SEQUENCE boolean_model_id_seq INCREMENT BY 1 MINVALUE 1 START 1', $sql[1]);
}
public function testGetDropSchemaSql(): void
{
$classes = [
$this->_em->getClassMetadata(Models\CMS\CmsAddress::class),
$this->_em->getClassMetadata(Models\CMS\CmsUser::class),
$this->_em->getClassMetadata(Models\CMS\CmsPhonenumber::class),
];
$tool = new SchemaTool($this->_em);
$sql = $tool->getDropSchemaSQL($classes);
self::assertCount(17, $sql);
$dropSequenceSQLs = 0;
foreach ($sql as $stmt) {
if (str_starts_with($stmt, 'DROP SEQUENCE')) {
$dropSequenceSQLs++;
}
}
self::assertEquals(4, $dropSequenceSQLs, 'Expect 4 sequences to be dropped.');
}
/**
* @group DDC-1657
*/
public function testUpdateSchemaWithPostgreSQLSchema(): void
{
$classes = [
$this->_em->getClassMetadata(DDC1657Screen::class),
$this->_em->getClassMetadata(DDC1657Avatar::class),
];
$tool = new SchemaTool($this->_em);
$tool->createSchema($classes);
$sql = $tool->getUpdateSchemaSql($classes);
$sql = $this->getUpdateSchemaSqlForModels(
DDC1657Screen::class,
DDC1657Avatar::class
);
$sql = array_filter($sql, static function ($sql) {
return str_starts_with($sql, 'DROP SEQUENCE stonewood.');
});
@@ -23,9 +23,7 @@ class SequenceEmulatedIdentityStrategyTest extends OrmFunctionalTestCase
'This test is special to platforms emulating IDENTITY key generation strategy through sequences.'
);
} else {
$this->_schemaTool->createSchema(
[$this->_em->getClassMetadata(SequenceEmulatedIdentityEntity::class)]
);
$this->createSchemaForModels(SequenceEmulatedIdentityEntity::class);
}
}
@@ -24,12 +24,10 @@ class DDC1080Test extends OrmFunctionalTestCase
{
public function testHydration(): void
{
$this->_schemaTool->createSchema(
[
$this->_em->getClassMetadata(DDC1080Foo::class),
$this->_em->getClassMetadata(DDC1080Bar::class),
$this->_em->getClassMetadata(DDC1080FooBar::class),
]
$this->createSchemaForModels(
DDC1080Foo::class,
DDC1080Bar::class,
DDC1080FooBar::class
);
$foo1 = new DDC1080Foo();
@@ -1,82 +0,0 @@
<?php
declare(strict_types=1);
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\ManyToMany;
use Doctrine\ORM\Mapping\Table;
use Doctrine\Tests\OrmFunctionalTestCase;
/**
* @group DDC-1151
*/
class DDC1151Test extends OrmFunctionalTestCase
{
public function testQuoteForeignKey(): void
{
$platform = $this->_em->getConnection()->getDatabasePlatform();
if (! $platform instanceof PostgreSQLPlatform) {
self::markTestSkipped('This test is useful for all databases, but designed only for postgresql.');
}
$sql = $this->_schemaTool->getCreateSchemaSql(
[
$this->_em->getClassMetadata(DDC1151User::class),
$this->_em->getClassMetadata(DDC1151Group::class),
]
);
self::assertEquals('CREATE TABLE "User" (id INT NOT NULL, PRIMARY KEY(id))', $sql[0]);
self::assertEquals('CREATE TABLE ddc1151user_ddc1151group (ddc1151user_id INT NOT NULL, ddc1151group_id INT NOT NULL, PRIMARY KEY(ddc1151user_id, ddc1151group_id))', $sql[1]);
self::assertEquals('CREATE INDEX IDX_88A3259AC5AD08A ON ddc1151user_ddc1151group (ddc1151user_id)', $sql[2]);
self::assertEquals('CREATE INDEX IDX_88A32597357E0B1 ON ddc1151user_ddc1151group (ddc1151group_id)', $sql[3]);
self::assertEquals('CREATE TABLE "Group" (id INT NOT NULL, PRIMARY KEY(id))', $sql[4]);
self::assertEquals('CREATE SEQUENCE "User_id_seq" INCREMENT BY 1 MINVALUE 1 START 1', $sql[5]);
self::assertEquals('CREATE SEQUENCE "Group_id_seq" INCREMENT BY 1 MINVALUE 1 START 1', $sql[6]);
self::assertEquals('ALTER TABLE ddc1151user_ddc1151group ADD CONSTRAINT FK_88A3259AC5AD08A FOREIGN KEY (ddc1151user_id) REFERENCES "User" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE', $sql[7]);
self::assertEquals('ALTER TABLE ddc1151user_ddc1151group ADD CONSTRAINT FK_88A32597357E0B1 FOREIGN KEY (ddc1151group_id) REFERENCES "Group" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE', $sql[8]);
}
}
/**
* @Entity
* @Table(name="`User`")
*/
class DDC1151User
{
/**
* @var int
* @Id
* @Column(type="integer")
* @GeneratedValue
*/
public $id;
/**
* @psalm-var Collection<int, DDC1151Group>
* @ManyToMany(targetEntity="DDC1151Group")
*/
public $groups;
}
/**
* @Entity
* @Table(name="`Group`")
*/
class DDC1151Group
{
/**
* @var int
* @Id
* @Column(type="integer")
* @GeneratedValue
*/
public $id;
}
@@ -26,17 +26,21 @@ use function get_class;
*/
class DDC1163Test extends OrmFunctionalTestCase
{
/** @var int|null */
private $productId;
/** @var int|null */
private $proxyHolderId;
protected function setUp(): void
{
parent::setUp();
$this->_schemaTool->createSchema(
[
$this->_em->getClassMetadata(DDC1163Product::class),
$this->_em->getClassMetadata(DDC1163SpecialProduct::class),
$this->_em->getClassMetadata(DDC1163ProxyHolder::class),
$this->_em->getClassMetadata(DDC1163Tag::class),
]
$this->createSchemaForModels(
DDC1163Product::class,
DDC1163SpecialProduct::class,
DDC1163ProxyHolder::class,
DDC1163Tag::class
);
}
@@ -19,12 +19,10 @@ class DDC1181Test extends OrmFunctionalTestCase
protected function setUp(): void
{
parent::setUp();
$this->_schemaTool->createSchema(
[
$this->_em->getClassMetadata(DDC1181Hotel::class),
$this->_em->getClassMetadata(DDC1181Booking::class),
$this->_em->getClassMetadata(DDC1181Room::class),
]
$this->createSchemaForModels(
DDC1181Hotel::class,
DDC1181Booking::class,
DDC1181Room::class
);
}

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