4
4
5
5
namespace Netgen \Bundle \OpenApiIbexaBundle \Controller ;
6
6
7
+ use Ibexa \Contracts \Core \SiteAccess \ConfigResolverInterface ;
7
8
use Netgen \IbexaSiteApi \API \Values \Location ;
8
9
use Netgen \OpenApiIbexa \Page \LocationList ;
9
10
use Netgen \OpenApiIbexa \Page \Output \OutputVisitor ;
10
- use Symfony \Bundle \FrameworkBundle \Controller \AbstractController ;
11
11
use Symfony \Component \HttpFoundation \JsonResponse ;
12
12
use Symfony \Component \HttpFoundation \Request ;
13
13
use Symfony \Component \HttpFoundation \Response ;
18
18
use const JSON_THROW_ON_ERROR ;
19
19
use const JSON_UNESCAPED_SLASHES ;
20
20
21
- final class LocationChildren extends AbstractController
21
+ final class LocationChildren extends Controller
22
22
{
23
23
public function __construct (
24
+ private ConfigResolverInterface $ configResolver ,
24
25
private OutputVisitor $ outputVisitor ,
25
26
private int $ defaultLimit ,
26
27
) {}
@@ -41,11 +42,15 @@ public function __invoke(Request $request, Location $location, int $maxPerPage,
41
42
42
43
$ data = $ this ->outputVisitor ->visit (new LocationList ($ children ));
43
44
44
- return new JsonResponse (
45
+ $ response = new JsonResponse (
45
46
json_encode ($ data , JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES ),
46
47
Response::HTTP_OK ,
47
48
[],
48
49
true ,
49
50
);
51
+
52
+ $ this ->configureCache ($ this ->configResolver , $ response );
53
+
54
+ return $ response ;
50
55
}
51
56
}
0 commit comments