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

Core/Search/Legacy/Content/Common/Gateway/CriterionHandler/DateMetadata.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler;
8
9 use eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler;
10 use eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter;
11 use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
12 use eZ\Publish\Core\Persistence\Database\SelectQuery;
13 use RuntimeException;
14
18 class DateMetadata extends CriterionHandler
19 {
27 public function accept(Criterion $criterion)
28 {
29 return $criterion instanceof Criterion\DateMetadata;
30 }
31
44 public function handle(
45 CriteriaConverter $converter,
46 SelectQuery $query,
47 Criterion $criterion,
48 array $languageSettings
49 ) {
50 $column = $this->dbHandler->quoteColumn(
51 $criterion->target === Criterion\DateMetadata::MODIFIED ? 'modified' : 'published',
52 'ezcontentobject'
53 );
54
55 switch ($criterion->operator) {
56 case Criterion\Operator::IN:
57 return $query->expr->in(
58 $column,
59 $criterion->value
60 );
61
62 case Criterion\Operator::BETWEEN:
63 return $query->expr->between(
64 $column,
65 $query->bindValue($criterion->value[0]),
66 $query->bindValue($criterion->value[1])
67 );
68
69 case Criterion\Operator::EQ:
70 case Criterion\Operator::GT:
71 case Criterion\Operator::GTE:
72 case Criterion\Operator::LT:
73 case Criterion\Operator::LTE:
74 $operatorFunction = $this->comparatorMap[$criterion->operator];
75
76 return $query->expr->$operatorFunction(
77 $column,
78 $query->bindValue(reset($criterion->value))
79 );
80
81 default:
82 throw new RuntimeException(
83 "Unknown operator '{$criterion->operator}' for DateMetadata criterion handler."
84 );
85 }
86 }
87 }
eZ\Publish\API\Repository\Values\Content\Query\Criterion\DateMetadata
A criterion that matches content based on one of the date metadata (created or modified).
Definition: API/Repository/Values/Content/Query/Criterion/DateMetadata.php:32
eZ\Publish\API\Repository\Values\Content\Query\Criterion
Definition: API/Repository/Values/Content/Query/Criterion.php:15
eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter
Content locator gateway implementation using the DoctrineDatabase.
Definition: Search/Legacy/Content/Common/Gateway/CriteriaConverter.php:17
eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\DateMetadata\handle
handle(CriteriaConverter $converter, SelectQuery $query, Criterion $criterion, array $languageSettings)
Generate query expression for a Criterion this handler accepts.
Definition: Core/Search/Legacy/Content/Common/Gateway/CriterionHandler/DateMetadata.php:44
eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\DateMetadata\accept
accept(Criterion $criterion)
Check if this criterion handler accepts to handle the given criterion.
Definition: Core/Search/Legacy/Content/Common/Gateway/CriterionHandler/DateMetadata.php:27
eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler
Definition: Search/Legacy/Content/Common/Gateway/CriterionHandler.php:15
eZ\Publish\Core\Persistence\Database\Query\bindValue
bindValue($value, $placeHolder=null, $type=PDO::PARAM_STR)
Binds the value $value to the specified variable name $placeHolder.
eZ\Publish\Core\Persistence\Database\SelectQuery
Definition: SelectQuery.php:16
eZ\Publish\API\Repository\Values\Content\Query\Criterion
Definition: API/Repository/Values/Content/Query/Criterion/Ancestor.php:7
eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler
Definition: Core/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentId.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.