Skip to content

Commit 70769a5

Browse files
committed
Merge 4.3
2 parents 79d31e1 + fffcb25 commit 70769a5

77 files changed

Lines changed: 2145 additions & 121 deletions

File tree

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,6 @@ jobs:
276276
composer global require soyuka/pmu
277277
composer global config allow-plugins.soyuka/pmu true --no-interaction
278278
composer global link .
279-
- name: Force PHPUnit 11.5 for PHP 8.2
280-
if: matrix.php == '8.2'
281-
run: composer require phpunit/phpunit:^11.5 --dev --with-all-dependencies
282279
- name: Clear test app cache
283280
run: tests/Fixtures/app/console cache:clear --ansi
284281
- name: Run PHPUnit tests
@@ -294,6 +291,7 @@ jobs:
294291
if: matrix.coverage
295292
uses: codecov/codecov-action@v5
296293
with:
294+
token: ${{ secrets.CODECOV_TOKEN }}
297295
directory: build/logs/phpunit
298296
name: phpunit-php${{ matrix.php }}
299297
flags: phpunit
@@ -353,11 +351,6 @@ jobs:
353351
run: |
354352
composer global require soyuka/pmu
355353
composer global config allow-plugins.soyuka/pmu true --no-interaction
356-
- name: Force PHPUnit 11.5 for PHP 8.2
357-
if: matrix.php.version == '8.2'
358-
run: |
359-
cd $(composer ${{matrix.component}} --cwd)
360-
composer require phpunit/phpunit:^11.5 --dev --with-all-dependencies
361354
- name: Linking
362355
if: ${{ !matrix.php.lowest && !matrix.php.minimal-changes }}
363356
run: |
@@ -388,6 +381,7 @@ jobs:
388381
if: matrix.coverage
389382
uses: codecov/codecov-action@v5
390383
with:
384+
token: ${{ secrets.CODECOV_TOKEN }}
391385
directory: /tmp/build/logs/phpunit
392386
name: phpunit-php${{ matrix.php }}
393387
flags: phpunit
@@ -495,9 +489,6 @@ jobs:
495489
composer global require soyuka/pmu
496490
composer global config allow-plugins.soyuka/pmu true --no-interaction
497491
composer global link .
498-
- name: Force PHPUnit 11.5 for PHP 8.2
499-
if: matrix.php == '8.2'
500-
run: composer require phpunit/phpunit:^11.5 --dev --with-all-dependencies
501492
- name: Clear test app cache
502493
run: tests/Fixtures/app/console cache:clear --ansi
503494
- name: Resolve shard paths
@@ -517,11 +508,10 @@ jobs:
517508
- name: Merge code coverage reports
518509
if: matrix.coverage
519510
run: |
520-
wget -qO /usr/local/bin/phpcov https://phar.phpunit.de/phpcov.phar
511+
wget -qO /usr/local/bin/phpcov https://phar.phpunit.de/phpcov-12.phar
521512
chmod +x /usr/local/bin/phpcov
522513
mkdir -p build/coverage
523514
phpcov merge --clover build/logs/behat/clover.xml build/coverage
524-
continue-on-error: true
525515
- name: Upload test artifacts
526516
if: always()
527517
uses: actions/upload-artifact@v6
@@ -533,6 +523,7 @@ jobs:
533523
if: matrix.coverage
534524
uses: codecov/codecov-action@v5
535525
with:
526+
token: ${{ secrets.CODECOV_TOKEN }}
536527
directory: build/logs/behat
537528
name: behat-php${{ matrix.php }}-shard${{ matrix.shard }}
538529
flags: behat
@@ -715,7 +706,7 @@ jobs:
715706
vendor/bin/behat --out=std --format=progress --format=junit --out=build/logs/behat/junit --profile=mongodb-coverage --no-interaction
716707
- name: Merge code coverage reports
717708
run: |
718-
wget -qO /usr/local/bin/phpcov https://phar.phpunit.de/phpcov.phar
709+
wget -qO /usr/local/bin/phpcov https://phar.phpunit.de/phpcov-12.phar
719710
chmod +x /usr/local/bin/phpcov
720711
mkdir -p build/coverage
721712
phpcov merge --clover build/logs/behat/clover.xml build/coverage
@@ -730,6 +721,7 @@ jobs:
730721
- name: Upload coverage results to Codecov
731722
uses: codecov/codecov-action@v5
732723
with:
724+
token: ${{ secrets.CODECOV_TOKEN }}
733725
directory: build/logs/behat
734726
name: behat-php${{ matrix.php }}
735727
flags: behat
@@ -805,7 +797,7 @@ jobs:
805797
vendor/bin/behat --out=std --format=progress --format=junit --out=build/logs/behat/junit --profile=mercure-coverage --no-interaction
806798
- name: Merge code coverage reports
807799
run: |
808-
wget -qO /usr/local/bin/phpcov https://phar.phpunit.de/phpcov.phar
800+
wget -qO /usr/local/bin/phpcov https://phar.phpunit.de/phpcov-12.phar
809801
chmod +x /usr/local/bin/phpcov
810802
mkdir -p build/coverage
811803
phpcov merge --clover build/logs/behat/clover.xml build/coverage
@@ -820,6 +812,7 @@ jobs:
820812
- name: Upload coverage results to Codecov
821813
uses: codecov/codecov-action@v5
822814
with:
815+
token: ${{ secrets.CODECOV_TOKEN }}
823816
directory: build/logs/behat
824817
name: behat-php${{ matrix.php }}
825818
flags: behat
@@ -1062,8 +1055,6 @@ jobs:
10621055
extensions: intl, bcmath, curl, openssl, mbstring
10631056
coverage: none
10641057
ini-values: memory_limit=-1
1065-
- name: Install additional packages
1066-
run: sudo apt update && sudo apt-get install moreutils
10671058
- name: Get composer cache directory
10681059
id: composercache
10691060
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
@@ -1204,8 +1195,6 @@ jobs:
12041195
extensions: intl, bcmath, curl, openssl, mbstring
12051196
coverage: none
12061197
ini-values: memory_limit=-1
1207-
- name: Install additional packages
1208-
run: sudo apt update && sudo apt-get install moreutils
12091198
- name: Get composer cache directory
12101199
id: composercache
12111200
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
@@ -1291,6 +1280,7 @@ jobs:
12911280
if: matrix.coverage
12921281
uses: codecov/codecov-action@v5
12931282
with:
1283+
token: ${{ secrets.CODECOV_TOKEN }}
12941284
directory: build/logs/phpunit
12951285
name: phpunit-php${{ matrix.php }}
12961286
flags: phpunit
@@ -1425,10 +1415,6 @@ jobs:
14251415
tools: pecl, composer
14261416
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite
14271417
ini-values: memory_limit=-1
1428-
- name: Force PHPUnit 11.5 for PHP 8.2
1429-
if: matrix.php == '8.2'
1430-
working-directory: 'src/Laravel'
1431-
run: composer require phpunit/phpunit:^11.5 --dev --with-all-dependencies
14321418
- name: Update project dependencies
14331419
run: |
14341420
composer global require soyuka/pmu

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Changelog
22

