<?php
namespace App\Controller\Pack;
use App\Entity\PfoNotif;
use App\Repository\PfoNotifRepository;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
class NotifController extends AbstractController
{
/**
* @Route("/pack/notif/view/{id}", name="pack_notif_view")
*/
public function view(PfoNotif $pfoNotif) : Response
{
return $this->json($pfoNotif, 200, [] , ['groups' => ['show_notif']]);
}
/**
* @Route("/", name="jobs")
*
*/
public function jobs(PfoNotifRepository $pfoNotifRepository) : Response
{
$pfoNotifs = $pfoNotifRepository->findSort('pf.created', 'DESC');
return $this->render('jobs/index.html.twig', [
'list' => $pfoNotifs,
]);
}
/**
* @Route("/pack/notif/tri/all", name="jobs_tri")
*/
public function tri(Request $request, PfoNotifRepository $pfoNotifRepository)
{
$order = ($request->get('order') != null) ? $request->get('order') : 'id';
$dir = ($request->get('dir') != null) ? $request->get('dir') : 'desc';
$pfoNotifs = $pfoNotifRepository->findSort($order, $dir);
return $this->render('jobs/lines.html.twig', [
'list' => $pfoNotifs,
]);
}
}