Skip to content

Shopping list search criteria reference

The criteria are in the Ibexa\Contracts\ShoppingList\ShoppingList\Query\Criterion namespace and implement the Ibexa\Contracts\ShoppingList\Value\Query\CriterionInterface interface.

Criterion Description
CreatedAtCriterion Find shopping lists created before or after a given date.
IsDefaultCriterion Find shopping lists that are (or are not) the default one.
LogicalAnd Combine the criteria passed as arguments.
NameCriterion Find shopping lists with a name containing the given string.
OwnerCriterion Find shopping lists belonging to the given user or one of the given users.
ProductCodeCriterion Find shopping lists containing an entry with the given product code.
UpdatedAtCriterion Find shopping lists updated before or after a given date.

The following example query returns all shopping lists available to the current user. If the user’s permissions include the ShoppingListOwner self limitation, the query returns only lists created by that user. Otherwise, it returns all shopping lists in the system.

1
$query = new ShoppingListQuery();

The following example query returns current user's shopping lists, excluding the default one, and sorts them by name:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
use Ibexa\Contracts\ShoppingList\Value\Query;
use Ibexa\Contracts\ShoppingList\Value\ShoppingListQuery;

/** @var \Ibexa\Contracts\Core\Repository\PermissionResolver $permissionResolver */
$query = new ShoppingListQuery(
    new Query\Criterion\LogicalAnd(
        new Query\Criterion\OwnerCriterion($permissionResolver->getCurrentUserReference()),
        new Query\Criterion\IsDefaultCriterion(false)
    ),
    [
        new Query\SortClause\Name(),
    ]
);

For more information about shopping lists search, see List and search shopping lists.