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

OptionsResolverBasedQueryType.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\QueryType;
8
9 use eZ\Publish\API\Repository\Values\Content\Query;
10 use Symfony\Component\OptionsResolver\OptionsResolver;
11
22 abstract class OptionsResolverBasedQueryType implements QueryType
23 {
25 private $resolver;
26
40 abstract protected function configureOptions(OptionsResolver $optionsResolver);
41
52 abstract protected function doGetQuery(array $parameters);
53
54 final public function getSupportedParameters()
55 {
56 return $this->getResolver()->getDefinedOptions();
57 }
58
59 final public function getQuery(array $parameters = [])
60 {
61 return $this->doGetQuery(
62 $this->getResolver()->resolve($parameters)
63 );
64 }
65
71 private function getResolver()
72 {
73 if ($this->resolver === null) {
74 $this->resolver = new OptionsResolver();
75 $this->configureOptions($this->resolver);
76 }
77
78 return $this->resolver;
79 }
80 }
eZ\Publish\API\Repository\Values\Content\Query
This class is used to perform a Content query.
Definition: API/Repository/Values/Content/Query.php:15
eZ\Publish\Core\QueryType\OptionsResolverBasedQueryType
An abstract QueryType class that facilitates parameters handling.
Definition: OptionsResolverBasedQueryType.php:23
eZ\Publish\Core\QueryType\OptionsResolverBasedQueryType\$resolver
$resolver
Definition: OptionsResolverBasedQueryType.php:25
eZ\Publish\Core\QueryType\OptionsResolverBasedQueryType\getQuery
getQuery(array $parameters=[])
Builds and returns the Query object.
Definition: OptionsResolverBasedQueryType.php:59
eZ\Publish\Core\QueryType\OptionsResolverBasedQueryType\configureOptions
configureOptions(OptionsResolver $optionsResolver)
Configures the OptionsResolver for the QueryType.
eZ\Publish\Core\QueryType\OptionsResolverBasedQueryType\getResolver
getResolver()
Builds the resolver, and configures it using configureOptions().
Definition: OptionsResolverBasedQueryType.php:71
eZ\Publish\Core\QueryType\OptionsResolverBasedQueryType\getSupportedParameters
getSupportedParameters()
Returns an array listing the parameters supported by the QueryType.
Definition: OptionsResolverBasedQueryType.php:54
eZ\Publish\Core\QueryType\OptionsResolverBasedQueryType\doGetQuery
doGetQuery(array $parameters)
Builds and returns the Query object.
eZ\Publish\Core\QueryType\QueryType
A QueryType is a pre-defined content or location query.
Definition: QueryType.php:17
eZ\Publish\Core\QueryType
Definition: ArrayQueryTypeRegistry.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.