mirror of
https://github.com/flarum/framework.git
synced 2024-11-29 12:43:52 +08:00
Make filter mutator API consistent with search mutator API.
This is inline with the docblock for the Filter extender, and is much more sensible.
This commit is contained in:
parent
6c4867d547
commit
99311188a2
|
@ -77,7 +77,7 @@ abstract class AbstractFilterer
|
|||
// END DEPRECATED BC LAYER
|
||||
|
||||
foreach ($this->filterMutators as $mutator) {
|
||||
$mutator($query, $actor, $criteria->query, $criteria->sort);
|
||||
$mutator($filterState, $criteria);
|
||||
}
|
||||
|
||||
// Execute the filter query and retrieve the results. We get one more
|
||||
|
|
|
@ -84,8 +84,8 @@ class FilterTest extends TestCase
|
|||
*/
|
||||
public function filter_mutator_has_effect_if_added()
|
||||
{
|
||||
$this->extend((new Extend\Filter(DiscussionFilterer::class))->addFilterMutator(function ($query, $actor, $filters, $sort) {
|
||||
$query->getQuery()->whereRaw('1=0');
|
||||
$this->extend((new Extend\Filter(DiscussionFilterer::class))->addFilterMutator(function ($filterState, $criteria) {
|
||||
$filterState->getQuery()->whereRaw('1=0');
|
||||
}));
|
||||
|
||||
$this->prepDb();
|
||||
|
@ -127,8 +127,8 @@ class NoResultFilter implements FilterInterface
|
|||
|
||||
class CustomFilterMutator
|
||||
{
|
||||
public function __invoke($query, $actor, $filters, $sort)
|
||||
public function __invoke($filterState, $criteria)
|
||||
{
|
||||
$query->getQuery()->whereRaw('1=0');
|
||||
$filterState->getQuery()->whereRaw('1=0');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user