3+
## v4.3.4
4+
5+
### Bug fixes
6+
7+
* [0160a72e1](https://github.com/api-platform/core/commit/0160a72e155915f15731e38cd1c75da076bc35c8) fix(doctrine): IriFilter ignores custom ApiProperty identifier on ODM (#7937)
8+
* [37f248a45](https://github.com/api-platform/core/commit/37f248a4561f31801901b673adaf15899b84fbb8) fix(state): use exception message for user-facing violation when available (#7894)
9+
* [472ae3f22](https://github.com/api-platform/core/commit/472ae3f223dfa00f2913bf90a10d0f83ac04f163) fix(openapi): generate both singular and array parameter variants for filters (#7906)
10+
* [88ddc3680](https://github.com/api-platform/core/commit/88ddc368067d01a2c06662c50cde6ec6ca0fccd4) fix(symfony): ensure ErrorListener is fully stateless to prevent stat… (#7921)
11+
* [90875fb46](https://github.com/api-platform/core/commit/90875fb46d958e279745555a1f5a7a2bba611f66) fix: unnecessary nullable operator
12+
* [967ff7925](https://github.com/api-platform/core/commit/967ff7925914db16023f5551164f925bea64cea0) fix(jsonapi): use parent-resolved class in denormalizeRelation
13+
* [98112eab7](https://github.com/api-platform/core/commit/98112eab70b1a56755179545e632b3f22a54bee3) fix(symfony): api_platform_iris route loader for graphql-only setups (#7934)
14+
* [98f3d0f49](https://github.com/api-platform/core/commit/98f3d0f495344ec42d20ebbec127e3ed3c781966) fix(symfony): security regression when ResourceAccessChecker is decorated (#7896) (#7897)
15+
* [ac374fcc4](https://github.com/api-platform/core/commit/ac374fcc4539eeb30d63de40795e97a127d6af79) fix(state): preserve Type message when expectedTypes is set (#7935)
16+
* [cf80a82d5](https://github.com/api-platform/core/commit/cf80a82d5115765d4d930c1938e95ec2b58ec7ed) fix(laravel): skip relation metadata for abstract Eloquent models (#7933)
17+
* [d08eb7f44](https://github.com/api-platform/core/commit/d08eb7f44bfcb34d5eb87ccc78295bcc55db4445) fix: `ResourceClassInfoTrait::isResourceClass()` is always true (#7924)
18+
* [e19154930](https://github.com/api-platform/core/commit/e191549304ff661408d9824860d55e034657dc2f) fix(validator): handle nested groups and group sequences (#7914)
19+
* [fcfaf3844](https://github.com/api-platform/core/commit/fcfaf3844fca371c57d9e141b779209de58c572e) fix(metadata): nested property filters fail to generate JOINs when relation target entity is not directly declared as ApiResource (#7926)
20+
321
## v4.3.3
422

523
### Bug fixes

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
"phpstan/phpstan-doctrine": "^2.0",
157157
"phpstan/phpstan-phpunit": "^2.0",
158158
"phpstan/phpstan-symfony": "^2.0",
159-
"phpunit/phpunit": "^12.2",
159+
"phpunit/phpunit": "^11.5 || ^12.2",
160160
"psr/log": "^1.0 || ^2.0 || ^3.0",
161161
"ramsey/uuid": "^4.7",
162162
"ramsey/uuid-doctrine": "^2.0",

src/Doctrine/Common/Filter/OpenApiFilterTrait.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ public function getOpenApiParameters(Parameter $parameter): OpenApiParameter|arr
3434
$arraySchema = ['type' => 'array', 'items' => $schema ?? ['type' => 'string']];
3535
}
3636

37-
return new OpenApiParameter(name: $parameter->getKey().'[]', in: 'query', style: 'deepObject', explode: true, schema: $arraySchema);
37+
$arrayParameter = new OpenApiParameter(name: $parameter->getKey().'[]', in: 'query', style: 'deepObject', explode: true, schema: $arraySchema);
38+
39+
// When castToArray is null (default), both singular and array forms are accepted
40+
if (null === $parameter->getCastToArray()) {
41+
return [
42+
new OpenApiParameter(name: $parameter->getKey(), in: 'query'),
43+
$arrayParameter,
44+
];
45+
}
46+
47+
return $arrayParameter;
3848
}
3949
}

src/Doctrine/Common/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"doctrine/mongodb-odm": "^2.10",
3535
"doctrine/orm": "^2.17 || ^3.0",
3636
"phpspec/prophecy-phpunit": "^2.2",
37-
"phpunit/phpunit": "^12.2",
37+
"phpunit/phpunit": "^11.5 || ^12.2",
3838
"symfony/type-info": "^7.3 || ^8.0"
3939
},
4040
"conflict": {

src/Doctrine/Odm/Filter/IriFilter.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ public function apply(Builder $aggregationBuilder, string $resourceClass, ?Opera
7878
$or = $aggregationBuilder->matchExpr();
7979

8080
foreach ($value as $v) {
81+
if (!\is_object($v)) {
82+
continue;
83+
}
84+
8185
$or->addOr($aggregationBuilder->matchExpr()->field($matchField)->{$method}($v));
8286
}
8387

@@ -86,6 +90,16 @@ public function apply(Builder $aggregationBuilder, string $resourceClass, ?Opera
8690
return;
8791
}
8892

93+
// The IRI did not resolve to a resource: emit an always-false clause so the query
94+
// returns no result rather than attempting to match against a raw IRI string.
95+
if (!\is_object($value)) {
96+
$match->{$operator}(
97+
$aggregationBuilder->matchExpr()->field($matchField)->in([])
98+
);
99+
100+
return;
101+
}
102+
89103
$match
90104
->{$operator}(
91105
$aggregationBuilder

src/Doctrine/Odm/State/ItemProvider.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,13 @@ public function provide(Operation $operation, array $uriVariables = [], array $c
5757

5858
$fetchData = $context['fetch_data'] ?? true;
5959
if (!$fetchData) {
60-
return $manager->getReference($documentClass, reset($uriVariables));
60+
$identifier = $manager->getClassMetadata($documentClass)->identifier;
61+
if ($identifier && 1 === \count($uriVariables) && \array_key_exists($identifier, $uriVariables)) {
62+
return $manager->getReference($documentClass, $uriVariables[$identifier]);
63+
}
64+
// When URI variables don't correspond to the document identifier (e.g. custom
65+
// ApiProperty identifier on a non-#[Id] field), fall through to a real lookup
66+
// so that the returned document carries the actual database identifier.
6167
}
6268

6369
$repository = $manager->getRepository($documentClass);

src/Doctrine/Odm/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"doctrine/doctrine-bundle": "^2.11 || ^3.1",
3838
"doctrine/mongodb-odm-bundle": "^5.0",
3939
"phpspec/prophecy-phpunit": "^2.2",
40-
"phpunit/phpunit": "^12.2",
40+
"phpunit/phpunit": "^11.5 || ^12.2",
4141
"symfony/cache": "^6.4 || ^7.0 || ^8.0",
4242
"symfony/framework-bundle": "^6.4 || ^7.0 || ^8.0",
4343
"symfony/property-access": "^6.4 || ^7.0 || ^8.0",

src/Doctrine/Orm/NestedPropertyHelperTrait.php

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,31 @@ protected function addNestedParameterJoins(
4646
return [$alias, $property];
4747
}
4848

49-
foreach ($nestedInfo['converted_relation_segments'] as $association) {
50-
$alias = QueryBuilderHelper::addJoinOnce(
51-
$queryBuilder,
52-
$queryNameGenerator,
53-
$alias,
54-
$association,
55-
$joinType
56-
);
49+
$relationClasses = $nestedInfo['relation_classes'] ?? [];
50+
$association = null;
51+
$embedded = false;
52+
53+
foreach ($nestedInfo['converted_relation_segments'] as $id => $association) {
54+
$entityClass = $relationClasses[$id] ?? null;
55+
if (!$entityClass) {
56+
continue;
57+
}
58+
59+
$embedded = !$queryBuilder->getEntityManager()->getClassMetadata($entityClass)->hasAssociation($association);
60+
61+
if (!$embedded) {
62+
$alias = QueryBuilderHelper::addJoinOnce(
63+
$queryBuilder,
64+
$queryNameGenerator,
65+
$alias,
66+
$association,
67+
$joinType
68+
);
69+
}
5770
}
5871

59-
return [$alias, $nestedInfo['leaf_property']];
72+
$leafProperty = $nestedInfo['leaf_property'];
73+
74+
return [$alias, $embedded && $association ? $association.'.'.$leafProperty : $leafProperty];
6075
}
6176
}

src/Doctrine/Orm/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"require-dev": {
3535
"doctrine/doctrine-bundle": "^2.11 || ^3.1",
3636
"phpspec/prophecy-phpunit": "^2.2",
37-
"phpunit/phpunit": "^12.2",
37+
"phpunit/phpunit": "^11.5 || ^12.2",
3838
"ramsey/uuid": "^4.7",
3939
"ramsey/uuid-doctrine": "^2.0",
4040
"symfony/cache": "^6.4 || ^7.0 || ^8.0",

0 commit comments

Comments
 (0)