diff --git a/composer.json b/composer.json index e19d605103e..67446135ec0 100644 --- a/composer.json +++ b/composer.json @@ -42,14 +42,14 @@ "doctrine/annotations": "^1.13 || ^2", "doctrine/coding-standard": "^9.0.2 || ^11.0", "phpbench/phpbench": "^0.16.10 || ^1.0", - "phpstan/phpstan": "~1.4.10 || 1.10.3", + "phpstan/phpstan": "~1.4.10 || 1.10.6", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6", "psr/log": "^1 || ^2 || ^3", "squizlabs/php_codesniffer": "3.7.2", "symfony/cache": "^4.4 || ^5.4 || ^6.0", "symfony/var-exporter": "^4.4 || ^5.4 || ^6.2", "symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0", - "vimeo/psalm": "4.30.0 || 5.7.7" + "vimeo/psalm": "4.30.0 || 5.8.0" }, "conflict": { "doctrine/annotations": "<1.13 || >= 3.0" diff --git a/docs/en/reference/basic-mapping.rst b/docs/en/reference/basic-mapping.rst index 5475277d7de..1d8fd856344 100644 --- a/docs/en/reference/basic-mapping.rst +++ b/docs/en/reference/basic-mapping.rst @@ -534,8 +534,6 @@ the above example with ``allocationSize=100`` Doctrine ORM would only need to access the sequence once to generate the identifiers for 100 new entities. -*The default allocationSize for a @SequenceGenerator is currently 10.* - .. caution:: The allocationSize is detected by SchemaTool and diff --git a/docs/en/reference/batch-processing.rst b/docs/en/reference/batch-processing.rst index 97d818f10e7..5217cac62e8 100644 --- a/docs/en/reference/batch-processing.rst +++ b/docs/en/reference/batch-processing.rst @@ -19,11 +19,13 @@ especially what the strategies presented here provide help with. .. note:: Having an SQL logger enabled when processing batches can have a serious impact on performance and resource usage. - To avoid that you should disable it in the DBAL configuration: + To avoid that you should remove the corresponding middleware. + To remove all middlewares, you can use this line: .. code-block:: php getConnection()->getConfiguration()->setSQLLogger(null); + $em->getConnection()->getConfiguration()->setMiddlewares([]); // DBAL 3 + $em->getConnection()->getConfiguration()->setSQLLogger(null); // DBAL 2 Bulk Inserts ------------ diff --git a/docs/en/reference/inheritance-mapping.rst b/docs/en/reference/inheritance-mapping.rst index 9936f99f497..9929e0b162e 100644 --- a/docs/en/reference/inheritance-mapping.rst +++ b/docs/en/reference/inheritance-mapping.rst @@ -163,6 +163,20 @@ lowercase short name of each class as key. to see if they are part of it. The resulting map, however, can be kept in the metadata cache. +Performance impact on to-one associations +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +There is a general performance consideration when using entity inheritance: +If the target-entity of a many-to-one or one-to-one association is part of +an inheritance hierarchy, it is preferable for performance reasons that it +be a leaf entity (ie. have no subclasses). + +Otherwise, the ORM is currently unable to tell beforehand which entity class +will have to be used, and so no appropriate proxy instance can be created. +That means the referred-to entities will *always* be loaded eagerly, which +might even propagate to relationships of these entities (in the case of +self-referencing associations). + Single Table Inheritance ------------------------ @@ -255,13 +269,6 @@ only a ``WHERE`` clause listing the type identifiers. In particular, relationships involving types that employ this mapping strategy are very performing. -There is a general performance consideration with Single Table -Inheritance: If the target-entity of a many-to-one or one-to-one -association is an STI entity, it is preferable for performance reasons that it -be a leaf entity in the inheritance hierarchy, (ie. have no subclasses). -Otherwise Doctrine *cannot* create proxy instances -of this entity and will *always* load the entity eagerly. - SQL Schema considerations ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -345,13 +352,6 @@ performance but the resulting partial objects will not fully load themselves on access of any subtype fields, so accessing fields of subtypes after such a query is not safe. -There is a general performance consideration with Class Table -Inheritance: If the target-entity of a many-to-one or one-to-one -association is a CTI entity, it is preferable for performance reasons that it -be a leaf entity in the inheritance hierarchy, ie. have no subclasses. -Otherwise Doctrine *cannot* create proxy instances -of this entity and will *always* load the entity eagerly. - There is also another important performance consideration that it is *not possible* to query for the base entity without any ``LEFT JOIN``s to the sub-types. diff --git a/lib/Doctrine/ORM/Mapping/Driver/SimplifiedXmlDriver.php b/lib/Doctrine/ORM/Mapping/Driver/SimplifiedXmlDriver.php index a6c2f4e9106..4ea9e556aa8 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/SimplifiedXmlDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/SimplifiedXmlDriver.php @@ -16,10 +16,10 @@ class SimplifiedXmlDriver extends XmlDriver /** * {@inheritDoc} */ - public function __construct($prefixes, $fileExtension = self::DEFAULT_FILE_EXTENSION) + public function __construct($prefixes, $fileExtension = self::DEFAULT_FILE_EXTENSION, bool $isXsdValidationEnabled = false) { $locator = new SymfonyFileLocator((array) $prefixes, $fileExtension); - parent::__construct($locator, $fileExtension); + parent::__construct($locator, $fileExtension, $isXsdValidationEnabled); } } diff --git a/psalm-baseline.xml b/psalm-baseline.xml index fd671d033b6..1c14701234a 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + IterableResult