File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313
1414### Fixed
1515- Rendering template extensions for module templates
16+ - Invalidate template chain cache on shop cache clear
1617
1718### Deprecated
1819- Node ` $tag ` constructor parameter
Original file line number Diff line number Diff line change 99
1010namespace OxidEsales \Twig \Event ;
1111
12+ use OxidEsales \EshopCommunity \Internal \Framework \Cache \Event \ClearShopCacheEvent ;
1213use OxidEsales \EshopCommunity \Internal \Framework \Module \Configuration \Event \ModuleConfigurationChangedEvent ;
1314use OxidEsales \EshopCommunity \Internal \Framework \Module \Setup \Event \FinalizingModuleActivationEvent ;
1415use OxidEsales \EshopCommunity \Internal \Framework \Module \Setup \Event \FinalizingModuleDeactivationEvent ;
@@ -25,7 +26,7 @@ public function __construct(private readonly TemplateChainCacheInterface $templa
2526 }
2627
2728 public function invalidateTemplateChainCache (
28- ModuleSetupEvent |ModuleConfigurationChangedEvent |ThemeSettingChangedEvent |ThemeActivatedEvent $ event
29+ ModuleSetupEvent |ModuleConfigurationChangedEvent |ThemeSettingChangedEvent |ThemeActivatedEvent | ClearShopCacheEvent $ event
2930 ): void
3031 {
3132 $ this ->templateChainCache ->invalidate ($ event ->getShopId ());
@@ -39,6 +40,7 @@ public static function getSubscribedEvents(): array
3940 ModuleConfigurationChangedEvent::class => 'invalidateTemplateChainCache ' ,
4041 ThemeSettingChangedEvent::class => 'invalidateTemplateChainCache ' ,
4142 ThemeActivatedEvent::class => 'invalidateTemplateChainCache ' ,
43+ ClearShopCacheEvent::class => 'invalidateTemplateChainCache ' ,
4244 ];
4345 }
4446}
Original file line number Diff line number Diff line change 99
1010namespace OxidEsales \Twig \Tests \Integration \Event ;
1111
12+ use OxidEsales \EshopCommunity \Internal \Framework \Cache \Event \ClearShopCacheEvent ;
1213use OxidEsales \EshopCommunity \Internal \Framework \Module \Configuration \DataObject \ModuleConfiguration ;
1314use OxidEsales \EshopCommunity \Internal \Framework \Module \Configuration \Event \ModuleConfigurationChangedEvent ;
1415use OxidEsales \EshopCommunity \Internal \Framework \Theme \Event \ThemeSettingChangedEvent ;
@@ -89,6 +90,19 @@ public function testThemeActivatedEventInvalidatesTemplateChainCache(): void
8990 $ this ->cache ->get (self ::TEMPLATE_NAME );
9091 }
9192
93+ public function testClearShopCacheEventInvalidatesTemplateChainCache (): void
94+ {
95+ $ this ->putCacheEntry ();
96+
97+ $ this ->eventDispatcher ->dispatch (
98+ new ClearShopCacheEvent ($ this ->shopId )
99+ );
100+
101+ $ this ->expectException (TemplateChainCacheNotFoundException::class);
102+
103+ $ this ->cache ->get (self ::TEMPLATE_NAME );
104+ }
105+
92106 private function putCacheEntry (): void
93107 {
94108 $ this ->cache ->put (
You can’t perform that action at this time.
0 commit comments