- Documentation >
- Search >
- Product Search Criteria >
- UpdatedAt
UpdatedAt Criterion
The UpdatedAt Search Criterion searches for products based on the date when they were last updated.
Arguments
date - indicating the date that should be matched, provided as a DateTimeInterface object in PHP, or as a string acceptable by DateTimeInterface constructor in REST
operator - Operator constant (EQ, GT, GTE, LT, LTE) in PHP or its value in REST
Operators
| Operator |
Value |
Description |
Operator::EQ |
= |
Matches products updated exactly on the given date (default) |
Operator::GT |
> |
Matches products updated after the given date |
Operator::GTE |
>= |
Matches products updated on or after the given date |
Operator::LT |
< |
Matches products updated before the given date |
Operator::LTE |
<= |
Matches products updated on or before the given date |
Example
PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 | <?php declare(strict_types=1);
use DateTimeImmutable;
use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery;
use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\Operator;
use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\UpdatedAt;
$criteria = new UpdatedAt(
new DateTimeImmutable('2023-03-01'),
Operator::GTE,
);
/** @var \Ibexa\Contracts\ProductCatalog\ProductServiceInterface $productService */
$productQuery = new ProductQuery();
$productQuery->setQuery($criteria);
$results = $productService->findProducts($productQuery);
|
REST API