Skip to content

Commit 3958c12

Browse files
committed
Document search
1 parent 2607a67 commit 3958c12

20 files changed

+563
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
description: Discount CreatedAt Search Criterion
3+
edition: commerce
4+
---
5+
6+
# Discount CreatedAt Criterion
7+
8+
The `CreatedAtCriterion` Search Criterion searches for discounts based on the date when they were created.
9+
10+
## Arguments
11+
12+
- `createdAt` - date to be matched, provided as a `DateTimeInterface` object
13+
- `operator` - optional operator string (EQ, GT, GTE, LT, LTE)
14+
15+
## Example
16+
17+
### PHP
18+
19+
``` php
20+
$criteria = new \Ibexa\Contracts\Discounts\Value\Query\Criterion\CreatedAtCriterion(
21+
new DateTime('2025-04-11 14:07:02'), Operator::GTE
22+
);
23+
24+
$discountQuery = new DiscountQuery($criteria);
25+
```
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
description: Discount CreatorCriterion Search Criterion
3+
edition: commerce
4+
---
5+
6+
# Creator Criterion
7+
8+
The `CreatorCriterion` Criterion searches for discounts based on the user reference.
9+
10+
## Arguments
11+
12+
- `UserReference` object - \Ibexa\Contracts\Core\Repository\Values\User\UserReference(int $userId)
13+
14+
## Example
15+
16+
### PHP
17+
18+
``` php
19+
$query = new DiscountQuery(
20+
new \Ibexa\Contracts\Discounts\Value\Query\Criterion\CreatorCriterion(
21+
\Ibexa\Core\Repository\Values\User\UserReference(14)
22+
)
23+
);
24+
```
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
description: Discount EndDate Search Criterion
3+
edition: commerce
4+
---
5+
6+
# Discount EndDate Criterion
7+
8+
The `EndDateCriterion` Search Criterion searches for discounts based on the date and time when they expire.
9+
10+
## Arguments
11+
12+
- `value` - searched value provided as the [DateTimeImmutable](https://www.php.net/manual/en/class.datetimeimmutable.php) object
13+
- `operator` - optional operator string (EQ, GT, GTE, LT, LTE)
14+
15+
## Example
16+
17+
### PHP
18+
19+
``` php
20+
$criteria = new \Ibexa\Contracts\Discounts\Value\Query\Criterion\LogicalAnd(
21+
new \Ibexa\Contracts\Discounts\Value\Query\Criterion\StartDateCriterion(
22+
new DateTimeImmutable('2025-04-11 14:07:03'), Operator::GTE
23+
),
24+
new \Ibexa\Contracts\Discounts\Value\Query\Criterion\EndDateCriterion(
25+
new DateTimeImmutable('2027-04-11 14:07:02'), Operator::LTE
26+
),
27+
);
28+
29+
$discountQuery = new DiscountQuery($criteria);
30+
```
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
description: Discount Identifier Search Criterion
3+
edition: commerce
4+
---
5+
6+
# Discount Identifier Criterion
7+
8+
The `Identifier` Search Criterion searches for discounts based on the discount identifier.
9+
10+
## Arguments
11+
12+
- `identifier` - string that represents the discount identifier
13+
14+
## Example
15+
16+
### PHP
17+
18+
``` php
19+
$criteria = new \Ibexa\Contracts\Discounts\Value\Query\Criterion\IdentifierCriterion('summer-sale');
20+
21+
$discountQuery = new DiscountQuery($criteria);
22+
```
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
description: Discount IsEnabled Search Criterion
3+
edition: commerce
4+
---
5+
6+
# Discount IsEnabled Criterion
7+
8+
The `IsEnabledCriterion` Search Criterion searches for discounts based on whether the discount is enabled or not.
9+
10+
## Arguments
11+
12+
- `value` - Boolean value stating whether the discount is enabled or not
13+
14+
## Example
15+
16+
### PHP
17+
18+
``` php
19+
$criteria = new \Ibexa\Contracts\Discounts\Value\Query\Criterion\IsEnabledCriterion(true);
20+
21+
$discountQuery = new DiscountQuery($criteria);
22+
```
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
description: Discount LogicalAnd Search Criterion
3+
edition: commerce
4+
---
5+
6+
# Discount LogicalAnd Criterion
7+
8+
The `LogicalAnd` Search Criterion matches discounts if all provided Criteria match.
9+
10+
## Arguments
11+
12+
- `criterion` - a set of Criteria combined by the logical operator
13+
14+
## Example
15+
16+
### PHP
17+
18+
``` php
19+
$criteria = new \Ibexa\Contracts\Discounts\Value\Query\Criterion\LogicalAnd(
20+
new \Ibexa\Contracts\Discounts\Value\Query\Criterion\StartDateCriterion(
21+
new DateTimeImmutable('2025-04-11 14:07:03'), Operator::GTE
22+
),
23+
new \Ibexa\Contracts\Discounts\Value\Query\Criterion\EndDateCriterion(
24+
new DateTimeImmutable('2027-04-11 14:07:02'), Operator::LTE
25+
),
26+
);
27+
28+
$discountQuery = new DiscountQuery($criteria);
29+
```
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
description: Discount LogicalOr Search Criterion
3+
edition: commerce
4+
---
5+
6+
# Discount LogicalOr Criterion
7+
8+
The `LogicalOr` Search Criterion matches discounts if at least one of the provided Criteria matches.
9+
10+
## Arguments
11+
12+
- `criterion` - a set of Criteria combined by the logical operator
13+
14+
## Example
15+
16+
### PHP
17+
18+
``` php
19+
$criteria = new LogicalOr(
20+
new StartDateCriterion(new DateTimeImmutable('2025-04-11 14:07:03'), Operator::GTE),
21+
new CreatedAtCriterion(new DateTime('2025-04-11 14:07:02'), Operator::GTE),
22+
);
23+
24+
$discountQuery = new DiscountQuery($criteria);
25+
```
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
description: Discount NameCriterion Search Criterion
3+
edition: commerce
4+
---
5+
6+
# Discount Name Criterion
7+
8+
The `NameCriterion` Search Criterion searches for discounts based on the discount name.
9+
10+
## Arguments
11+
12+
- `value` - string that represents the discount name
13+
14+
## Example
15+
16+
### PHP
17+
18+
``` php
19+
$criteria = new \Ibexa\Contracts\Discounts\Value\Query\Criterion\NameCriterion('Summer sale');
20+
21+
$discountQuery = new DiscountQuery($criteria);
22+
```
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
description: Discount PriorityCriterion Search Criterion
3+
edition: commerce
4+
---
5+
6+
# Priority Criterion
7+
8+
The `PriorityCriterion` Criterion searches for discounts based on their priority.
9+
10+
## Arguments
11+
12+
- `value` - numerical value representing the discount's priority
13+
14+
## Example
15+
16+
### PHP
17+
18+
``` php
19+
$criteria = new \Ibexa\Contracts\Discounts\Value\Query\Criterion\PriorityCriterion(5);
20+
21+
$discountQuery = new DiscountQuery($criteria);
22+
```
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
description: Discount Search Criteria
3+
edition: commerce
4+
---
5+
6+
# Discount Search Criteria reference
7+
8+
Discount Search Criteria are only supported by [Discount Search (`DiscountService::findDiscounts`)](discounts_api.md#get-multiple-discounts).
9+
10+
With these Criteria you can filter discounts, for example, by their discount identifier, name, creation date, discount status, priority, or type.
11+
12+
## Discount Search Criteria
13+
14+
|Search Criterion|Search based on|
15+
|-----|-----|
16+
|[CreatedAtCriterion](discount_created_criterion.md)|Date and time when the discount was created|
17+
|[CreatorCriterion](discount_creator_criterion.md)|User who created the discount|
18+
|[EndDateCriterion](discount_end_date_criterion.md)|Date and time when the discount expires|
19+
|[IdentifierCriterion](discount_identifier_criterion.md)|Discount identifier|
20+
|[IsEnabledCriterion](discount_is_enabled_criterion.md)|Whether the discount is enabled or not|
21+
|[LogicalAndCriterion](discount_logicaland_criterion.md)|Owner based on the user reference|
22+
|[LogicalOrCriterion](discount_logicalor_criterion.md)|Owner based on the user reference|
23+
|[NameCriterion](discount_name_criterion.md)|The name of the discount|
24+
|[PriorityCriterion](discount_priority_criterion.md)|Priority value of the discount|
25+
|[StartDateCriterion](discount_start_date_criterion.md)|Date and time when the discount begins|
26+
|[TypeCriterion](discount_type_criterion.md)|Type value of the criterion|

0 commit comments

Comments
 (0)