Skip to content

Commit f18de9d

Browse files
authored
Merge pull request #12269 from greg0ire/3.5.x
Undo merge from 3.6.x into 3.5.x
2 parents b622922 + 37f76a8 commit f18de9d

File tree

76 files changed

+215
-1021
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+215
-1021
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,38 +44,26 @@ jobs:
4444
- "pdo_sqlite"
4545
deps:
4646
- "highest"
47-
stability:
48-
- "stable"
4947
native_lazy:
5048
- "0"
5149
include:
5250
- php-version: "8.2"
5351
dbal-version: "4@dev"
5452
extension: "pdo_sqlite"
55-
stability: "stable"
5653
native_lazy: "0"
5754
- php-version: "8.2"
5855
dbal-version: "4@dev"
5956
extension: "sqlite3"
60-
stability: "stable"
6157
native_lazy: "0"
6258
- php-version: "8.1"
6359
dbal-version: "default"
6460
deps: "lowest"
6561
extension: "pdo_sqlite"
66-
stability: "stable"
6762
native_lazy: "0"
6863
- php-version: "8.4"
6964
dbal-version: "default"
7065
deps: "highest"
7166
extension: "pdo_sqlite"
72-
stability: "stable"
73-
native_lazy: "1"
74-
- php-version: "8.4"
75-
dbal-version: "default"
76-
deps: "highest"
77-
extension: "sqlite3"
78-
stability: "dev"
7967
native_lazy: "1"
8068

8169
steps:
@@ -92,14 +80,6 @@ jobs:
9280
coverage: "pcov"
9381
ini-values: "zend.assertions=1, apc.enable_cli=1"
9482

95-
- name: "Allow dev dependencies"
96-
run: |
97-
composer config minimum-stability dev
98-
composer remove --no-update --dev phpbench/phpbench phpdocumentor/guides-cli
99-
composer require --no-update symfony/console:^8 symfony/var-exporter:^8 doctrine/dbal:^4.4
100-
composer require --dev --no-update symfony/cache:^8
101-
if: "${{ matrix.stability == 'dev' }}"
102-
10383
- name: "Require specific DBAL version"
10484
run: "composer require doctrine/dbal ^${{ matrix.dbal-version }} --no-update"
10585
if: "${{ matrix.dbal-version != 'default' }}"
@@ -141,7 +121,7 @@ jobs:
141121
- name: "Upload coverage file"
142122
uses: "actions/upload-artifact@v5"
143123
with:
144-
name: "phpunit-${{ matrix.extension }}-${{ matrix.php-version }}-${{ matrix.dbal-version }}-${{ matrix.deps }}-${{ matrix.stability }}-${{ matrix.native_lazy }}-coverage"
124+
name: "phpunit-${{ matrix.extension }}-${{ matrix.php-version }}-${{ matrix.dbal-version }}-${{ matrix.deps }}-${{ matrix.native_lazy }}-coverage"
145125
path: "coverage*.xml"
146126

147127

UPGRADE.md

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -27,54 +27,6 @@ At this point, we recommend upgrading to PHP 8.4 first and then directly from
2727
ORM 2.19 to 3.5 and up so that you can skip the lazy ghost proxy generation
2828
and directly start using native lazy objects.
2929

