Skip to content

Commit f5bfa66

Browse files
authored
Merge pull request #12 from netgen/PROSTORIA-56_relation_cache_tag
PROSTORIA-56: tag relations with source Content and Location IDs
2 parents 443ac0e + c0751c5 commit f5bfa66

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

bundle/Controller/ContentRelations.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Netgen\Bundle\OpenApiIbexaBundle\Controller;
66

77
use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface;
8+
use Ibexa\Contracts\HttpCache\ResponseTagger\ResponseTagger;
89
use Netgen\IbexaSiteApi\API\Values\Content;
910
use Netgen\OpenApiIbexa\Page\ContentList;
1011
use Netgen\OpenApiIbexa\Page\Output\OutputVisitor;
@@ -22,6 +23,7 @@ final class ContentRelations extends Controller
2223
{
2324
public function __construct(
2425
private ConfigResolverInterface $configResolver,
26+
private ResponseTagger $responseTagger,
2527
private OutputVisitor $outputVisitor,
2628
private int $defaultLimit,
2729
) {}
@@ -52,6 +54,12 @@ public function __invoke(Request $request, Content $content, string $fieldIdenti
5254

5355
$this->configureCache($this->configResolver, $response);
5456

57+
foreach ($content->getLocations() as $location) {
58+
$this->responseTagger->tag($location->innerLocation);
59+
}
60+
61+
$this->responseTagger->tag($content->contentInfo->innerContentInfo);
62+
5563
return $response;
5664
}
5765
}

bundle/Resources/config/services/controllers.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ services:
6969
parent: netgen.openapi_ibexa.controller.base
7070
arguments:
7171
- '@ibexa.config.resolver'
72+
- '@Ibexa\Contracts\HttpCache\ResponseTagger\ResponseTagger'
7273
- '@netgen.openapi_ibexa.page.output.visitor.output_visitor'
7374
- '%netgen.openapi_ibexa.default_limit%'
7475
public: true

0 commit comments

Comments
 (0)