Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Publish/Core/REST/Server/Controller/Views.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\REST\Server\Controller;
8
9 use eZ\Publish\API\Repository\Exceptions\NotImplementedException;
10 use eZ\Publish\API\Repository\SearchService;
11 use eZ\Publish\API\Repository\Values\Content\Language;
12 use eZ\Publish\API\Repository\Values\Content\LocationQuery;
13 use eZ\Publish\Core\REST\Server\Controller;
14 use Symfony\Component\HttpFoundation\Request;
15 use eZ\Publish\Core\REST\Common\Message;
16 use eZ\Publish\Core\REST\Server\Values;
17
21 class Views extends Controller
22 {
24 private $searchService;
25
26 public function __construct(SearchService $searchService)
27 {
28 $this->searchService = $searchService;
29 }
30
36 public function createView(Request $request)
37 {
38 $viewInput = $this->inputDispatcher->parse(
39 new Message(
40 ['Content-Type' => $request->headers->get('Content-Type')],
41 $request->getContent()
42 )
43 );
44
45 if ($viewInput->query instanceof LocationQuery) {
46 $method = 'findLocations';
47 } else {
48 $method = 'findContent';
49 }
50
51 $languageFilter = [
52 'languages' => null !== $viewInput->languageCode ? [$viewInput->languageCode] : Language::ALL,
53 'useAlwaysAvailable' => $viewInput->useAlwaysAvailable ?? true,
54 ];
55 $query = $viewInput->query->query;
56 if (!empty($query->value)) {
57 $languageFilter['excludeTranslationsFromAlwaysAvailable'] = false;
58 }
59
60 return new Values\RestExecutedView(
61 [
62 'identifier' => $viewInput->identifier,
63 'searchResults' => $this->searchService->$method(
64 $viewInput->query,
65 $languageFilter
66 ),
67 ]
68 );
69 }
70
76 public function listView()
77 {
78 return new NotImplementedException('ezpublish_rest.controller.content:listView');
79 }
80
86 public function getView()
87 {
88 return new NotImplementedException('ezpublish_rest.controller.content:getView');
89 }
90
96 public function loadViewResults()
97 {
98 return new NotImplementedException('ezpublish_rest.controller.content:loadViewResults');
99 }
100 }
eZ\Publish\API\Repository\Exceptions\NotImplementedException
This Exception is thrown if a feature has not been implemented intentionally.
Definition: API/Repository/Exceptions/NotImplementedException.php:15
eZ\Publish\API\Repository\Values\Content\Language
Definition: API/Repository/Values/Content/Language.php:20
eZ\Publish\API\Repository\Values\Content\LocationQuery
This class is used to perform a Location query.
Definition: API/Repository/Values/Content/LocationQuery.php:13
eZ\Publish\Core\REST\Common\Message
Simple response struct.
Definition: Core/REST/Common/Message.php:13
eZ\Publish\Core\REST\Server\Controller\Views
Controller for Repository Views (Search, mostly).
Definition: Publish/Core/REST/Server/Controller/Views.php:22
eZ\Publish\Core\REST\Server\Controller\Views\$searchService
$searchService
Definition: Publish/Core/REST/Server/Controller/Views.php:24
eZ\Publish\Core\REST\Server\Controller\Views\loadViewResults
loadViewResults()
Get a content view results.
Definition: Publish/Core/REST/Server/Controller/Views.php:96
eZ\Publish\Core\REST\Server\Controller\Views\createView
createView(Request $request)
Creates and executes a content view.
Definition: Publish/Core/REST/Server/Controller/Views.php:36
eZ\Publish\Core\REST\Server\Controller\Views\listView
listView()
List content views.
Definition: Publish/Core/REST/Server/Controller/Views.php:76
eZ\Publish\Core\REST\Server\Controller\Views\getView
getView()
Get a content view.
Definition: Publish/Core/REST/Server/Controller/Views.php:86
eZ\Publish\Core\REST\Server\Controller\Views\__construct
__construct(SearchService $searchService)
Definition: Publish/Core/REST/Server/Controller/Views.php:26
eZ\Publish\Core\REST\Server\Controller
Definition: Publish/Core/REST/Server/Controller.php:18
eZ\Publish\Core\REST\Server\Values\RestExecutedView
RestContentCreateStruct view model.
Definition: Values/RestExecutedView.php:15
eZ\Publish\API\Repository\SearchService
Search service.
Definition: API/Repository/SearchService.php:17
eZ\Publish\Core\REST\Server\Controller
Definition: BinaryContent.php:7
eZ\Publish\Core\REST\Server\Values
Definition: Core/REST/Server/Values/BookmarkList.php:9
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.