30-
# Upgrade to 3.6
31-
32-
## Deprecate specifying `nullable` on columns that end up being used in a primary key
33-
34-
Specifying `nullable` on join columns that are part of a primary key is
35-
deprecated and will be an error in 4.0.
36-
37-
This can happen when using a join column mapping together with an id mapping,
38-
or when using a join column mapping or an inverse join column mapping on a
39-
many-to-many relationship.
40-
41-
```diff
42-
class User
43-
{
44-
#[ORM\Id]
45-
#[ORM\Column(type: 'integer')]
46-
private int $id;
47-
48-
#[ORM\Id]
49-
#[ORM\ManyToOne(targetEntity: Family::class, inversedBy: 'users')]
50-
- #[ORM\JoinColumn(name: 'family_id', referencedColumnName: 'id', nullable: true)]
51-
+ #[ORM\JoinColumn(name: 'family_id', referencedColumnName: 'id')]
52-
private ?Family $family;
53-
54-
#[ORM\ManyToMany(targetEntity: Group::class)]
55-
#[ORM\JoinTable(name: 'user_group')]
56-
- #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: true)]
57-
- #[ORM\InverseJoinColumn(name: 'group_id', referencedColumnName: 'id', nullable: true)]
58-
+ #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')]
59-
+ #[ORM\InverseJoinColumn(name: 'group_id', referencedColumnName: 'id')]
60-
private Collection $groups;
61-
}
62-
```
63-
64-
## Deprecate `Doctrine\ORM\QueryBuilder::add('join', ...)` with a list of join parts
65-
66-
Using `Doctrine\ORM\QueryBuilder::add('join', ...)` with a list of join parts
67-
is deprecated in favor of using an associative array of join parts with the
68-
root alias as key.
69-
70-
## Deprecate using the `WITH` keyword for arbitrary DQL joins
71-
72-
Using the `WITH` keyword to specify the condition for an arbitrary DQL join is
73-
deprecated in favor of using the `ON` keyword (similar to the SQL syntax for
74-
joins).
75-
The `WITH` keyword is now meant to be used only for filtering conditions in
76-
association joins.
77-
7830
# Upgrade to 3.5
7931

