Compare commits

..

50 Commits

Author SHA1 Message Date
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
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
Alexander M. Turek 2e4a872272 Conditionally extend the old AnnotationDriver class (#9671) 2022-04-22 19:46:03 +02:00
129 changed files with 697 additions and 1433 deletions
+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"
+1 -1
View File
@@ -5,7 +5,7 @@
[<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
-5
View File
@@ -41,11 +41,6 @@ This is now deprecated. Please extend `EntityRepository` instead.
+$entityManager->getRepository(CmsUser::class);
```
## BC Break: `AttributeDriver` and `AnnotationDriver` no longer extends parent class from `doctrine/persistence`
Both these classes used to extend an abstract `AnnotationDriver` class defined
in `doctrine/persistence`, and no longer do.
## Deprecate `AttributeDriver::getReader()` and `AnnotationDriver::getReader()`
That method was inherited from the abstract `AnnotationDriver` class of
+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.7.13",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"psr/log": "^1 || ^2 || ^3",
"squizlabs/php_codesniffer": "3.6.2",
"squizlabs/php_codesniffer": "3.7.0",
"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.23.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;
}
+33 -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)
@@ -656,6 +656,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 +809,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 +827,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 +915,8 @@ Specifying an entity listener instance :
.. code-block:: php
<?php
use Doctrine\ORM\Event\PreUpdateEventArgs;
// User.php
/** @Entity @EntityListeners({"UserListener"}) */
@@ -933,12 +943,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 +984,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 +1025,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 +1052,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::
+8 -6
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;
@@ -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();
+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;
}
@@ -84,17 +84,17 @@ class HydrationException extends ORMException
/**
* @param string $discrValue
* @param string[] $discrMap
* @psalm-param array<string, string> $discrMap
* @param string[] $discrValues
* @psalm-param list<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)
));
}
}
@@ -519,7 +519,9 @@ class ClassMetadataInfo implements ClassMetadata
*
* @see discriminatorColumn
*
* @var mixed
* @var array<string, string>
*
* @psalm-var array<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
* }
*/
@@ -10,11 +10,10 @@ 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 Doctrine\Persistence\Mapping\Driver\MappingDriver;
use ReflectionClass;
use ReflectionMethod;
use ReflectionProperty;
@@ -32,7 +31,7 @@ use function is_numeric;
/**
* The AnnotationDriver reads the mapping metadata from docblock annotations.
*/
class AnnotationDriver implements MappingDriver
class AnnotationDriver extends CompatibilityAnnotationDriver
{
use ColocatedMappingDriver;
@@ -70,10 +69,14 @@ class AnnotationDriver 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)
{
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
@@ -299,7 +302,7 @@ class AnnotationDriver implements MappingDriver
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];
@@ -544,7 +547,7 @@ class AnnotationDriver implements MappingDriver
private function loadRelationShipMapping(
ReflectionProperty $property,
array &$mapping,
ClassMetadata $metadata,
PersistenceClassMetadata $metadata,
array $joinColumns,
string $className
): void {
@@ -648,7 +651,7 @@ class AnnotationDriver implements MappingDriver
/**
* 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.
*/
@@ -664,7 +667,7 @@ class AnnotationDriver implements MappingDriver
/**
* Attempts to resolve the generated mode.
*
* @psalm-return ClassMetadataInfo::GENERATED_*
* @psalm-return ClassMetadata::GENERATED_*
*
* @throws MappingException If the fetch mode is not valid.
*/
@@ -764,7 +767,7 @@ class AnnotationDriver implements MappingDriver
* precision: int,
* notInsertable?: bool,
* notUpdateble?: bool,
* generated?: ClassMetadataInfo::GENERATED_*,
* generated?: ClassMetadata::GENERATED_*,
* enumType?: class-string,
* options?: mixed[],
* columnName?: string,
@@ -8,11 +8,10 @@ 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 Doctrine\Persistence\Mapping\Driver\MappingDriver;
use LogicException;
use ReflectionClass;
use ReflectionMethod;
@@ -27,7 +26,7 @@ use function sprintf;
use const PHP_VERSION_ID;
class AttributeDriver implements MappingDriver
class AttributeDriver extends CompatibilityAnnotationDriver
{
use ColocatedMappingDriver;
@@ -99,11 +98,20 @@ class AttributeDriver implements MappingDriver
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);
@@ -239,7 +247,7 @@ class AttributeDriver implements MappingDriver
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];
@@ -492,7 +500,7 @@ class AttributeDriver implements MappingDriver
// 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);
@@ -559,7 +567,7 @@ class AttributeDriver implements MappingDriver
* @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.
*/
@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\Persistence\Mapping\Driver\AnnotationDriver as PersistenceAnnotationDriver;
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 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);
+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;
+2 -18
View File
@@ -43,7 +43,8 @@
</rule>
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>lib/Doctrine/ORM/Mapping/Driver/CompatibilityAnnotationDriver.php</exclude-pattern>
<exclude-pattern>tests/*</exclude-pattern>
</rule>
<rule ref="Squiz.Classes.ClassFileName.NoMatch">
@@ -265,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>
+3 -459
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
@@ -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
+5
View File
@@ -55,3 +55,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
+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\(\)\.$/'
@@ -41,3 +42,8 @@ parameters:
# Symfony cache supports passing a key prefix to the clear method.
- '/^Method Psr\\Cache\\CacheItemPoolInterface\:\:clear\(\) invoked with 1 parameter, 0 required\.$/'
# 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
+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
+65 -145
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.22.0@fc2c6ab4d5fa5d644d8617089f012f3bb84b8703">
<files psalm-version="4.23.0@f1fe6ff483bf325c803df9f510d09a03fd796f88">
<file src="lib/Doctrine/ORM/AbstractQuery.php">
<DeprecatedClass occurrences="1">
<code>IterableResult</code>
@@ -421,9 +421,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 +449,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>
@@ -523,6 +517,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 +545,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">
@@ -653,7 +647,8 @@
<code>$table</code>
<code>$tableGeneratorDefinition</code>
</PropertyNotSetInConstructor>
<PropertyTypeCoercion occurrences="10">
<PropertyTypeCoercion occurrences="11">
<code>$this-&gt;discriminatorMap</code>
<code>$this-&gt;entityListeners</code>
<code>$this-&gt;fieldMappings</code>
<code>$this-&gt;fullyQualifiedClassName($repositoryClassName)</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>assert($cacheAttribute instanceof Mapping\Cache)</code>
<code>$metadata-&gt;getReflectionClass()</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,42 @@
</MissingParamType>
</file>
<file src="lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php">
<ArgumentTypeCoercion occurrences="1">
<code>$metadata</code>
<ArgumentTypeCoercion occurrences="3">
<code>$map</code>
<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 +887,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 +900,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 +923,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 +937,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">
@@ -1114,9 +1048,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 +1385,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 +1399,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">
@@ -2040,6 +1960,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 +2054,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 +2105,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 +2243,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>
@@ -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']);
}
@@ -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>> */
@@ -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(
@@ -16,6 +16,9 @@ use function str_contains;
class DBAL483Test extends OrmFunctionalTestCase
{
/** @var Tools\SchemaTool */
private $schemaTool;
protected function setUp(): void
{
parent::setUp();
@@ -17,7 +17,6 @@ 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,94 +39,6 @@ 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
*/
@@ -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,6 +26,12 @@ use function get_class;
*/
class DDC1163Test extends OrmFunctionalTestCase
{
/** @var int|null */
private $productId;
/** @var int|null */
private $proxyHolderId;
protected function setUp(): void
{
parent::setUp();
@@ -38,16 +38,12 @@ class DDC1193Test extends OrmFunctionalTestCase
$account = new DDC1193Account();
$person->account = $account;
$person->company = $company;
$company->member = $person;
$this->_em->persist($company);
$this->_em->flush();
$companyId = $company->id;
$accountId = $account->id;
$this->_em->clear();
$company = $this->_em->find(get_class($company), $companyId);
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\Tests\Models;
use Doctrine\Tests\OrmFunctionalTestCase;
@@ -23,9 +23,9 @@ class DDC1301Test extends OrmFunctionalTestCase
parent::setUp();
$class = $this->_em->getClassMetadata(Models\Legacy\LegacyUser::class);
$class->associationMappings['articles']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY;
$class->associationMappings['references']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY;
$class->associationMappings['cars']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY;
$class->associationMappings['articles']['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY;
$class->associationMappings['references']['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY;
$class->associationMappings['cars']['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY;
$this->loadFixture();
}
@@ -35,9 +35,9 @@ class DDC1301Test extends OrmFunctionalTestCase
parent::tearDown();
$class = $this->_em->getClassMetadata(Models\Legacy\LegacyUser::class);
$class->associationMappings['articles']['fetch'] = ClassMetadataInfo::FETCH_LAZY;
$class->associationMappings['references']['fetch'] = ClassMetadataInfo::FETCH_LAZY;
$class->associationMappings['cars']['fetch'] = ClassMetadataInfo::FETCH_LAZY;
$class->associationMappings['articles']['fetch'] = ClassMetadata::FETCH_LAZY;
$class->associationMappings['references']['fetch'] = ClassMetadata::FETCH_LAZY;
$class->associationMappings['cars']['fetch'] = ClassMetadata::FETCH_LAZY;
}
public function testCountNotInitializesLegacyCollection(): void
@@ -90,17 +90,14 @@ class DDC1301Test extends OrmFunctionalTestCase
$user1 = new Models\Legacy\LegacyUser();
$user1->username = 'beberlei';
$user1->name = 'Benjamin';
$user1->_status = 'active';
$user2 = new Models\Legacy\LegacyUser();
$user2->username = 'jwage';
$user2->name = 'Jonathan';
$user2->_status = 'active';
$user3 = new Models\Legacy\LegacyUser();
$user3->username = 'romanb';
$user3->name = 'Roman';
$user3->_status = 'active';
$this->_em->persist($user1);
$this->_em->persist($user2);
@@ -1,57 +0,0 @@
<?php
declare(strict_types=1);
namespace Doctrine\Tests\ORM\Functional\Ticket;
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\Table;
use Doctrine\Tests\OrmFunctionalTestCase;
/**
* @group DDC-1360
*/
class DDC1360Test extends OrmFunctionalTestCase
{
public function testSchemaDoubleQuotedCreate(): void
{
$platform = $this->_em->getConnection()->getDatabasePlatform();
if (! $platform instanceof PostgreSQLPlatform) {
self::markTestSkipped('PostgreSQL only test.');
}
$sql = $this->_schemaTool->getCreateSchemaSql(
[
$this->_em->getClassMetadata(DDC1360DoubleQuote::class),
]
);
self::assertEquals(
[
'CREATE SCHEMA user',
'CREATE TABLE "user"."user" (id INT NOT NULL, PRIMARY KEY(id))',
'CREATE SEQUENCE "user"."user_id_seq" INCREMENT BY 1 MINVALUE 1 START 1',
],
$sql
);
}
}
/**
* @Entity
* @Table(name="`user`.`user`")
*/
class DDC1360DoubleQuote
{
/**
* @var int
* @Id
* @GeneratedValue
* @Column(type="integer")
*/
public $id;
}
@@ -6,6 +6,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
@@ -167,7 +168,7 @@ class DDC1430Order
/**
* @OneToMany(targetEntity="DDC1430OrderProduct", mappedBy="order", cascade={"persist", "remove"})
* @var ArrayCollection $products
* @var Collection $products
*/
private $products;
@@ -25,7 +25,6 @@ class DDC1885Test extends OrmFunctionalTestCase
$user = new User();
$user->name = 'FabioBatSilva';
$user->email = 'fabio.bat.silva@gmail.com';
$user->groups[] = new Group('G 1');
$user->groups[] = new Group('G 2');
$this->user = $user;
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\DBAL\Schema\Table;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\Tests\ORM\Functional\DatabaseDriverTestCase;
class DDC2387Test extends DatabaseDriverTestCase
@@ -27,7 +27,7 @@ class DDC2387Test extends DatabaseDriverTestCase
$metadata = $this->convertToClassMetadata([$product, $attributes], []);
self::assertEquals(ClassMetadataInfo::GENERATOR_TYPE_NONE, $metadata['Ddc2387Attributes']->generatorType);
self::assertEquals(ClassMetadataInfo::GENERATOR_TYPE_AUTO, $metadata['Ddc2387Product']->generatorType);
self::assertEquals(ClassMetadata::GENERATOR_TYPE_NONE, $metadata['Ddc2387Attributes']->generatorType);
self::assertEquals(ClassMetadata::GENERATOR_TYPE_AUTO, $metadata['Ddc2387Product']->generatorType);
}
}
@@ -6,7 +6,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Id\AbstractIdGenerator;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Driver\StaticPHPDriver;
use Doctrine\Tests\OrmFunctionalTestCase;
@@ -63,7 +63,7 @@ class DDC2415ParentEntity
return $this->id;
}
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->mapField(
[
@@ -73,7 +73,7 @@ class DDC2415ParentEntity
]
);
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_CUSTOM);
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_CUSTOM);
$metadata->setCustomGeneratorDefinition(['class' => DDC2415Generator::class]);
$metadata->isMappedSuperclass = true;
@@ -95,7 +95,7 @@ class DDC2415ChildEntity extends DDC2415ParentEntity
return $this->name;
}
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->mapField(
[
@@ -60,17 +60,14 @@ class DDC2519Test extends OrmFunctionalTestCase
$user1 = new LegacyUser();
$user1->username = 'FabioBatSilva';
$user1->name = 'Fabio B. Silva';
$user1->_status = 'active';
$user2 = new LegacyUser();
$user2->username = 'doctrinebot';
$user2->name = 'Doctrine Bot';
$user2->_status = 'active';
$user3 = new LegacyUser();
$user3->username = 'test';
$user3->name = 'Tester';
$user3->_status = 'active';
$this->_em->persist($user1);
$this->_em->persist($user2);
@@ -18,7 +18,7 @@ use function unserialize;
class DDC3103Test extends OrmFunctionalTestCase
{
/**
* @covers \Doctrine\ORM\Mapping\ClassMetadataInfo::__sleep
* @covers \Doctrine\ORM\Mapping\ClassMetadata::__sleep
*/
public function testIssue(): void
{
@@ -77,7 +77,6 @@ class DDC522Test extends OrmFunctionalTestCase
public function testJoinColumnWithNullSameNameAssociationField(): void
{
$fkCust = new DDC522ForeignKeyTest();
$fkCust->name = 'name';
$fkCust->cart = null;
$this->_em->persist($fkCust);
@@ -153,13 +152,13 @@ class DDC522ForeignKeyTest
public $id;
/**
* @var int
* @var int|null
* @Column(type="integer", name="cart_id", nullable=true)
*/
public $cartId;
/**
* @var DDC522Cart
* @var DDC522Cart|null
* @OneToOne(targetEntity="DDC522Cart")
* @JoinColumn(name="cart_id", referencedColumnName="id")
*/
@@ -135,7 +135,6 @@ class Lemma
public function __construct()
{
$this->types = new ArrayCollection();
$this->relations = new ArrayCollection();
}
@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\DiscriminatorColumn;
use Doctrine\ORM\Mapping\DiscriminatorMap;
@@ -41,6 +42,11 @@ class DDC832Test extends OrmFunctionalTestCase
$sm->dropTable($platform->quoteIdentifier('TREE_INDEX'));
$sm->dropTable($platform->quoteIdentifier('INDEX'));
$sm->dropTable($platform->quoteIdentifier('LIKE'));
if ($platform instanceof PostgreSQLPlatform) {
$sm->dropSequence($platform->quoteIdentifier('INDEX_id_seq'));
$sm->dropSequence($platform->quoteIdentifier('LIKE_id_seq'));
}
}
/**
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Doctrine\Test\ORM\Functional\Ticket;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\Tests\OrmFunctionalTestCase;
final class GH6682Test extends OrmFunctionalTestCase
@@ -20,7 +20,7 @@ final class GH6682Test extends OrmFunctionalTestCase
'initialValue' => '',
];
$classMetadataInfo = new ClassMetadataInfo('test_entity');
$classMetadataInfo = new ClassMetadata('test_entity');
$classMetadataInfo->setSequenceGeneratorDefinition($parsedDefinition);
self::assertSame(
@@ -20,8 +20,6 @@ class Ticket2481Test extends OrmFunctionalTestCase
$this->_schemaTool->createSchema([
$this->_em->getClassMetadata(Ticket2481Product::class),
]);
$this->_conn = $this->_em->getConnection();
}
public function testEmptyInsert(): void
@@ -4,52 +4,46 @@ declare(strict_types=1);
namespace Doctrine\Tests\ORM\Id;
use BadMethodCallException;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\ORM\Id\SequenceGenerator;
use Doctrine\Tests\Mocks\ArrayResultFactory;
use Doctrine\Tests\Mocks\ConnectionMock;
use Doctrine\Tests\OrmTestCase;
class SequenceGeneratorTest extends OrmTestCase
{
/** @var EntityManagerInterface */
private $entityManager;
/** @var SequenceGenerator */
private $sequenceGenerator;
/** @var ConnectionMock */
private $connection;
protected function setUp(): void
{
parent::setUp();
$this->entityManager = $this->getTestEntityManager();
$this->sequenceGenerator = new SequenceGenerator('seq', 10);
$this->connection = $this->entityManager->getConnection();
self::assertInstanceOf(ConnectionMock::class, $this->connection);
}
public function testGeneration(): void
{
$this->connection->setFetchOneException(new BadMethodCallException(
'Fetch* method used. Query method should be used instead, '
. 'as NEXTVAL should be run on a master server in master-slave setup.'
));
$sequenceGenerator = new SequenceGenerator('seq', 10);
$platform = $this->createMock(AbstractPlatform::class);
$platform->method('getSequenceNextValSQL')
->willReturn('');
$connection = $this->getMockBuilder(Connection::class)
->setConstructorArgs([[], $this->createMock(Driver::class)])
->setMethods(['fetchOne', 'getDatabasePlatform'])
->getMock();
$connection->method('getDatabasePlatform')
->willReturn($platform);
// Sequence values should be generated once per ten identifiers
$connection->expects($this->exactly(5))
->method('fetchOne')
->willReturnCallback(static function () use (&$i) {
self::assertEquals(0, $i % 10);
return $i;
});
$entityManager = $this->getTestEntityManager($connection);
for ($i = 0; $i < 42; ++$i) {
if ($i % 10 === 0) {
$this->connection->setQueryResult(ArrayResultFactory::createFromArray([[(int) ($i / 10) * 10]]));
}
$id = $this->sequenceGenerator->generateId($this->entityManager, null);
$id = $sequenceGenerator->generateId($entityManager, null);
self::assertSame($i, $id);
self::assertSame((int) ($i / 10) * 10 + 10, $this->sequenceGenerator->getCurrentMaxValue());
self::assertSame($i + 1, $this->sequenceGenerator->getNextValue());
self::assertSame((int) ($i / 10) * 10 + 10, $sequenceGenerator->getCurrentMaxValue());
self::assertSame($i + 1, $sequenceGenerator->getNextValue());
}
}
}
@@ -10,7 +10,6 @@ use Doctrine\ORM\Events;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadataFactory;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\CustomIdGenerator;
use Doctrine\ORM\Mapping\DefaultNamingStrategy;
@@ -556,7 +555,7 @@ abstract class AbstractMappingDriverTest extends OrmTestCase
self::assertEquals('id', $class->fieldMappings['id']['columnName']);
self::assertEquals('name', $class->fieldMappings['name']['columnName']);
self::assertEquals(ClassMetadataInfo::GENERATOR_TYPE_NONE, $class->generatorType);
self::assertEquals(ClassMetadata::GENERATOR_TYPE_NONE, $class->generatorType);
}
/**
@@ -1155,7 +1154,7 @@ abstract class AbstractMappingDriverTest extends OrmTestCase
self::assertArrayHasKey('notInsertable', $mapping);
self::assertArrayHasKey('generated', $mapping);
self::assertSame(ClassMetadataInfo::GENERATED_INSERT, $mapping['generated']);
self::assertSame(ClassMetadata::GENERATED_INSERT, $mapping['generated']);
self::assertArrayNotHasKey('notInsertable', $metadata->getFieldMapping('insertableContent'));
}
@@ -1167,7 +1166,7 @@ abstract class AbstractMappingDriverTest extends OrmTestCase
self::assertArrayHasKey('notUpdatable', $mapping);
self::assertArrayHasKey('generated', $mapping);
self::assertSame(ClassMetadataInfo::GENERATED_ALWAYS, $mapping['generated']);
self::assertSame(ClassMetadata::GENERATED_ALWAYS, $mapping['generated']);
self::assertArrayNotHasKey('notUpdatable', $metadata->getFieldMapping('updatableContent'));
}
@@ -1289,16 +1288,16 @@ class User
{
}
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',
'options' => ['foo' => 'bar', 'baz' => ['key' => 'val']],
]
);
$metadata->setChangeTrackingPolicy(ClassMetadataInfo::CHANGETRACKING_DEFERRED_IMPLICIT);
$metadata->setChangeTrackingPolicy(ClassMetadata::CHANGETRACKING_DEFERRED_IMPLICIT);
$metadata->addLifecycleCallback('doStuffOnPrePersist', 'prePersist');
$metadata->addLifecycleCallback('doOtherStuffOnPrePersistToo', 'prePersist');
$metadata->addLifecycleCallback('doStuffOnPostPersist', 'postPersist');
@@ -1333,7 +1332,7 @@ class User
$mapping = ['fieldName' => 'version', 'type' => 'integer'];
$metadata->setVersionMapping($mapping);
$metadata->mapField($mapping);
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_AUTO);
$metadata->mapOneToOne(
[
'fieldName' => 'address',
@@ -1458,9 +1457,9 @@ class UserIncorrectIndex
*/
public $email;
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([]);
$metadata->mapField(
[
@@ -1517,9 +1516,9 @@ class UserIncorrectUniqueConstraint
*/
public $email;
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([]);
$metadata->mapField(
[
@@ -1569,9 +1568,9 @@ abstract class Animal
#[ORM\CustomIdGenerator(class: 'stdClass')]
public $id;
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_CUSTOM);
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_CUSTOM);
$metadata->setCustomGeneratorDefinition(['class' => 'stdClass']);
}
}
@@ -1580,7 +1579,7 @@ abstract class Animal
#[ORM\Entity]
class Cat extends Animal
{
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
}
}
@@ -1589,7 +1588,7 @@ class Cat extends Animal
#[ORM\Entity]
class Dog extends Animal
{
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
}
}
@@ -1632,7 +1631,7 @@ class DDC1170Entity
return $this->value;
}
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->mapField(
[
@@ -1649,7 +1648,7 @@ class DDC1170Entity
]
);
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_NONE);
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
}
}
@@ -1673,7 +1672,7 @@ class DDC807Entity
#[ORM\Id, ORM\Column(type: 'integer'), ORM\GeneratedValue(strategy: 'NONE')]
public $id;
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->mapField(
[
@@ -1690,7 +1689,7 @@ class DDC807Entity
]
);
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_NONE);
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
}
}
@@ -1726,9 +1725,9 @@ class Comment
#[ORM\Column(type: 'text')]
private $content;
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(
[
'indexes' => [
@@ -1773,7 +1772,7 @@ class SingleTableEntityNoDiscriminatorColumnMapping
#[ORM\Id, ORM\Column(type: 'integer'), ORM\GeneratedValue(strategy: 'NONE')]
public $id;
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->mapField(
[
@@ -1782,7 +1781,7 @@ class SingleTableEntityNoDiscriminatorColumnMapping
]
);
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_NONE);
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
}
}
@@ -1816,7 +1815,7 @@ class SingleTableEntityIncompleteDiscriminatorColumnMapping
#[ORM\Id, ORM\Column(type: 'integer'), ORM\GeneratedValue(strategy: 'NONE')]
public $id;
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->mapField(
[
@@ -1825,7 +1824,7 @@ class SingleTableEntityIncompleteDiscriminatorColumnMapping
]
);
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_NONE);
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
}
}
@@ -1856,7 +1855,7 @@ class ReservedWordInTableColumn
#[ORM\Column(name: '`count`', type: 'integer')]
public $count;
public static function loadMetadata(ClassMetadataInfo $metadata): void
public static function loadMetadata(ClassMetadata $metadata): void
{
$metadata->mapField(
[
@@ -26,6 +26,7 @@ use Doctrine\ORM\Mapping\MappingException;
use Doctrine\ORM\Mapping\OneToMany;
use Doctrine\ORM\Mapping\PostLoad;
use Doctrine\ORM\Mapping\PreUpdate;
use Doctrine\Persistence\Mapping\Driver\AnnotationDriver as PersistenceAnnotationDriver;
use Doctrine\Persistence\Mapping\Driver\MappingDriver;
use Doctrine\Persistence\Mapping\RuntimeReflectionService;
use Doctrine\Tests\Models\CMS\CmsUser;
@@ -36,6 +37,9 @@ use Doctrine\Tests\Models\DirectoryTree\File;
use Doctrine\Tests\Models\ECommerce\ECommerceCart;
use Generator;
use function class_exists;
use function is_subclass_of;
class AnnotationDriverTest extends AbstractMappingDriverTest
{
/**
@@ -303,6 +307,15 @@ class AnnotationDriverTest extends AbstractMappingDriverTest
yield [DiscriminatorColumnWithZeroLength::class, 0];
yield [DiscriminatorColumnWithNonZeroLength::class, 60];
}
public function testLegacyInheritance(): void
{
if (! class_exists(PersistenceAnnotationDriver::class)) {
self::markTestSkipped('This test requires doctrine/persistence 2.');
}
self::assertTrue(is_subclass_of(AnnotationDriver::class, PersistenceAnnotationDriver::class));
}
}
/**
@@ -7,7 +7,6 @@ namespace Doctrine\Tests\ORM\Mapping;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\ORM\Mapping\AnsiQuoteStrategy;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\DefaultQuoteStrategy;
use Doctrine\Persistence\Mapping\RuntimeReflectionService;
use Doctrine\Tests\Models\CMS\CmsAddress;
use Doctrine\Tests\Models\CMS\CmsUser;
@@ -21,7 +20,7 @@ use Doctrine\Tests\OrmTestCase;
*/
class AnsiQuoteStrategyTest extends OrmTestCase
{
/** @var DefaultQuoteStrategy */
/** @var AnsiQuoteStrategy */
private $strategy;
/** @var AbstractPlatform */
@@ -8,9 +8,13 @@ use Attribute;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\Annotation;
use Doctrine\ORM\Mapping\Driver\AttributeDriver;
use Doctrine\Persistence\Mapping\Driver\AnnotationDriver as PersistenceAnnotationDriver;
use Doctrine\Persistence\Mapping\Driver\MappingDriver;
use stdClass;
use function class_exists;
use function is_subclass_of;
use const PHP_VERSION_ID;
class AttributeDriverTest extends AbstractMappingDriverTest
@@ -110,6 +114,15 @@ class AttributeDriverTest extends AbstractMappingDriverTest
self::assertFalse($driver->isTransient(AttributeEntityStartingWithRepeatableAttributes::class));
}
public function testLegacyInheritance(): void
{
if (! class_exists(PersistenceAnnotationDriver::class)) {
self::markTestSkipped('This test requires doctrine/persistence 2.');
}
self::assertTrue(is_subclass_of(AttributeDriver::class, PersistenceAnnotationDriver::class));
}
}
#[ORM\Entity]
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Doctrine\Tests\ORM\Mapping;
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\Tests\Models\CMS\CmsUser;
use Doctrine\Tests\OrmTestCase;
@@ -13,7 +13,7 @@ class FieldBuilderTest extends OrmTestCase
{
public function testCustomIdGeneratorCanBeSet(): void
{
$cmBuilder = new ClassMetadataBuilder(new ClassMetadataInfo(CmsUser::class));
$cmBuilder = new ClassMetadataBuilder(new ClassMetadata(CmsUser::class));
$fieldBuilder = $cmBuilder->createField('aField', 'string');
@@ -22,7 +22,7 @@ class FieldBuilderTest extends OrmTestCase
$fieldBuilder->build();
self::assertEquals(ClassMetadataInfo::GENERATOR_TYPE_CUSTOM, $cmBuilder->getClassMetadata()->generatorType);
self::assertEquals(ClassMetadata::GENERATOR_TYPE_CUSTOM, $cmBuilder->getClassMetadata()->generatorType);
self::assertEquals(['class' => 'stdClass'], $cmBuilder->getClassMetadata()->customGeneratorDefinition);
}
}

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