Skip to content

Commit f16f361

Browse files
committed
Tag parent location when fetching siblings and children
1 parent 6e2bff9 commit f16f361

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

bundle/Controller/LocationChildren.php

Lines changed: 5 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\Location;
910
use Netgen\OpenApiIbexa\Page\LocationList;
1011
use Netgen\OpenApiIbexa\Page\Output\OutputVisitor;
@@ -22,6 +23,7 @@ final class LocationChildren extends Controller
2223
{
2324
public function __construct(
2425
private ConfigResolverInterface $configResolver,
26+
private ResponseTagger $responseTagger,
2527
private OutputVisitor $outputVisitor,
2628
private int $defaultLimit,
2729
) {}
@@ -51,6 +53,9 @@ public function __invoke(Request $request, Location $location, int $maxPerPage,
5153

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

56+
$this->responseTagger->tag($location->innerLocation);
57+
$this->responseTagger->tag($location->contentInfo->innerContentInfo);
58+
5459
return $response;
5560
}
5661
}

bundle/Controller/LocationSiblings.php

Lines changed: 5 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\Location;
910
use Netgen\OpenApiIbexa\Page\LocationList;
1011
use Netgen\OpenApiIbexa\Page\Output\OutputVisitor;
@@ -22,6 +23,7 @@ final class LocationSiblings extends Controller
2223
{
2324
public function __construct(
2425
private ConfigResolverInterface $configResolver,
26+
private ResponseTagger $responseTagger,
2527
private OutputVisitor $outputVisitor,
2628
private int $defaultLimit,
2729
) {}
@@ -51,6 +53,9 @@ public function __invoke(Request $request, Location $location, int $maxPerPage,
5153

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

56+
$this->responseTagger->tag($location->innerLocation);
57+
$this->responseTagger->tag($location->contentInfo->innerContentInfo);
58+
5459
return $response;
5560
}
5661
}

bundle/Resources/config/services/controllers.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ services:
4545
parent: netgen.openapi_ibexa.controller.base
4646
arguments:
4747
- '@ibexa.config.resolver'
48+
- '@Ibexa\Contracts\HttpCache\ResponseTagger\ResponseTagger'
4849
- '@netgen.openapi_ibexa.page.output.visitor.output_visitor'
4950
- '%netgen.openapi_ibexa.default_limit%'
5051
public: true
@@ -56,6 +57,7 @@ services:
5657
parent: netgen.openapi_ibexa.controller.base
5758
arguments:
5859
- '@ibexa.config.resolver'
60+
- '@Ibexa\Contracts\HttpCache\ResponseTagger\ResponseTagger'
5961
- '@netgen.openapi_ibexa.page.output.visitor.output_visitor'
6062
- '%netgen.openapi_ibexa.default_limit%'
6163
public: true

0 commit comments

Comments
 (0)