Skip to content

Commit 1fc5d14

Browse files
Copilotalongosz
andcommitted
Fix code sample to match existing patterns and simplify example
Co-authored-by: alongosz <7099219+alongosz@users.noreply.github.com>
1 parent 6d799a5 commit 1fc5d14

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

docs/search/search_in_trash_reference.md

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,15 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion;
5151
use 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-
]);
6254

55+
// Find trashed articles
56+
$query->filter = new Criterion\ContentTypeId([2]);
57+
58+
// Sort by date trashed (most recent first), then by content name
6359
$query->sortClauses = [
6460
new SortClause\DateTrashed(Query::SORT_DESC),
65-
new SortClause\ContentName(Query::SORT_ASC),
66-
new SortClause\ContentTypeName(Query::SORT_ASC)
61+
new SortClause\ContentName(Query::SORT_ASC)
6762
];
6863

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)
7264
$results = $trashService->findTrashItems($query);
7365
```

0 commit comments

Comments
 (0)