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

CriterionVisitor/DateMetadata/PublishedIn.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitor\DateMetadata;
8
9 use eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitorDispatcher as Dispatcher;
10 use eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitor\DateMetadata;
11 use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
12 use eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator;
13
17 class PublishedIn extends DateMetadata
18 {
26 public function canVisit(Criterion $criterion)
27 {
28 return
29 $criterion instanceof Criterion\DateMetadata &&
30 $criterion->target === 'created' &&
31 (
32 ($criterion->operator ?: Operator::IN) === Operator::IN ||
33 $criterion->operator === Operator::EQ
34 );
35 }
36
46 public function visitFilter(Criterion $criterion, Dispatcher $dispatcher, array $languageFilter)
47 {
48 if (count($criterion->value) > 1) {
49 $that = $this;
50 $filter = [
51 'terms' => [
52 'published_dt' => array_map(
53 function ($timestamp) use ($that) {
54 return $that->getNativeTime($timestamp);
55 },
56 $criterion->value
57 ),
58 ],
59 ];
60 } else {
61 $filter = [
62 'term' => [
63 'published_dt' => $this->getNativeTime($criterion->value),
64 ],
65 ];
66 }
67
68 return $filter;
69 }
70 }
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\Operator\EQ
const EQ
Definition: API/Repository/Values/Content/Query/Criterion/Operator.php:16
eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\IN
const IN
Definition: API/Repository/Values/Content/Query/Criterion/Operator.php:21
eZ\Publish\API\Repository\Values\Content\Query\Criterion
Definition: API/Repository/Values/Content/Query/Criterion.php:15
eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitorDispatcher
Dispatches Criterion objects to a visitor depending on the query context.
Definition: CriterionVisitorDispatcher.php:19
eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitor\DateMetadata\PublishedIn
Visits the PublishedIn DateMetadata criterion.
Definition: CriterionVisitor/DateMetadata/PublishedIn.php:18
eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitor\DateMetadata\PublishedIn\visitFilter
visitFilter(Criterion $criterion, Dispatcher $dispatcher, array $languageFilter)
Map field value to a proper Elasticsearch filter representation.
Definition: CriterionVisitor/DateMetadata/PublishedIn.php:46
eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitor\DateMetadata\PublishedIn\canVisit
canVisit(Criterion $criterion)
Check if visitor is applicable to current criterion.
Definition: CriterionVisitor/DateMetadata/PublishedIn.php:26
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\API\Repository\Values\Content\Query\Criterion\Operator
Definition: Specifications.php:7
eZ\Publish\API\Repository\Values\Content\Query\Criterion
Definition: API/Repository/Values/Content/Query/Criterion/Ancestor.php:7
eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitor\DateMetadata
Definition: CriterionVisitor/DateMetadata/ModifiedIn.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.