-
The PagerFanta object is iterable (e.g. in Twig), but casting it to an array returns unexpected results:
I'd just expect it to return the current page's results. Is there a reason why that's not so |
Beta Was this translation helpful? Give feedback.
Answered by
mbabker
Sep 2, 2020
Replies: 1 comment
-
You can't reliably cast PHP objects to arrays like that. You can call |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
mbabker
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can't reliably cast PHP objects to arrays like that. You can call
$pager->getCurrentPageResults()
to get the current page results as an iterable (plain array or a class implementing theTraversable
interface), and if necessary use the nativeiterator_to_array()
function you convert the traversable class to an array.