Skip to content

CreatedAt Criterion

The CreatedAt Search Criterion searches for products based on the date when they were created.

Arguments

  • createdAt (PHP), created_at (REST) - indicating the date that should be matched, provided as a DateTimeInterface object in PHP, or as a string acceptable by DateTime constructor in REST
  • operator - Operator constant (EQ, GT, GTE, LT, LTE) in PHP or its value in REST

Example

PHP

1
2
3
4
5
6
$criteria = new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\CreatedAt(
    new DateTime('2023-03-01'),
    \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\Operator::GTE,
);

$productQuery = new ProductQuery(null, $criteria);

REST API

1
2
3
4
5
6
7
8
<ProductQuery>
    <Filter>
        <CreatedAtCriterion>
            <created_at>2023-06-12</created_at>
            <operator>>=</operator>
        </CreatedAtCriterion>
    </Filter>
</ProductQuery>
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{
  "ProductQuery": {
    "Filter": {
      "CreatedAtCriterion": {
        "created_at": "2023-06-12",
        "operator": ">="
      }
    }
  }
}