collection-crud/src/Controller/PreviouslyOwnedFlashControl...

66 lines
2.2 KiB
PHP

<?php declare(strict_types=1);
namespace App\Controller;
use App\Entity\PreviouslyOwnedFlash;
use App\Form\PreviouslyOwnedFlashType;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;
/**
* Previouslyownedflash controller.
*/
#[Route(path: 'previously-owned-flash')]
class PreviouslyOwnedFlashController extends AbstractController
{
use FormControllerTrait;
protected const ENTITY = PreviouslyOwnedFlash::class;
protected const FORM = PreviouslyOwnedFlashType::class;
public function __construct(private readonly ManagerRegistry $managerRegistry)
{
}
/**
* Lists all previouslyOwnedFlash entities.
*/
#[Route(path: '/', name: 'previously-owned-flash_index', methods: ['GET'])]
public function indexAction(): Response
{
return $this->itemListView('previouslyownedflash/index.html.twig', 'previouslyOwnedFlashes');
}
/**
* Creates a new previouslyOwnedFlash entity.
*/
#[Route(path: '/new', name: 'previously-owned-flash_new', methods: ['GET', 'POST'])]
public function newAction(Request $request)
{
return $this->itemCreate($request, 'previouslyownedflash/new.html.twig', 'previouslyOwnedFlash', 'previously-owned-flash_show');
}
/**
* Finds and displays a previouslyOwnedFlash entity.
*/
#[Route(path: '/{id}', name: 'previously-owned-flash_show', methods: ['GET'])]
public function showAction(PreviouslyOwnedFlash $previouslyOwnedFlash): Response
{
return $this->itemView($previouslyOwnedFlash, 'previouslyownedcamera/show.html.twig', 'previouslyOwnedFlash');
}
/**
* Displays a form to edit an existing previouslyOwnedFlash entity.
*/
#[Route(path: '/{id}/edit', name: 'previously-owned-flash_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, PreviouslyOwnedFlash $previouslyOwnedFlash): RedirectResponse|Response
{
return $this->itemUpdate($request, $previouslyOwnedFlash, 'previouslyownedflash/edit.html.twig', 'previouslyOwnedFlash', 'previously-owned-flash_show');
}
}