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 App\Traits\FormControllerTrait;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
use Symfony\Component\Routing\Annotation\Route;
/**
* Previouslyownedflash controller.
*/
#[Route(path: 'previously-owned-flash')]
class PreviouslyOwnedFlashController extends AbstractController
{
use FormControllerTrait;
protected const ENTITY = PreviouslyOwnedFlash::class;
protected const ROUTE_PREFIX = 'previously-owned-flash_';
protected const TEMPLATE_PATH = 'previouslyownedflash/';
protected const FORM = PreviouslyOwnedFlashType::class;
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
/**
* Lists all previouslyOwnedFlash entities.
*/
#[Route(path: '/', name: 'previously-owned-flash_index', methods: ['GET'])]
public function indexAction(): Response
{
return $this->itemListView( 'previouslyOwnedFlashes');
}
/**
* Creates a new previouslyOwnedFlash entity.
*/
#[Route(path: '/new', name: 'previously-owned-flash_new', methods: ['GET', 'POST'])]
public function newAction(Request $request): RedirectResponse|Response
{
return $this->itemCreate($request, 'previouslyOwnedFlash');
}
/**
* 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, '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');
}
}