Skip to content

Commit 018b109

Browse files
committed
bug #41961 [Serializer] Need to clear cache when updating Annotation Groups on Entities (monteiro)
This PR was squashed before being merged into the 5.3 branch. Discussion ---------- [Serializer] Need to clear cache when updating Annotation Groups on Entities | Q | A | ------------- | --- | Branch? | 5.3 <!-- see below --> | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #40034 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT Sample project that mimics this behavior: https://github.com/monteiro/PR-40856 The solution was suggested by `@nicolas`-grekas [here](#40856). Commits ------- a6829be [Serializer] Need to clear cache when updating Annotation Groups on Entities
2 parents f93df63 + a6829be commit 018b109

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,6 +1705,9 @@ private function registerSecurityCsrfConfiguration(array $config, ContainerBuild
17051705
private function registerSerializerConfiguration(array $config, ContainerBuilder $container, PhpFileLoader $loader)
17061706
{
17071707
$loader->load('serializer.php');
1708+
if ($container->getParameter('kernel.debug')) {
1709+
$container->removeDefinition('serializer.mapping.cache_class_metadata_factory');
1710+
}
17081711

17091712
$chainLoader = $container->getDefinition('serializer.mapping.chain_loader');
17101713

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,10 +1400,10 @@ public function testSerializerCacheActivated()
14001400
$this->assertEquals(new Reference('serializer.mapping.cache.symfony'), $cache);
14011401
}
14021402

1403-
public function testSerializerCacheActivatedDebug()
1403+
public function testSerializerCacheNotActivatedDebug()
14041404
{
14051405
$container = $this->createContainerFromFile('serializer_enabled', ['kernel.debug' => true, 'kernel.container_class' => __CLASS__]);
1406-
$this->assertTrue($container->hasDefinition('serializer.mapping.cache_class_metadata_factory'));
1406+
$this->assertFalse($container->hasDefinition('serializer.mapping.cache_class_metadata_factory'));
14071407
}
14081408

14091409
public function testSerializerMapping()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy