KnpPaginatorBundle
KnpPaginatorBundle copied to clipboard
Add missing methods in SlidingPaginationInterface
Why such methods are supposed to be "missing"?
Short answer: You can't find them in the interface ;)
Long answer (based on my case): I built some pageable object which serves more data (total pages, first, last, total items, next page, etc...) in rest api response. SlidingPagination provides most of these methods but:
- You can't mock SlidingPagination class because it's final
- Would be better to inject interface than base class
I wonder why not all methods are in this interface? Is there any purpose of that?
Can't you use AbstractPagination or PaginationInterface instead?
No because AbstractPagination and PaginationInterface doesn't have such methods. Like I mentioned only SlidingPagination has these methods but SlidingPaginationInterface has some lacks.
Maybe my point of view is too narrow and I don't fully understand your thoughts why SlidingPaginationInterface can't have such methods, then explain please.
You can find relevant informations in issue #598 and related PR
Thanks, but it doesn't explain why we can't add methods in SlidingPaginationInterface which are exist in SlidingPagination. SlidingPaginationInterface in not fully consistent with SlidingPagination.
I guess that interface was created just with needed (e.g. actually used) methods.
Yeah, perhaps. SlidingPagination evolved but someone forgot to update SlidingPaginationInterface and now it's time to do this.
SlidingPaginationInterface had no evolution: it was created just a couple of weeks ago to solve aforementioned issue