Create snippets skeleton
This commit is contained in:
29
src/Controller/SnipController.php
Normal file
29
src/Controller/SnipController.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Snip;
|
||||
use App\Repository\SnipRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[Route('/snip', name: 'snip')]
|
||||
class SnipController extends AbstractController
|
||||
{
|
||||
#[Route('/', name: '_index')]
|
||||
public function index(SnipRepository $repository): Response
|
||||
{
|
||||
return $this->render('snip/index.html.twig', [
|
||||
'snips' => $repository->findAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/singe/{snip}', name: '_single')]
|
||||
public function single(Snip $snip): Response
|
||||
{
|
||||
return $this->render('snip/single.html.twig', [
|
||||
'snip' => $snip,
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user