src/Controller/SubscribersController.php line 37
<?phpnamespace App\Controller;use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;use Symfony\Component\Routing\Annotation\Route;use Symfony\Component\HttpFoundation\Response;use Symfony\Component\HttpFoundation\Request;use Doctrine\Persistence\ManagerRegistry;use Symfony\Component\HttpFoundation\RedirectResponse;use OlaSoft\Common;use App\Entity\Subscribers;/*** @Route("/os-admin/subscribers")*/class SubscribersController extends AbstractController{public function __construct(ManagerRegistry $doctrine){$this->doctrine = $doctrine;}private $doctrine;public function getDoctrine(){return $this->doctrine;}/*** @Route("/", name="subscribers-admin")* @Route("/page/{offset}", name="subscribers-admin-page")* @Route("/search/{keywords}/page/{offset}/",name="subscribers-search-admin-page")* @Route("/search/{keywords}/",name="subscribers-search-admin")*/public function admin(Request $request, $keywords=null,$offset=1){$offset--;$limit = 500;$of=$offset*$limit;$em = $this->getDoctrine()->getManager();$list= $em->getRepository(Subscribers::class)->findBy([],['date'=>'desc'],$limit,$of);$count=$em->getRepository(Subscribers::class)->count([]);$ajax = $request->isXmlHttpRequest();$response = $this->render('Admin\index.html.twig',['messages' => $list,'noAddBtn' => true,'ajax'=>$ajax,'count'=>$count,'offset'=>$offset,'title'=>'Gestion des inscriptions reçus','subtitle'=>'Liste de toutes les inscriptions']);return $ajax ?new Response(\json_encode(['content'=>$response->getContent(),'title'=>'Gestion des inscriptions reçus','subtitle'=>'Liste de toutes les inscriptions'])): $response;}}