Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example of casting an array of entities to a collection
namespace App\Entity;
use ArrayIterator;
class UserCollection extends ArrayIterator
$users = new UserCollection($userRepository->findAll());
Copy link

weierophinney commented Jun 5, 2018

Note the change from extending Zend\Paginator\Paginator to extending ArrayIterator.

If you want to do pagination, you'll need to use something like the

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment