Skip to content

Commit ee9dd47

Browse files
authored
Merge pull request #11728 from greg0ire/4.0.x
Merge 3.4.x up into 4.0.x
2 parents f11adcb + 0a4a11b commit ee9dd47

35 files changed

+633
-150
lines changed

.github/ISSUE_TEMPLATE/BC_Break.md

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/Bug.md

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/Feature_Request.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/Support_Question.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/workflows/continuous-integration.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ jobs:
111111
dbal-version:
112112
- "default"
113113
postgres-version:
114-
- "15"
114+
- "17"
115115
extension:
116116
- pdo_pgsql
117117
- pgsql
@@ -337,7 +337,7 @@ jobs:
337337
path: "reports"
338338

339339
- name: "Upload to Codecov"
340-
uses: "codecov/codecov-action@v4"
340+
uses: "codecov/codecov-action@v5"
341341
with:
342342
directory: reports
343343
env:

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
| [![Build status][4.0 image]][4.0] | [![Build status][3.4 image]][3.4] | [![Build status][3.3 image]][3.3] | [![Build status][2.21 image]][2.21] | [![Build status][2.20 image]][2.20] |
44
| [![Coverage Status][4.0 coverage image]][4.0 coverage] | [![Coverage Status][3.4 coverage image]][3.4 coverage] | [![Coverage Status][3.3 coverage image]][3.3 coverage] | [![Coverage Status][2.21 coverage image]][2.21 coverage] | [![Coverage Status][2.20 coverage image]][2.20 coverage] |
55

