Skip to content

Shopping List Search Criterion reference

Shopping list search can be done with Ibexa\Contracts\ShoppingList\ShoppingListServiceInterface::findShoppingLists() method with a Ibexa\Contracts\ShoppingList\Value\ShoppingListQuery built with criteria from the Ibexa\Contracts\ShoppingList\ShoppingList\Query\Criterion namespace, implementing the Ibexa\Contracts\ShoppingList\Value\Query\CriterionInterface interface:

TODO: Ibexa\Contracts\CoreSearch\Values\Query\Criterion\CriterionInterface is directly used instead of the ShoppingList one.

Criterion Description
IsDefaultCriterion Find shopping lists that are (or are not) the default one.
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.
CreatedAtCriterion Find shopping lists created before or after a given date.
UpdatedAtCriterion Find shopping lists updated before or after a given date.
ProductCodeCriterion Find shopping lists containing an entry with the given product code.
LogicalAnd Combine the criteria passed as arguments.

The following query example gets all shopping lists if current user doesn't have any limitation, or get all current user's lists otherwise:

1
$query = new ShoppingListQuery();

The following query example gets current user's shopping lists except the default one sorted by name:

1
2
3
4
$query = new ShoppingListQuery(new Query\Criterion\LogicalAnd(
    new Query\Criterion\OwnerCriterion($this->permissionResolver->getCurrentUserReference()),
    new Query\Criterion\IsDefaultCriterion(false)
), [new Query\SortClause\Name()]);