chore: adds 'asPagiator' utility function
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Twig\Components;
|
||||
|
||||
use App\Util\Paginator;
|
||||
use Doctrine\ORM\Query;
|
||||
use Symfony\UX\LiveComponent\Attribute\LiveAction;
|
||||
use Symfony\UX\LiveComponent\Attribute\LiveArg;
|
||||
use Symfony\UX\LiveComponent\Attribute\LiveProp;
|
||||
@@ -19,4 +21,10 @@ trait PaginateTrait
|
||||
{
|
||||
$this->pageNumber = $page;
|
||||
}
|
||||
|
||||
private function asPaginator(Query $query): Paginator
|
||||
{
|
||||
return (new Paginator())
|
||||
->paginate($query, $this->pageNumber, $this->perPage);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user