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

QueryController.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\MVC\Symfony\Controller\Content;
8
9 use eZ\Publish\API\Repository\SearchService;
10 use eZ\Publish\Core\MVC\Symfony\View\ContentView;
11 use eZ\Publish\Core\QueryType\ContentViewQueryTypeMapper;
12
18 class QueryController
19 {
21 private $searchService;
22
24 private $contentViewQueryTypeMapper;
25
26 public function __construct(
27 ContentViewQueryTypeMapper $contentViewQueryTypeMapper,
28 SearchService $searchService
29 ) {
30 $this->contentViewQueryTypeMapper = $contentViewQueryTypeMapper;
31 $this->searchService = $searchService;
32 }
33
41 public function contentQueryAction(ContentView $view)
42 {
43 $this->runQuery($view, 'findContent');
44
45 return $view;
46 }
47
55 public function locationQueryAction(ContentView $view)
56 {
57 $this->runQuery($view, 'findLocations');
58
59 return $view;
60 }
61
69 public function contentInfoQueryAction(ContentView $view)
70 {
71 $this->runQuery($view, 'findContentInfo');
72
73 return $view;
74 }
75
82 private function runQuery(ContentView $view, $method)
83 {
84 $searchResults = $this->searchService->$method(
85 $this->contentViewQueryTypeMapper->map($view)
86 );
87 $view->addParameters([$view->getParameter('query')['assign_results_to'] => $searchResults]);
88 }
89 }
eZ\Publish\Core\MVC\Symfony\Controller\Content\QueryController
A content view controller that runs queries based on the matched view configuration.
Definition: QueryController.php:19
eZ\Publish\Core\MVC\Symfony\Controller\Content\QueryController\$contentViewQueryTypeMapper
$contentViewQueryTypeMapper
Definition: QueryController.php:24
eZ\Publish\Core\MVC\Symfony\Controller\Content\QueryController\__construct
__construct(ContentViewQueryTypeMapper $contentViewQueryTypeMapper, SearchService $searchService)
Definition: QueryController.php:26
eZ\Publish\Core\MVC\Symfony\Controller\Content\QueryController\contentInfoQueryAction
contentInfoQueryAction(ContentView $view)
Runs a contentInfo search.
Definition: QueryController.php:69
eZ\Publish\Core\MVC\Symfony\Controller\Content\QueryController\contentQueryAction
contentQueryAction(ContentView $view)
Runs a content search.
Definition: QueryController.php:41
eZ\Publish\Core\MVC\Symfony\Controller\Content\QueryController\runQuery
runQuery(ContentView $view, $method)
Runs the Query defined in $view using $method on SearchService.
Definition: QueryController.php:82
eZ\Publish\Core\MVC\Symfony\Controller\Content\QueryController\$searchService
$searchService
Definition: QueryController.php:21
eZ\Publish\Core\MVC\Symfony\Controller\Content\QueryController\locationQueryAction
locationQueryAction(ContentView $view)
Runs a location search.
Definition: QueryController.php:55
eZ\Publish\Core\MVC\Symfony\View\BaseView\getParameter
getParameter($parameterName)
Returns parameter value by $parameterName.
Definition: BaseView.php:101
eZ\Publish\Core\MVC\Symfony\View\BaseView\addParameters
addParameters(array $parameters)
Adds a hash of parameters to the existing parameters.
Definition: BaseView.php:66
eZ\Publish\Core\MVC\Symfony\View\ContentView
Main object to be rendered by the View Manager when viewing a content.
Definition: Publish/Core/MVC/Symfony/View/ContentView.php:40
eZ\Publish\API\Repository\SearchService
Search service.
Definition: API/Repository/SearchService.php:17
eZ\Publish\Core\QueryType\ContentViewQueryTypeMapper
Maps a ContentView to a QueryType.
Definition: ContentViewQueryTypeMapper.php:15
eZ\Publish\Core\MVC\Symfony\Controller\Content
Definition: DownloadController.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.