Skip to content

Commit e0a8a1a

Browse files
committed
Merge 2.7 into 3.0
2 parents 806775b + 1091938 commit e0a8a1a

Some content is hidden

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

43 files changed

+3586
-3442
lines changed

.commitlintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"defaultIgnores": true,
3-
"parserPreset": "conventional-changelog-conventionalcommits",
3+
"extends": "@commitlint/config-conventional",
44
"rules": {
55
"scope-enum": [
66
2,

.github/workflows/ci.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,24 @@ env:
1111

1212
jobs:
1313
commitlint:
14+
if: github.event_name == 'pull_request'
15+
env:
16+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1417
runs-on: ubuntu-latest
1518
steps:
1619
- uses: actions/checkout@v3
1720
with:
1821
fetch-depth: 0
19-
configFile: .commitlintrc
20-
- uses: wagoid/commitlint-github-action@v5
22+
- name: Run commitlint
23+
run: |
24+
commit=$(gh api \
25+
-H "Accept: application/vnd.github+json" \
26+
/repos/${{ github.repository }}/pulls/${{github.event.number}}/commits \
27+
| jq -r '.[0].commit.message')
28+
# we can't use npx see https://github.com/conventional-changelog/commitlint/issues/613
29+
echo '{}' > package.json
30+
npm install --no-fund --no-audit @commitlint/config-conventional @commitlint/cli
31+
echo $commit | ./node_modules/.bin/commitlint -g .commitlintrc
2132
php-cs-fixer:
2233
name: PHP-cs-fixer (PHP ${{ matrix.php }})
2334
runs-on: ubuntu-latest

CHANGELOG.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,6 @@
1212

1313
Various cleanup in services and removal of backward compatibility layer.
1414

15-
## 2.7.0
16-
17-
* chore: remove @experimental phpdoc (#4933)
18-
* Metadata: do not set id when identifier is `false` (#4880)
19-
* Metadata: automatic GET operation when none is declared (#4881)
20-
* Metadata: exception to status on operations (#4861)
21-
* Serializer: adds the JSON_INVALID_UTF8_IGNORE flag to JsonEncode (#4741)
22-
* Symfony: autoconfigure legacy Doctrine extensions (#4909)
23-
* Elasticsearch: skip metadata without ES nodes (#4913)
24-
* Symfony: deprecated the `$exceptionOnNoToken` parameter in `ResourceAccessChecker::__construct()` (#4900)
25-
26-
Various cs fixes and PHPDoc to help upgrading to 3.0.
27-
2815
## 3.0.0-rc.2
2916

3017
* JsonLd: correct the `api_jsonld_context` route format (#4844)
@@ -49,6 +36,23 @@ Breaking changes:
4936
* Metadata: the `Core` namespace got removed (#4805)
5037
* Mercure: deprecation removed (#4805)
5138

39+
## 2.7.1
40+
41+
* Replace FQCN service names by snake ones (#5019)
42+
43+
## 2.7.0
44+
45+
* chore: remove @experimental phpdoc (#4933)
46+
* Metadata: do not set id when identifier is `false` (#4880)
47+
* Metadata: automatic GET operation when none is declared (#4881)
48+
* Metadata: exception to status on operations (#4861)
49+
* Serializer: adds the JSON_INVALID_UTF8_IGNORE flag to JsonEncode (#4741)
50+
* Symfony: autoconfigure legacy Doctrine extensions (#4909)
51+
* Elasticsearch: skip metadata without ES nodes (#4913)
52+
* Symfony: deprecated the `$exceptionOnNoToken` parameter in `ResourceAccessChecker::__construct()` (#4900)
53+
54+
Various cs fixes and PHPDoc to help upgrading to 3.0.
55+
5256
## 2.7.0-rc.2
5357

5458
* Symfony: the upgrade command now updates ApiFilter as well (#4845)
@@ -140,7 +144,7 @@ Doctrine: new interfaces for Filters and Extensions ready, switch to the `ApiPla
140144

141145
* Swagger UI: Add `usePkceWithAuthorizationCodeGrant` to Swagger UI initOAuth (#4649)
142146
* **BC**: `mapping.paths` in configuration should override bundles configuration (#4465)
143-
* GraphQL: Add ability to use different pagination types for the queries of a resource (#4453)
147+
* GraphQL: Add the ability to use different pagination types for the queries of a resource (#4453)
144148
* Security: **BC** Fix `ApiProperty` `security` attribute expression being passed a class string for the `object` variable on updates/creates - null is now passed instead if the object is not available (#4184)
145149
* Security: `ApiProperty` now supports a `security_post_denormalize` attribute, which provides access to the `object` variable for the object being updated/created and `previous_object` for the object before it was updated (#4184)
146150
* Maker: Add `make:data-provider` and `make :data-persister` commands to generate a data provider / persister (#3850)
@@ -174,7 +178,7 @@ Doctrine: new interfaces for Filters and Extensions ready, switch to the `ApiPla
174178
* Metadata: deprecation of `ApiPlatform\Core\Annotation` (#4351)
175179
* Metadata: `ApiPlatform\Core\Metadata\Resource\Factory\ResourceMetadataFactoryInterface` is deprecated in favor of `ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface` (#4351)
176180
* Metadata: item and collection prefixes for operations are deprecated, as well as the `ApiPlatform\Core\Api\OperationType` class (#4351)
177-
* Graphql: `ApiPlatform\Metadata\GraphQl` follow the same metadata conventions (a Subscription operation is available and isn't hidden behind an update Mutation anymore), interfaces got simplified (beeing @experimental) (#4351)
181+
* Graphql: `ApiPlatform\Metadata\GraphQl` follow the same metadata conventions (a Subscription operation is available and isn't hidden behind an update Mutation anymore), interfaces got simplified (being @experimental) (#4351)
178182
* IriConverter: new interface for `ApiPlatform\Bridge\Symfony\Routing\IriConverter` that adds an operationName, same for `ApiPlatform\Api\IdentifiersExtractor` (#4351)
179183
* DataProvider: new `ApiPlatform\State\ProviderInterface` that replaces DataProviders (#4351)
180184
* DataPersister: new `ApiPlatform\State\ProcessorInterface` that replaces DataPersisters (#4351)

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"require": {
2222
"php": ">=8.1",
2323
"doctrine/inflector": "^1.0 || ^2.0",
24-
"fig/link-util": "^1.0",
2524
"psr/cache": "^1.0 || ^2.0 || ^3.0",
2625
"psr/container": "^1.0 || ^2.0",
2726
"symfony/http-foundation": "^6.1",
@@ -100,7 +99,8 @@
10099
"doctrine/common": "<2.7",
101100
"doctrine/dbal": "<2.10",
102101
"doctrine/mongodb-odm": "<2.2",
103-
"doctrine/persistence": "<1.3"
102+
"doctrine/persistence": "<1.3",
103+
"elasticsearch/elasticsearch": ">=8.0"
104104
},
105105
"suggest": {
106106
"doctrine/mongodb-odm-bundle": "To support MongoDB. Only versions 4.0 and later are supported.",

src/Doctrine/Orm/Util/QueryChecker.php

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -92,30 +92,14 @@ public static function hasMaxResults(QueryBuilder $queryBuilder): bool
9292
public static function hasOrderByOnFetchJoinedToManyAssociation(QueryBuilder $queryBuilder, ManagerRegistry $managerRegistry): bool
9393
{
9494
if (
95-
0 === (is_countable($selectParts = $queryBuilder->getDQLPart('select')) ? \count($selectParts = $queryBuilder->getDQLPart('select')) : 0) ||
96-
0 === (is_countable($queryBuilder->getDQLPart('join')) ? \count($queryBuilder->getDQLPart('join')) : 0) ||
97-
0 === (is_countable($orderByParts = $queryBuilder->getDQLPart('orderBy')) ? \count($orderByParts = $queryBuilder->getDQLPart('orderBy')) : 0)
95+
0 === \count($queryBuilder->getDQLPart('join')) ||
96+
0 === \count($orderByParts = $queryBuilder->getDQLPart('orderBy'))
9897
) {
9998
return false;
10099
}
101100

102101
$rootAliases = $queryBuilder->getRootAliases();
103102

104-
$selectAliases = [];
105-
106-
foreach ($selectParts as $select) {
107-
foreach ($select->getParts() as $part) {
108-
[$alias] = explode('.', (string) $part);
109-
110-
$selectAliases[] = $alias;
111-
}
112-
}
113-
114-
$selectAliases = array_diff($selectAliases, $rootAliases);
115-
if (0 === \count($selectAliases)) {
116-
return false;
117-
}
118-
119103
$orderByAliases = [];
120104

121105
foreach ($orderByParts as $orderBy) {
@@ -133,11 +117,13 @@ public static function hasOrderByOnFetchJoinedToManyAssociation(QueryBuilder $qu
133117
return false;
134118
}
135119

120+
$allAliases = $queryBuilder->getAllAliases();
121+
136122
foreach ($orderByAliases as $orderByAlias) {
137123
$inToManyContext = false;
138124

139125
foreach (QueryBuilderHelper::traverseJoins($orderByAlias, $queryBuilder, $managerRegistry) as $alias => [$metadata, $association]) {
140-
if ($inToManyContext && \in_array($alias, $selectAliases, true)) {
126+
if ($inToManyContext && \in_array($alias, $allAliases, true)) {
141127
return true;
142128
}
143129

src/Hydra/EventListener/AddLinkHeaderListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
use ApiPlatform\Api\UrlGeneratorInterface;
1717
use ApiPlatform\JsonLd\ContextBuilder;
1818
use ApiPlatform\Util\CorsTrait;
19-
use Fig\Link\GenericLinkProvider;
20-
use Fig\Link\Link;
2119
use Symfony\Component\HttpKernel\Event\ResponseEvent;
20+
use Symfony\Component\WebLink\GenericLinkProvider;
21+
use Symfony\Component\WebLink\Link;
2222

2323
/**
2424
* Adds the HTTP Link header pointing to the Hydra documentation.

src/Metadata/ApiProperty.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function __construct(
6060
private ?bool $push = null,
6161
private ?string $security = null,
6262
private ?string $securityPostDenormalize = null,
63-
private $types = null,
63+
private array|string|null $types = null,
6464
/**
6565
* The related php types.
6666
*/
@@ -70,6 +70,9 @@ public function __construct(
7070
private $iris = null,
7171
private array $extraProperties = []
7272
) {
73+
if (\is_string($types)) {
74+
$this->types = (array) $types;
75+
}
7376
}
7477

7578
public function getDescription(): ?string

src/Metadata/ApiResource.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class ApiResource
3636
protected $processor;
3737

3838
/**
39-
* @param array|null $types The RDF types of this resource
39+
* @param array|string|null $types The RDF types of this resource
4040
* @param mixed|null $operations
4141
* @param array|string|null $formats https://api-platform.com/docs/core/content-negotiation/#configuring-formats-for-a-specific-resource-or-operation
4242
* @param array|string|null $inputFormats https://api-platform.com/docs/core/content-negotiation/#configuring-formats-for-a-specific-resource-or-operation
@@ -83,7 +83,7 @@ public function __construct(
8383
protected ?string $uriTemplate = null,
8484
protected ?string $shortName = null,
8585
protected ?string $description = null,
86-
protected $types = null,
86+
protected string|array|null $types = null,
8787
$operations = null,
8888
protected $formats = null,
8989
protected $inputFormats = null,
@@ -147,6 +147,9 @@ public function __construct(
147147
$this->operations = null === $operations ? null : new Operations($operations);
148148
$this->provider = $provider;
149149
$this->processor = $processor;
150+
if (\is_string($types)) {
151+
$this->types = (array) $types;
152+
}
150153
}
151154

152155
public function getOperations(): ?Operations

src/Metadata/Resource/Factory/NotExposedOperationResourceMetadataCollectionFactory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
namespace ApiPlatform\Metadata\Resource\Factory;
1515

1616
use ApiPlatform\Metadata\ApiResource;
17+
use ApiPlatform\Metadata\CollectionOperationInterface;
1718
use ApiPlatform\Metadata\Get;
1819
use ApiPlatform\Metadata\HttpOperation;
1920
use ApiPlatform\Metadata\NotExposed;
@@ -58,7 +59,7 @@ public function create(string $resourceClass): ResourceMetadataCollection
5859

5960
foreach ($operations as $operation) {
6061
// An item operation has been found, nothing to do anymore in this factory
61-
if ($operation instanceof Get) {
62+
if ((HttpOperation::METHOD_GET === $operation->getMethod() && !$operation instanceof CollectionOperationInterface) || ($operation->getExtraProperties()['is_legacy_resource_metadata'] ?? false)) {
6263
return $resourceMetadataCollection;
6364
}
6465
}

src/Symfony/Bundle/Resources/config/doctrine_mongodb_odm.xml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616
<factory service="doctrine_mongodb.odm.default_document_manager" method="getMetadataFactory"/>
1717
</service>
1818

19-
<service id="ApiPlatform\Doctrine\Common\State\RemoveProcessor" class="ApiPlatform\Doctrine\Common\State\RemoveProcessor">
19+
<service id="api_platform.doctrine_mongodb.odm.state.remove_processor" class="ApiPlatform\Doctrine\Common\State\RemoveProcessor">
2020
<argument type="service" id="doctrine_mongodb" />
2121

22-
<tag name="api_platform.state_processor" priority="-100" />
22+
<tag name="api_platform.state_processor" priority="-100" key="ApiPlatform\Doctrine\Common\State\RemoveProcessor" />
2323
</service>
24-
<service id="api_platform.doctrine_mongodb.odm.state.remove_processor" alias="ApiPlatform\Doctrine\Common\State\RemoveProcessor" />
24+
<service id="ApiPlatform\Doctrine\Common\State\RemoveProcessor" alias="api_platform.doctrine_mongodb.odm.state.remove_processor" />
2525

26-
<service id="ApiPlatform\Doctrine\Common\State\PersistProcessor" class="ApiPlatform\Doctrine\Common\State\PersistProcessor">
26+
<service id="api_platform.doctrine_mongodb.odm.state.persist_processor" class="ApiPlatform\Doctrine\Common\State\PersistProcessor">
2727
<argument type="service" id="doctrine_mongodb" />
2828

29-
<tag name="api_platform.state_processor" priority="-100" />
29+
<tag name="api_platform.state_processor" priority="-100" key="ApiPlatform\Doctrine\Common\State\PersistProcessor" />
3030
</service>
31-
<service id="api_platform.doctrine_mongodb.odm.state.persist_processor" alias="ApiPlatform\Doctrine\Common\State\PersistProcessor" />
31+
<service id="ApiPlatform\Doctrine\Common\State\PersistProcessor" alias="api_platform.doctrine_mongodb.odm.state.persist_processor" />
3232

3333
<!-- Filter -->
3434

@@ -121,23 +121,23 @@
121121

122122
<service id="ApiPlatform\Doctrine\Odm\Filter\SearchFilter" alias="api_platform.doctrine_mongodb.odm.search_filter" />
123123

124-
<service id="ApiPlatform\Doctrine\Odm\State\CollectionProvider" class="ApiPlatform\Doctrine\Odm\State\CollectionProvider" public="false">
124+
<service id="api_platform.doctrine_mongodb.odm.state.collection_provider" class="ApiPlatform\Doctrine\Odm\State\CollectionProvider" public="false">
125125
<argument type="service" id="api_platform.metadata.resource.metadata_collection_factory" />
126126
<argument type="service" id="doctrine_mongodb" />
127127
<argument type="tagged" tag="api_platform.doctrine_mongodb.odm.aggregation_extension.collection" />
128128

129-
<tag name="api_platform.state_provider" priority="-100" />
129+
<tag name="api_platform.state_provider" priority="-100" key="ApiPlatform\Doctrine\Odm\State\CollectionProvider" />
130130
</service>
131-
<service id="api_platform.doctrine_mongodb.odm.state.collection_provider" alias="ApiPlatform\Doctrine\Odm\State\CollectionProvider" />
131+
<service id="ApiPlatform\Doctrine\Odm\State\CollectionProvider" alias="api_platform.doctrine_mongodb.odm.state.collection_provider" />
132132

133-
<service id="ApiPlatform\Doctrine\Odm\State\ItemProvider" class="ApiPlatform\Doctrine\Odm\State\ItemProvider" public="false">
133+
<service id="api_platform.doctrine_mongodb.odm.state.item_provider" class="ApiPlatform\Doctrine\Odm\State\ItemProvider" public="false">
134134
<argument type="service" id="api_platform.metadata.resource.metadata_collection_factory" />
135135
<argument type="service" id="doctrine_mongodb" />
136136
<argument type="tagged" tag="api_platform.doctrine_mongodb.odm.aggregation_extension.item" />
137137

138-
<tag name="api_platform.state_provider" priority="-100" />
138+
<tag name="api_platform.state_provider" priority="-100" key="ApiPlatform\Doctrine\Odm\State\ItemProvider" />
139139
</service>
140-
<service id="api_platform.doctrine_mongodb.odm.state.item_provider" alias="ApiPlatform\Doctrine\Odm\State\ItemProvider" />
140+
<service id="ApiPlatform\Doctrine\Odm\State\ItemProvider" alias="api_platform.doctrine_mongodb.odm.state.item_provider" />
141141
<service id="api_platform.state.item_provider" alias="ApiPlatform\Doctrine\Odm\State\ItemProvider" />
142142

143143
<service id="api_platform.doctrine.odm.metadata.resource.metadata_collection_factory" class="ApiPlatform\Doctrine\Odm\Metadata\Resource\DoctrineMongoDbOdmResourceCollectionMetadataFactory" decorates="api_platform.metadata.resource.metadata_collection_factory" decoration-priority="40">

0 commit comments

Comments
 (0)