6-
[<h1 align="center">🇺🇦 UKRAINE NEEDS YOUR HELP NOW!</h1>](https://www.doctrine-project.org/stop-war.html)
7-
86
Doctrine ORM is an object-relational mapper for PHP 8.1+ that provides transparent persistence
97
for PHP objects. It sits on top of a powerful database abstraction layer (DBAL). One of its key features
108
is the option to write database queries in a proprietary object oriented SQL dialect called Doctrine Query Language (DQL),

UPGRADE.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,27 @@ The properties `$indexes` and `$uniqueConstraints` have been removed since they
4848
The preferred way of defining indices and unique constraints is by
4949
using the `\Doctrine\ORM\Mapping\UniqueConstraint` and `\Doctrine\ORM\Mapping\Index` attributes.
5050

51+
# Upgrade to 3.4
52+
53+
Using the same class several times in a discriminator map is deprecated.
54+
In 4.0, this will be an error.
55+
5156
# Upgrade to 3.3
5257

5358
## Deprecate `DatabaseDriver`
5459

5560
The class `Doctrine\ORM\Mapping\Driver\DatabaseDriver` is deprecated without replacement.
5661

62+
## Add `Doctrine\ORM\Query\OutputWalker` interface, deprecate `Doctrine\ORM\Query\SqlWalker::getExecutor()`
63+
64+
Output walkers should implement the new `\Doctrine\ORM\Query\OutputWalker` interface and create
65+
`Doctrine\ORM\Query\Exec\SqlFinalizer` instances instead of `Doctrine\ORM\Query\Exec\AbstractSqlExecutor`s.
66+
The output walker must not base its workings on the query `firstResult`/`maxResult` values, so that the
67+
`SqlFinalizer` can be kept in the query cache and used regardless of the actual `firstResult`/`maxResult` values.
68+
Any operation dependent on `firstResult`/`maxResult` should take place within the `SqlFinalizer::createExecutor()`
69+
method. Details can be found at https://github.com/doctrine/orm/pull/11188.
70+
71+
5772
# Upgrade to 3.2
5873

5974
## Deprecate the `NotSupported` exception
@@ -787,7 +802,7 @@ Use `toIterable()` instead.
787802

788803
Output walkers should implement the new `\Doctrine\ORM\Query\OutputWalker` interface and create
789804
`Doctrine\ORM\Query\Exec\SqlFinalizer` instances instead of `Doctrine\ORM\Query\Exec\AbstractSqlExecutor`s.
790-
The output walker must not base its workings on the query `firstResult`/`maxResult` values, so that the
805+
The output walker must not base its workings on the query `firstResult`/`maxResult` values, so that the
791806
`SqlFinalizer` can be kept in the query cache and used regardless of the actual `firstResult`/`maxResult` values.
792807
Any operation dependent on `firstResult`/`maxResult` should take place within the `SqlFinalizer::createExecutor()`
793808
method. Details can be found at https://github.com/doctrine/orm/pull/11188.
@@ -800,7 +815,7 @@ change in behavior.
800815

801816
Progress on this is tracked at https://github.com/doctrine/orm/issues/11624 .
802817

803-
## PARTIAL DQL syntax is undeprecated
818+
## PARTIAL DQL syntax is undeprecated
804819

805820
Use of the PARTIAL keyword is not deprecated anymore in DQL, because we will be
806821
able to support PARTIAL objects with PHP 8.4 Lazy Objects and

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"doctrine/inflector": "^1.4 || ^2.0",
3232
"doctrine/instantiator": "^1.3 || ^2",
3333
"doctrine/lexer": "^3",
34-
"doctrine/persistence": "^3.3.1",
34+
"doctrine/persistence": "^3.3.1 || ^4",
3535
"psr/cache": "^1 || ^2 || ^3",
3636
"symfony/console": "^5.4 || ^6.0 || ^7.0",
3737
"symfony/var-exporter": "^6.3.9 || ^7.0"

docs/en/cookbook/aggregate-fields.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ the database using a FOR UPDATE.
352352
use Bank\Entities\Account;
353353
use Doctrine\DBAL\LockMode;
354354
355-
$account = $em->find(Account::class, $accId, LockMode::PESSIMISTIC_READ);
355+
$account = $em->find(Account::class, $accId, LockMode::PESSIMISTIC_WRITE);
356356
357357
Keeping Updates and Deletes in Sync
358358
-----------------------------------

docs/en/reference/architecture.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,13 @@ Doctrine ORM is divided into four main packages.
3333
- ORM (depends on DBAL+Persistence+Collections)
3434

3535
This manual mainly covers the ORM package, sometimes touching parts
36-
of the underlying DBAL and Persistence packages. The Doctrine code base
37-
is split in to these packages for a few reasons and they are to...
36+
of the underlying DBAL and Persistence packages. The Doctrine codebase
37+
is split into these packages for a few reasons:
3838

3939

40-
- ...make things more maintainable and decoupled
41-
- ...allow you to use the code in Doctrine Persistence and Collections
42-
without the ORM or DBAL
43-
- ...allow you to use the DBAL without the ORM
40+
- to make things more maintainable and decoupled
41+
- to allow you to use the code in Doctrine Persistence and Collections without the ORM or DBAL
42+
- to allow you to use the DBAL without the ORM
4443

4544
Collection, Event Manager and Persistence
4645
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

docs/en/reference/unitofwork.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ How Doctrine Detects Changes
102102
----------------------------
103103

104104
Doctrine is a data-mapper that tries to achieve persistence-ignorance (PI).
105-
This means you map php objects into a relational database that don't
105+
This means you map PHP objects into a relational database that don't
106106
necessarily know about the database at all. A natural question would now be,
107107
"how does Doctrine even detect objects have changed?".
108108

docs/en/tutorials/extra-lazy-associations.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ can be called without triggering a full load of the collection:
1717
- ``Collection#contains($entity)``
1818
- ``Collection#containsKey($key)``
1919
- ``Collection#count()``
20+
- ``Collection#first()``
2021
- ``Collection#get($key)``
22+
- ``Collection#isEmpty()``
2123
- ``Collection#slice($offset, $length = null)``
2224

2325
For each of the above methods the following semantics apply:

phpcs.xml.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
</rule>
4949

5050
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
51+
<exclude-pattern>src/Mapping/Driver/LoadMappingFileImplementation.php</exclude-pattern>
52+
<exclude-pattern>src/Mapping/GetReflectionClassImplementation.php</exclude-pattern>
5153
<exclude-pattern>tests/*</exclude-pattern>
5254
</rule>
5355

phpstan-baseline.neon

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ parameters:
125125
count: 1
126126
path: src/Mapping/ClassMetadataFactory.php
127127

128+
-
129+
message: "#^Expression on left side of \\?\\? is not nullable\\.$#"
130+
count: 1
131+
path: src/Mapping/Driver/AttributeDriver.php
132+
128133
-
129134
message: "#^Method Doctrine\\\\ORM\\\\Mapping\\\\ToOneOwningSideMapping\\:\\:fromMappingArray\\(\\) should return static\\(Doctrine\\\\ORM\\\\Mapping\\\\ToOneOwningSideMapping\\) but returns Doctrine\\\\ORM\\\\Mapping\\\\ManyToOneAssociationMapping\\|Doctrine\\\\ORM\\\\Mapping\\\\OneToOneOwningSideMapping\\.$#"
130135
count: 1

psalm-baseline.xml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,15 +293,9 @@
293293
<code><![CDATA[$mapping]]></code>
294294
<code><![CDATA[$overrideMapping]]></code>
295295
</InvalidArgument>
296-
<InvalidNullableReturnType>
297-
<code><![CDATA[ReflectionClass|null]]></code>
298-
</InvalidNullableReturnType>
299296
<InvalidPropertyAssignmentValue>
300297
<code><![CDATA[$definition]]></code>
301298
</InvalidPropertyAssignmentValue>
302-
<NullableReturnStatement>
303-
<code><![CDATA[$this->reflClass]]></code>
304-
</NullableReturnStatement>
305299
<ParamNameMismatch>
306300
<code><![CDATA[$entity]]></code>
307301
</ParamNameMismatch>
@@ -448,6 +442,14 @@
448442
<code><![CDATA[new ReflectionClass($metadata->name)]]></code>
449443
</TypeDoesNotContainNull>
450444
</file>
445+
<file src="src/Mapping/Driver/LoadMappingFileImplementation.php">
446+
<LessSpecificImplementedReturnType>
447+
<code><![CDATA[array]]></code>
448+
</LessSpecificImplementedReturnType>
449+
<MissingParamType>
450+
<code><![CDATA[$file]]></code>
451+
</MissingParamType>
452+
</file>
451453
<file src="src/Mapping/Driver/SimplifiedXmlDriver.php">
452454
<MissingParamType>
453455
<code><![CDATA[$fileExtension]]></code>
@@ -500,6 +502,14 @@
500502
<code><![CDATA[$metadata]]></code>
501503
</MoreSpecificImplementedParamType>
502504
</file>
505+
<file src="src/Mapping/GetReflectionClassImplementation.php">
506+
<ImplementedReturnTypeMismatch>
507+
<code><![CDATA[ReflectionClass]]></code>
508+
</ImplementedReturnTypeMismatch>
509+
<InvalidNullableReturnType>
510+
<code><![CDATA[ReflectionClass]]></code>
511+
</InvalidNullableReturnType>
512+
</file>
503513
<file src="src/Mapping/ManyToManyInverseSideMapping.php">
504514
<PropertyNotSetInConstructor>
505515
<code><![CDATA[ManyToManyInverseSideMapping]]></code>

psalm.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
<referencedClass name="Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand"/>
4242
<referencedClass name="Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper"/>
4343
<referencedClass name="Doctrine\ORM\Tools\Console\EntityManagerProvider\HelperSetManagerProvider"/>
44+
<referencedClass name="Doctrine\Persistence\Mapping\StaticReflectionService"/>
4445
</errorLevel>
4546
</DeprecatedClass>
4647
<DocblockTypeContradiction>

src/EntityManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,9 +560,9 @@ public function initializeObject(object $obj): void
560560
/**
561561
* {@inheritDoc}
562562
*/
563-
public function isUninitializedObject($obj): bool
563+
public function isUninitializedObject($value): bool
564564
{
565-
return $this->unitOfWork->isUninitializedObject($obj);
565+
return $this->unitOfWork->isUninitializedObject($value);
566566
}
567567

568568
public function getFilters(): FilterCollection

src/Events.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,14 @@ private function __construct()
103103
* The onFlush event occurs when the EntityManager#flush() operation is invoked,
104104
* after any changes to managed entities have been determined but before any
105105
* actual database operations are executed. The event is only raised if there is
106-
* actually something to do for the underlying UnitOfWork. If nothing needs to be done,
107-
* the onFlush event is not raised.
106+
* actually something to do for the underlying UnitOfWork.
108107
*/
109108
public const onFlush = 'onFlush';
110109

111110
/**
112111
* The postFlush event occurs when the EntityManager#flush() operation is invoked and
113112
* after all actual database operations are executed successfully. The event is only raised if there is
114-
* actually something to do for the underlying UnitOfWork. If nothing needs to be done,
115-
* the postFlush event is not raised. The event won't be raised if an error occurs during the
113+
* actually something to do for the underlying UnitOfWork. The event won't be raised if an error occurs during the
116114
* flush operation.
117115
*/
118116
public const postFlush = 'postFlush';

0 commit comments

Comments
 (0)