Skip to content

Commit b81374f

Browse files
authored
Merge pull request #3873 from dunglas/fix/stateless
fix: set stateless to false by default and remove the deprecation
2 parents b5be5e0 + 6806c0e commit b81374f

File tree

3 files changed

+3
-15
lines changed

3 files changed

+3
-15
lines changed

src/Bridge/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,6 @@ private function normalizeDefaults(array $defaults): array
260260
$normalizedDefaults['attributes'][$option] = $value;
261261
}
262262

263-
if (!\array_key_exists('stateless', $defaults)) {
264-
@trigger_error('Not setting the "api_platform.defaults.stateless" configuration is deprecated since API Platform 2.6 and it will default to `true` in 3.0. You can override this at the operation level if you have stateful operations (highly not recommended).', E_USER_DEPRECATED);
265-
$normalizedDefaults['attributes']['stateless'] = false;
266-
}
267-
268263
return $normalizedDefaults;
269264
}
270265

tests/Bridge/Symfony/Bundle/DependencyInjection/ApiPlatformExtensionTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ class ApiPlatformExtensionTest extends TestCase
155155
],
156156
'defaults' => [
157157
'attributes' => [],
158-
'stateless' => true,
159158
],
160159
]];
161160

@@ -684,7 +683,7 @@ public function testEnableElasticsearch()
684683
$containerBuilderProphecy->registerForAutoconfiguration(RequestBodySearchCollectionExtensionInterface::class)->willReturn($this->childDefinitionProphecy)->shouldBeCalled();
685684
$containerBuilderProphecy->setParameter('api_platform.elasticsearch.hosts', ['http://elasticsearch:9200'])->shouldBeCalled();
686685
$containerBuilderProphecy->setParameter('api_platform.elasticsearch.mapping', [])->shouldBeCalled();
687-
$containerBuilderProphecy->setParameter('api_platform.defaults', ['attributes' => ['stateless' => true]])->shouldBeCalled();
686+
$containerBuilderProphecy->setParameter('api_platform.defaults', ['attributes' => []])->shouldBeCalled();
688687

689688
$config = self::DEFAULT_CONFIG;
690689
$config['api_platform']['elasticsearch'] = [
@@ -836,7 +835,7 @@ private function getPartialContainerBuilderProphecy($configuration = null)
836835
'api_platform.http_cache.public' => null,
837836
'api_platform.http_cache.invalidation.max_header_length' => 7500,
838837
'api_platform.asset_package' => null,
839-
'api_platform.defaults' => ['attributes' => ['stateless' => true]],
838+
'api_platform.defaults' => ['attributes' => []],
840839
'api_platform.enable_entrypoint' => true,
841840
'api_platform.enable_docs' => true,
842841
'api_platform.url_generation_strategy' => 1,
@@ -1141,7 +1140,7 @@ private function getBaseContainerBuilderProphecy(array $doctrineIntegrationsToLo
11411140
'api_platform.validator.serialize_payload_fields' => [],
11421141
'api_platform.elasticsearch.enabled' => false,
11431142
'api_platform.asset_package' => null,
1144-
'api_platform.defaults' => ['attributes' => ['stateless' => true]],
1143+
'api_platform.defaults' => ['attributes' => []],
11451144
'api_platform.openapi.termsOfService' => null,
11461145
'api_platform.openapi.contact.name' => null,
11471146
'api_platform.openapi.contact.url' => null,

tests/Fixtures/app/config/config_common.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,6 @@ api_platform:
6666
collection:
6767
order_parameter_name: 'order'
6868
order: 'ASC'
69-
pagination:
70-
client_enabled: true
71-
client_items_per_page: true
72-
client_partial: true
73-
items_per_page: 3
7469
exception_to_status:
7570
Symfony\Component\Serializer\Exception\ExceptionInterface: !php/const Symfony\Component\HttpFoundation\Response::HTTP_BAD_REQUEST
7671
ApiPlatform\Core\Exception\InvalidArgumentException: !php/const Symfony\Component\HttpFoundation\Response::HTTP_BAD_REQUEST
@@ -89,7 +84,6 @@ api_platform:
8984
shared_max_age: 3600
9085
vary: ['Accept', 'Cookie']
9186
public: true
92-
stateless: true
9387

9488
parameters:
9589
container.autowiring.strict_mode: true

0 commit comments

Comments
 (0)