KnpLabs / KnpPaginatorBundle

SEO friendly Symfony paginator to sort and paginate
http://knplabs.com/en/blog/knp-paginator-reborn
MIT License
1.76k stars 344 forks source link

SlidingPagination::setUsedRoute() must be a string #605

Closed lordjancso closed 4 years ago

lordjancso commented 4 years ago

Hello!

I'm having this error since version 5.1 during pagination when I try to paginate in a Command. The SlidingPagination objects setUsedRoute function waits for a string, but in CLI that is null.

Argument 1 passed to Knp\Bundle\PaginatorBundle\Pagination\SlidingPagination::setUsedRoute() must be of the type string, null given, called in /app/vendor/knplabs/knp-paginator-bundle/src/Subscriber/SlidingPaginationSubscriber.php on line 54

garak commented 4 years ago

Do you think a sliding pagination makes sense in cli?

lordjancso commented 4 years ago

Since the sliding pagination is the only one in this bundle, I guess I have to use that.

And yeah, it makes sense. Why not? If I have a query and I want to paginate its big result I have to use the paginator. Does not matter if its cli or not.

garak commented 4 years ago

I just trying to understand if we can add more paginations instead of adapting the existing one. Can you provide more context? For example, do you display some kind of "links" in your command output?

lordjancso commented 4 years ago

A new pagination would be. I have many commands with pagination and almost all of them paginates through a database table to create files by every "page" (for example sitemap xml files), or send email notifications or just maintain the database records.

It is much faster to paginate through large tables like this then query all the data at once.

garak commented 4 years ago

I tried to implement a different paginator, but it's harder than I thought. Anyway, method should accept a null string to be consistent with phpdoc annotations, so we need to fix it