- Documentation >
- Search >
- Sort Clause reference >
- Action Configuration Sort Clauses
Action Configuration Search Sort Clauses reference
Sort Clauses are found in the Ibexa\Contracts\ConnectorAi\ActionConfiguration\Query\SortClause
namespace, implementing the SortClauseInterface interface:
The following example shows how to use them to sort the searched Action Configurations:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 | <?php
declare(strict_types=1);
use Ibexa\Contracts\ConnectorAi\ActionConfiguration\ActionConfigurationQuery;
use Ibexa\Contracts\ConnectorAi\ActionConfiguration\Query\Criterion;
use Ibexa\Contracts\ConnectorAi\ActionConfiguration\Query\SortClause;
use Ibexa\Contracts\CoreSearch\Values\Query\AbstractSortClause;
use Ibexa\Contracts\CoreSearch\Values\Query\Criterion\FieldValueCriterion;
$query = new ActionConfigurationQuery(
new Criterion\LogicalAnd(
new Criterion\Enabled(),
new Criterion\LogicalOr(
new Criterion\Name('Casual', FieldValueCriterion::COMPARISON_STARTS_WITH),
new Criterion\Identifier('casual')
)
),
[
new SortClause\Enabled(AbstractSortClause::SORT_DESC),
new SortClause\Identifier(AbstractSortClause::SORT_ASC),
]
);
/** @var \Ibexa\Contracts\ConnectorAi\ActionConfigurationServiceInterface $actionConfigurationService */
$results = $actionConfigurationService->findActionConfigurations($query);
|
The search results are sorted by:
- status, with enabled on top
- identifier, in ascending order.