1717use DateTime ;
1818use Doctrine \ORM \EntityManagerInterface ;
1919use eZ \Publish \API \Repository \Values \Content \Location ;
20- use EzSystems \ PlatformHttpCacheBundle \ PurgeClient \ PurgeClientInterface ;
20+ use Ibexa \ Contracts \ HttpCache \ Handler \ ContentTagInterface ;
2121use Novactive \Bundle \eZProtectedContentBundle \Entity \ProtectedAccess ;
2222use Novactive \Bundle \eZProtectedContentBundle \Form \ProtectedAccessType ;
2323use Symfony \Component \Form \FormFactoryInterface ;
@@ -38,7 +38,7 @@ public function handle(
3838 FormFactoryInterface $ formFactory ,
3939 EntityManagerInterface $ entityManager ,
4040 RouterInterface $ router ,
41- PurgeClientInterface $ httpCachePurgeClient ,
41+ ContentTagInterface $ responseTagger ,
4242 ?ProtectedAccess $ access = null
4343 ): RedirectResponse {
4444 if ($ request ->isMethod ('post ' )) {
@@ -54,12 +54,8 @@ public function handle(
5454 $ access ->setUpdated ($ now );
5555 $ entityManager ->persist ($ access );
5656 $ entityManager ->flush ();
57- $ httpCachePurgeClient ->purge (
58- [
59- 'location- ' .$ location ->id ,
60- 'location- ' .$ location ->parentLocationId ,
61- ]
62- );
57+ $ responseTagger ->addLocationTags ([$ location ->id ]);
58+ $ responseTagger ->addParentLocationTags ([$ location ->parentLocationId ]);
6359 }
6460 }
6561
@@ -78,18 +74,14 @@ public function remove(
7874 Location $ location ,
7975 EntityManagerInterface $ entityManager ,
8076 RouterInterface $ router ,
81- ProtectedAccess $ access ,
82- PurgeClientInterface $ httpCachePurgeClient
77+ int $ access ,
78+ ContentTagInterface $ responseTagger
8379 ): RedirectResponse {
80+ $ access = $ entityManager ->find (ProtectedAccess::class, $ access );
8481 $ entityManager ->remove ($ access );
8582 $ entityManager ->flush ();
86-
87- $ httpCachePurgeClient ->purge (
88- [
89- 'location- ' .$ location ->id ,
90- 'location- ' .$ location ->parentLocationId ,
91- ]
92- );
83+ $ responseTagger ->addLocationTags ([$ location ->id ]);
84+ $ responseTagger ->addParentLocationTags ([$ location ->parentLocationId ]);
9385
9486 return new RedirectResponse (
9587 $ router ->generate ('ibexa.content.view ' , ['contentId ' => $ location ->contentId ,
0 commit comments