Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 790 Bytes

File metadata and controls

20 lines (14 loc) · 790 Bytes

Paginator

Inside the ListControl Model, you can fetch the Paginator. The Paginator will be setup behind the scenes with data coming from Request object. It uses the page and the limit query parameter to get to life.

Now you need to bring the whole ListControl object through your querying process and set the number of total results onto the Paginator:

// A Method inside your controller
public function __invoke(): Response
{
    $listControl = ListControlFactory::createFromRequest(Request $request);
    
    // Make a query with your $listControl
    $result = $this->personRepository->loadWithListControl($listControl);
    
    $listControl->getPaginator()->setTotal($result->numberOfResults());
    
    //………
}