Skip to content

Commit

Permalink
CompatController: Add getFilter method
Browse files Browse the repository at this point in the history
  • Loading branch information
raviks789 committed Sep 29, 2023
1 parent 656c1dc commit 0cb9b32
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Compat/CompatController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
use ipl\Html\ValidHtml;
use ipl\Orm\Query;
use ipl\Stdlib\Contract\Paginatable;
use ipl\Stdlib\Filter;
use ipl\Web\Control\LimitControl;
use ipl\Web\Control\PaginationControl;
use ipl\Web\Control\SearchBar;
use ipl\Web\Control\SortControl;
use ipl\Web\Filter\QueryString;
use ipl\Web\Layout\Content;
use ipl\Web\Layout\Controls;
use ipl\Web\Layout\Footer;
Expand Down Expand Up @@ -44,6 +46,9 @@ class CompatController extends Controller
/** @var array */
protected $parts;

/** @var Filter\Rule */
protected $filter;

protected function prepareInit()
{
parent::prepareInit();
Expand Down Expand Up @@ -509,4 +514,18 @@ public function postDispatch()

parent::postDispatch();
}

/**
* Get the filter created from query string parameters
*
* @return Filter\Rule
*/
public function getFilter(): Filter\Rule
{
if ($this->filter === null) {
$this->filter = QueryString::parse((string) $this->params);
}

return $this->filter;
}
}

0 comments on commit 0cb9b32

Please sign in to comment.