Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2de525a

Browse filesBrowse files
committed
no serializer mapping cache in debug mode without enable_annotations
1 parent bfb57aa commit 2de525a
Copy full SHA for 2de525a

File tree

2 files changed

+10
-3
lines changed
Filter options

2 files changed

+10
-3
lines changed

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,14 +1790,15 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
17901790
$container->removeDefinition('serializer.normalizer.mime_message');
17911791
}
17921792

1793+
if ($container->getParameter('kernel.debug')) {
1794+
$container->removeDefinition('serializer.mapping.cache_class_metadata_factory');
1795+
}
1796+
17931797
$serializerLoaders = [];
17941798
if (isset($config['enable_annotations']) && $config['enable_annotations']) {
17951799
if (\PHP_VERSION_ID < 80000 && !$this->annotationsConfigEnabled) {
17961800
throw new \LogicException('"enable_annotations" on the serializer cannot be set as the PHP version is lower than 8 and Annotations support is disabled. Consider upgrading PHP.');
17971801
}
1798-
if ($container->getParameter('kernel.debug')) {
1799-
$container->removeDefinition('serializer.mapping.cache_class_metadata_factory');
1800-
}
18011802

18021803
$annotationLoader = new Definition(
18031804
'Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader',

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,6 +1530,12 @@ public function testSerializerCacheActivated()
15301530
public function testSerializerCacheUsedWithoutAnnotationsAndMappingFiles()
15311531
{
15321532
$container = $this->createContainerFromFile('serializer_mapping_without_annotations', ['kernel.debug' => true, 'kernel.container_class' => __CLASS__]);
1533+
$this->assertFalse($container->hasDefinition('serializer.mapping.cache_class_metadata_factory'));
1534+
}
1535+
1536+
public function testSerializerCacheUsedWithoutAnnotationsAndMappingFilesNoDebug()
1537+
{
1538+
$container = $this->createContainerFromFile('serializer_mapping_without_annotations', ['kernel.debug' => false, 'kernel.container_class' => __CLASS__]);
15331539
$this->assertTrue($container->hasDefinition('serializer.mapping.cache_class_metadata_factory'));
15341540
}
15351541

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.