File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -51,15 +51,23 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion;
5151use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause;
5252
5353$query = new Query();
54+ $query->filter = new Criterion\LogicalAnd([
55+ new Criterion\ContentTypeId([2]), // Articles
56+ new Criterion\DateMetadata(
57+ Criterion\DateMetadata::TRASHED,
58+ Criterion\Operator::GTE,
59+ strtotime('-30 days')
60+ )
61+ ]);
5462
55- // Find trashed articles
56- $query->filter = new Criterion\ContentTypeId([2]);
57-
58- // Sort by date trashed (most recent first), then by content name
5963$query->sortClauses = [
60- new SortClause\DateTrashed(Query::SORT_DESC),
61- new SortClause\ContentName(Query::SORT_ASC)
64+ new SortClause\Trash\DateTrashed(Query::SORT_DESC),
65+ new SortClause\ContentName(Query::SORT_ASC),
66+ new SortClause\ContentTypeName(Query::SORT_ASC)
6267];
6368
69+ // Search for articles trashed in the last 30 days
70+ // Results will be sorted by date trashed (most recent first),
71+ // then by content name and Content Type name (alphabetically)
6472$results = $trashService->findTrashItems($query);
6573```
You can’t perform that action at this time.
0 commit comments