Skip to content

Commit 6750212

Browse files
committed
PROSTORIA-56: tag relations with source Content and Location IDs
1 parent f16f361 commit 6750212

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

bundle/Controller/ContentRelations.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
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;
10+
use Netgen\IbexaSiteApi\API\Values\Location;
911
use Netgen\OpenApiIbexa\Page\ContentList;
1012
use Netgen\OpenApiIbexa\Page\Output\OutputVisitor;
1113
use Symfony\Component\HttpFoundation\JsonResponse;
@@ -22,6 +24,7 @@ final class ContentRelations extends Controller
2224
{
2325
public function __construct(
2426
private ConfigResolverInterface $configResolver,
27+
private ResponseTagger $responseTagger,
2528
private OutputVisitor $outputVisitor,
2629
private int $defaultLimit,
2730
) {}
@@ -52,6 +55,12 @@ public function __invoke(Request $request, Content $content, string $fieldIdenti
5255

5356
$this->configureCache($this->configResolver, $response);
5457

58+
foreach ($content->getLocations() as $location) {
59+
$this->responseTagger->tag($location->innerLocation);
60+
}
61+
62+
$this->responseTagger->tag($content->contentInfo->innerContentInfo);
63+
5564
return $response;
5665
}
5766
}

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)