8032
See the General notes to upgrading to 3.x versions above.

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
"doctrine/lexer": "^3",
4444
"doctrine/persistence": "^3.3.1 || ^4",
4545
"psr/cache": "^1 || ^2 || ^3",
46-
"symfony/console": "^5.4 || ^6.0 || ^7.0 || ^8.0",
47-
"symfony/var-exporter": "^6.3.9 || ^7.0 || ^8.0"
46+
"symfony/console": "^5.4 || ^6.0 || ^7.0",
47+
"symfony/var-exporter": "^6.3.9 || ^7.0"
4848
},
4949
"require-dev": {
5050
"doctrine/coding-standard": "^14.0",
@@ -55,7 +55,7 @@
5555
"phpstan/phpstan-deprecation-rules": "^2",
5656
"phpunit/phpunit": "^10.5.0 || ^11.5",
5757
"psr/log": "^1 || ^2 || ^3",
58-
"symfony/cache": "^5.4 || ^6.2 || ^7.0 || ^8.0"
58+
"symfony/cache": "^5.4 || ^6.2 || ^7.0"
5959
},
6060
"suggest": {
6161
"ext-dom": "Provides support for XSD validation for XML mapping files",

docs/en/reference/advanced-configuration.rst

Lines changed: 6 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ steps of configuration.
2929
3030
$config = new Configuration;
3131
$config->setMetadataCache($metadataCache);
32-
$driverImpl = new AttributeDriver(['/path/to/lib/MyProject/Entities']);
32+
$driverImpl = new AttributeDriver(['/path/to/lib/MyProject/Entities'], true);
3333
$config->setMetadataDriverImpl($driverImpl);
3434
$config->setQueryCache($queryCache);
3535
@@ -156,59 +156,15 @@ The attribute driver can be injected in the ``Doctrine\ORM\Configuration``:
156156
<?php
157157
use Doctrine\ORM\Mapping\Driver\AttributeDriver;
158158
159-
$driverImpl = new AttributeDriver(['/path/to/lib/MyProject/Entities']);
159+
$driverImpl = new AttributeDriver(['/path/to/lib/MyProject/Entities'], true);
160160
$config->setMetadataDriverImpl($driverImpl);
161161
162162
The path information to the entities is required for the attribute
163163
driver, because otherwise mass-operations on all entities through
164-
the console could not work correctly. Metadata drivers can accept either
165-
a single directory as a string or an array of directories.
166-
167-
AttributeDriver also accepts ``Doctrine\Persistence\Mapping\Driver\ClassLocator``,
168-
allowing one to customize file discovery logic. You may choose to use Symfony Finder, or
169-
utilize directory scan with ``FileClassLocator::createFromDirectories()``:
170-
171-
.. code-block:: php
172-
173-
<?php
174-
use Doctrine\ORM\Mapping\Driver\AttributeDriver;
175-
use Doctrine\Persistence\Mapping\Driver\FileClassLocator;
176-
177-
$paths = ['/path/to/lib/MyProject/Entities'];
178-
$classLocator = FileClassLocator::createFromDirectories($paths);
179-
180-
$driverImpl = new AttributeDriver($classLocator);
181-
$config->setMetadataDriverImpl($driverImpl);
182-
183-
With this feature, you're empowered to provide a fine-grained iterator of only necessary
184-
files to the Driver. For example, if you are using Vertical Slice architecture, you can
185-
exclude ``*Test.php``, ``*Controller.php``, ``*Service.php``, etc.:
186-
187-
.. code-block:: php
188-
189-
<?php
190-
use Symfony\Component\Finder\Finder;
191-
192-
$finder = new Finder()->files()->in($paths)
193-
->name('*.php')
194-
->notName(['*Test.php', '*Controller.php', '*Service.php']);
195-
196-
$classLocator = new FileClassLocator($finder);
197-
198-
If you know the list of class names you want to track, use
199-
``Doctrine\Persistence\Mapping\Driver\ClassNames``:
200-
201-
.. code-block:: php
202-
203-
<?php
204-
use Doctrine\Persistence\Mapping\Driver\ClassNames;
205-
use App\Entity\{Article, Book};
206-
207-
$entityClasses = [Article::class, Book::class];
208-
$classLocator = new ClassNames($entityClasses);
209-
210-
$driverImpl = new AttributeDriver($classLocator);
211-
$config->setMetadataDriverImpl($driverImpl);
164+
the console could not work correctly. All of metadata drivers
165+
accept either a single directory as a string or an array of
166+
directories. With this feature a single driver can support multiple
167+
directories of Entities.
212168

213169
Metadata Cache (**RECOMMENDED**)
214170
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

docs/en/reference/dql-doctrine-query-language.rst

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ where you can generate an arbitrary join with the following syntax:
490490
.. code-block:: php
491491
492492
<?php
493-
$query = $em->createQuery('SELECT u FROM User u JOIN Banlist b ON u.email = b.email');
493+
$query = $em->createQuery('SELECT u FROM User u JOIN Banlist b WITH u.email = b.email');
494494
495495
With an arbitrary join the result differs from the joins using a mapped property.
496496
The result of an arbitrary join is an one dimensional array with a mix of the entity from the ``SELECT``
@@ -513,15 +513,13 @@ it loads all the related ``Banlist`` objects corresponding to this ``User``. Thi
513513
when the DQL is switched to an arbitrary join.
514514

515515
.. note::
516-
The differences between WHERE, WITH, ON and HAVING clauses may be
516+
The differences between WHERE, WITH and HAVING clauses may be
517517
confusing.
518518

519519
- WHERE is applied to the results of an entire query
520-
- ON is applied to arbitrary joins as the join condition. For
521-
arbitrary joins (SELECT f, b FROM Foo f, Bar b ON f.id = b.id)
522-
the ON is required, even if it is 1 = 1. WITH is also
523-
supported as alternative keyword for that case for BC reasons.
524-
- WITH is applied to an association join as an additional condition.
520+
- WITH is applied to a join as an additional condition. For
521+
arbitrary joins (SELECT f, b FROM Foo f, Bar b WITH f.id = b.id)
522+
the WITH is required, even if it is 1 = 1
525523
- HAVING is applied to the results of a query after
526524
aggregation (GROUP BY)
527525

@@ -1701,14 +1699,9 @@ From, Join and Index by
17011699
SubselectIdentificationVariableDeclaration ::= IdentificationVariableDeclaration
17021700
RangeVariableDeclaration ::= AbstractSchemaName ["AS"] AliasIdentificationVariable
17031701
JoinAssociationDeclaration ::= JoinAssociationPathExpression ["AS"] AliasIdentificationVariable [IndexBy]
1704-
Join ::= ["LEFT" ["OUTER"] | "INNER"] "JOIN" (JoinAssociationDeclaration ["WITH" ConditionalExpression] | RangeVariableDeclaration [("ON" | "WITH") ConditionalExpression])
1702+
Join ::= ["LEFT" ["OUTER"] | "INNER"] "JOIN" (JoinAssociationDeclaration | RangeVariableDeclaration) ["WITH" ConditionalExpression]
17051703
IndexBy ::= "INDEX" "BY" SingleValuedPathExpression
17061704
1707-
.. note::
1708-
Using the ``WITH`` keyword for the ``ConditionalExpression`` of a
1709-
``RangeVariableDeclaration`` is deprecated and will be removed in
1710-
ORM 4.0. Use the ``ON`` keyword instead.
1711-
17121705
Select Expressions
17131706
~~~~~~~~~~~~~~~~~~
17141707

phpstan-baseline.neon

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2563,7 +2563,7 @@ parameters:
25632563
path: src/Query/Exec/MultiTableUpdateExecutor.php
25642564

25652565
-
2566-
message: '#^Parameter \#3 \$types of method Doctrine\\DBAL\\Connection\:\:executeStatement\(\) expects array\<int\<0, max\>\|string, Doctrine\\DBAL\\ArrayParameterType\|Doctrine\\DBAL\\ParameterType\|Doctrine\\DBAL\\Types\\Type\|string\>, list\<Doctrine\\DBAL\\ArrayParameterType\:\:ASCII\|Doctrine\\DBAL\\ArrayParameterType\:\:BINARY\|Doctrine\\DBAL\\ArrayParameterType\:\:INTEGER\|Doctrine\\DBAL\\ArrayParameterType\:\:STRING\|Doctrine\\DBAL\\ParameterType\:\:ASCII\|Doctrine\\DBAL\\ParameterType\:\:BINARY\|Doctrine\\DBAL\\ParameterType\:\:BOOLEAN\|Doctrine\\DBAL\\ParameterType\:\:INTEGER\|Doctrine\\DBAL\\ParameterType\:\:LARGE_OBJECT\|Doctrine\\DBAL\\ParameterType\:\:NULL\|Doctrine\\DBAL\\ParameterType\:\:STRING\|Doctrine\\DBAL\\Types\\Type\|int\|string\> given\.$#'
2566+
message: '#^Parameter \#3 \$types of method Doctrine\\DBAL\\Connection\:\:executeStatement\(\) expects array\<int\<0, max\>\|string, Doctrine\\DBAL\\ArrayParameterType\|Doctrine\\DBAL\\ParameterType\|Doctrine\\DBAL\\Types\\Type\|string\>, list\<Doctrine\\DBAL\\ArrayParameterType\|Doctrine\\DBAL\\ParameterType\|Doctrine\\DBAL\\Types\\Type\|int\|string\> given\.$#'
25672567
identifier: argument.type
25682568
count: 1
25692569
path: src/Query/Exec/MultiTableUpdateExecutor.php
@@ -2610,6 +2610,12 @@ parameters:
26102610
count: 1
26112611
path: src/Query/Expr/Select.php
26122612

2613+
-
2614+
message: '#^Property Doctrine\\ORM\\Query\\Filter\\SQLFilter\:\:\$parameters \(array\<string, array\{type\: string, value\: mixed, is_list\: bool\}\>\) does not accept non\-empty\-array\<string, array\{value\: mixed, type\: Doctrine\\DBAL\\ArrayParameterType\|Doctrine\\DBAL\\ParameterType\|int\|string, is_list\: bool\}\>\.$#'
2615+
identifier: assign.propertyType
2616+
count: 2
2617+
path: src/Query/Filter/SQLFilter.php
2618+
26132619
-
26142620
message: '#^Method Doctrine\\ORM\\Query\\ParameterTypeInferer\:\:inferType\(\) never returns int so it can be removed from the return type\.$#'
26152621
identifier: return.unusedType

phpstan-dbal3.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,3 @@ parameters:
149149
-
150150
message: '~inferType.*never returns~'
151151
path: src/Query/ParameterTypeInferer.php
152-
153-
# Compatibility with Symfony 8
154-
-
155-
message: '#^Call to function method_exists\(\) with ''Symfony\\\\Component\\\\VarExporter\\\\ProxyHelper'' and ''generateLazyGhost'' will always evaluate to true\.$#'
156-
path: src/Proxy/ProxyFactory.php

phpstan.neon

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ parameters:
1212
message: '~^Match expression does not handle remaining values:~'
1313
path: src/Utility/PersisterHelper.php
1414

15-
# The return type is already narrow enough.
16-
- '~^Method Doctrine\\ORM\\Query\\ParameterTypeInferer\:\:inferType\(\) never returns ''[a-z_]+'' so it can be removed from the return type\.$~'
17-
- '~^Method Doctrine\\ORM\\Query\\ParameterTypeInferer\:\:inferType\(\) never returns Doctrine\\DBAL\\(?:Array)?ParameterType\:\:[A-Z_]+ so it can be removed from the return type\.$~'
18-
1915
# DBAL 4 compatibility
2016
-
2117
message: '~^Method Doctrine\\ORM\\Query\\AST\\Functions\\TrimFunction::getTrimMode\(\) never returns .* so it can be removed from the return type\.$~'
@@ -54,8 +50,3 @@ parameters:
5450
-
5551
message: '#Expression on left side of \?\? is not nullable.#'
5652
path: src/Mapping/Driver/AttributeDriver.php
57-
58-
# Compatibility with Symfony 8
59-
-
60-
message: '#^Call to function method_exists\(\) with ''Symfony\\\\Component\\\\VarExporter\\\\ProxyHelper'' and ''generateLazyGhost'' will always evaluate to true\.$#'
61-
path: src/Proxy/ProxyFactory.php

src/Internal/Hydration/ScalarColumnHydrator.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Doctrine\DBAL\Driver\Exception;
88
use Doctrine\ORM\Exception\MultipleSelectorsFoundException;
99

10+
use function array_column;
1011
use function count;
1112

1213
/**
@@ -26,6 +27,8 @@ protected function hydrateAllData(): array
2627
throw MultipleSelectorsFoundException::create($this->resultSetMapping()->fieldMappings);
2728
}
2829

29-
return $this->statement()->fetchFirstColumn();
30+
$result = $this->statement()->fetchAllNumeric();
31+
32+
return array_column($result, 0);
3033
}
3134
}

src/Mapping/Builder/AssociationBuilder.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,6 @@ public function addJoinColumn(
113113
string|null $onDelete = null,
114114
string|null $columnDef = null,
115115
): static {
116-
if ($this->mapping['id'] ?? false) {
117-
$nullable = null;
118-
}
119-
120116
$this->joinColumns[] = [
121117
'name' => $columnName,
122118
'referencedColumnName' => $referencedColumnName,
@@ -137,9 +133,6 @@ public function addJoinColumn(
137133
public function makePrimaryKey(): static
138134
{
139135
$this->mapping['id'] = true;
140-
foreach ($this->joinColumns ?? [] as $i => $joinColumn) {
141-
$this->joinColumns[$i]['nullable'] = null;
142-
}
143136

144137
return $this;
145138
}

0 commit comments

Comments
 (0)