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

Core/Search/Elasticsearch/Content/CriterionVisitor/DateMetadata.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitor;
8
9 use eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitor;
10 use InvalidArgumentException;
11 use DateTime;
12 use Exception;
13
17 abstract class DateMetadata extends CriterionVisitor
18 {
26 protected function getNativeTime($value)
27 {
28 if (is_numeric($value)) {
29 $date = new DateTime("@{$value}");
30 } else {
31 try {
32 $date = new DateTime($value);
33 } catch (Exception $e) {
34 throw new InvalidArgumentException('Invalid date provided: ' . $value);
35 }
36 }
37
38 return $date->format('Y-m-d\\TH:i:s\\Z');
39 }
40 }
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\Core\Search\Elasticsearch\Content\CriterionVisitor\DateMetadata\getNativeTime
getNativeTime($value)
Map value to a proper Elasticsearch date representation.
Definition: Core/Search/Elasticsearch/Content/CriterionVisitor/DateMetadata.php:26
eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitor
Visits the criterion tree into a hash representation of Elasticsearch query/filter AST.
Definition: CriterionVisitor.php:19
eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitor
Definition: CriterionVisitor/ContentIdIn.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.