Open sylvan-d-ash opened 8 years ago
Apparently there is no. It would be good to have one configured for entire app the same way as exception strategy.
Hi @winter7621, as @sstok has pointed out, you can use the method setMaxPerPage
.
@kshishkin If setting a value as default is what you want, you can extend the class Pagerfanta and customise the __construct()
to set your preferred setMaxPerPage
.
For instance:
src/AppBundle/Model/MyCustomPagerfanta.php
<?php
namespace AppBundle\Model;
use Pagerfanta\Pagerfanta; use Pagerfanta\Adapter\AdapterInterface;
class MyCustomPagerfanta extends Pagerfanta { public function construct(AdapterInterface $adapter) { parent::construct($adapter); $this->setMaxPerPage(/ your preferred value /); } }
Hi @winter7621,
It looks like Sylius itself exposes an option for you in its routing configuration: http://docs.sylius.org/en/latest/bundles/SyliusResourceBundle/index_resources.html#changing-the-max-per-page-option-of-paginator
For example (from their docs linked to above):
# app/config/routing.yml
app_book_index_top:
path: /books/top
methods: [GET]
defaults:
_controller: app.controller.book:indexAction
_sylius:
paginate: 5
sortable: true
sorting:
score: desc
template: Book/top.html.twig
This changes the max-per-page to 5.
Hope this helps!
Hi,
Is there a config setting for specifying the default maximum number of items per page? I'm using Sylius which comes with Pagerfanta, but so far I haven't been able to find a config for this short of altering the
vendor
files