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;
51
51
use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause;
52
52
53
53
$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
+ ]);
54
62
55
- // Find trashed articles
56
- $query->filter = new Criterion\ContentTypeId([2]);
57
-
58
- // Sort by date trashed (most recent first), then by content name
59
63
$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)
62
67
];
63
68
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)
64
72
$results = $trashService->findTrashItems($query);
65
73
```
You can’t perform that action at this time.
0 commit comments