clone of github.com/decent-newsroom/newsroom
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

27 lines
752 B

<?php
namespace App\Provider;
use App\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use FOS\ElasticaBundle\Provider\PagerfantaPager;
use FOS\ElasticaBundle\Provider\PagerInterface;
use FOS\ElasticaBundle\Provider\PagerProviderInterface;
use Pagerfanta\Adapter\ArrayAdapter;
use Pagerfanta\Pagerfanta;
class UserProvider implements PagerProviderInterface
{
public function __construct(
private readonly EntityManagerInterface $entityManager
) {
}
public function provide(array $options = []): PagerInterface
{
// Get all users for indexing
$users = $this->entityManager->getRepository(User::class)->findAll();
return new PagerfantaPager(new Pagerfanta(new ArrayAdapter($users)));
}
}