Skip to content

Commit 8ce3412

Browse files
committed
Rest resource filter methods do not need to return a collection
1 parent 4e61a8c commit 8ce3412

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Change Log
22

3+
### 2.0.4
4+
Fixed: Rest resource filter methods do not need to return a collection
5+
36
### 2.0.3
47

58
Fixed: 2.0.2 introduced issue with ModelRestResources using callbacks in the columns array

src/Resources/ModelRestResource.php

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -443,23 +443,9 @@ public function getModelCollection()
443443

444444
Log::performance("Filtering collection", "RESTAPI");
445445

446-
$newCollection = $this->filterModelCollectionAsContainer($collection);
447-
448-
if ($newCollection){
449-
$collection = $newCollection;
450-
}
451-
452-
$newCollection = $this->filterModelCollectionForSecurity($collection);
453-
454-
if ($newCollection){
455-
$collection = $newCollection;
456-
}
457-
458-
$newCollection = $this->filterModelCollectionForQueries($collection);
459-
460-
if ($newCollection){
461-
$collection = $newCollection;
462-
}
446+
$this->filterModelCollectionAsContainer($collection);
447+
$this->filterModelCollectionForSecurity($collection);
448+
$this->filterModelCollectionForQueries($collection);
463449

464450
if ($this->parentResource instanceof ModelRestResource) {
465451
$this->parentResource->filterModelCollectionAsContainer($collection);

0 commit comments

Comments
 (0)