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

66 lines
2.2 KiB
PHP
Raw Normal View History

2018-07-18 11:35:27 -04:00
<?php declare(strict_types=1);
2017-11-30 15:06:13 -05:00
namespace App\Controller;
2017-11-30 15:06:13 -05:00
use App\Entity\PreviouslyOwnedFlash;
use App\Form\PreviouslyOwnedFlashType;
2022-09-30 10:48:14 -04:00
use App\Traits\FormControllerTrait;
2022-09-29 18:35:53 -04:00
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
2022-03-03 11:15:12 -05:00
use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
2018-07-11 09:18:46 -04:00
use Symfony\Component\Routing\Annotation\Route;
2017-11-30 15:06:13 -05:00
/**
* Previouslyownedflash controller.
*/
#[Route(path: 'previously-owned-flash')]
class PreviouslyOwnedFlashController extends AbstractController
2017-11-30 15:06:13 -05:00
{
2022-03-03 10:53:48 -05:00
use FormControllerTrait;
2022-02-18 11:34:25 -05:00
2022-03-03 10:53:48 -05:00
protected const ENTITY = PreviouslyOwnedFlash::class;
2022-09-29 18:35:53 -04:00
protected const ROUTE_PREFIX = 'previously-owned-flash_';
protected const TEMPLATE_PATH = 'previouslyownedflash/';
2022-03-03 10:53:48 -05:00
protected const FORM = PreviouslyOwnedFlashType::class;
2022-02-18 11:34:25 -05:00
2022-09-29 18:35:53 -04:00
public function __construct(private readonly EntityManagerInterface $entityManager)
2022-03-03 10:53:48 -05:00
{
}
2022-02-18 11:34:25 -05:00
2022-03-03 10:53:48 -05:00
/**
* Lists all previouslyOwnedFlash entities.
*/
#[Route(path: '/', name: 'previously-owned-flash_index', methods: ['GET'])]
public function indexAction(): Response
{
2022-09-30 10:48:14 -04:00
return $this->itemListView( 'previouslyOwnedFlashes');
2022-03-03 10:53:48 -05:00
}
2022-02-18 11:34:25 -05:00
2022-03-03 10:53:48 -05:00
/**
* Creates a new previouslyOwnedFlash entity.
*/
#[Route(path: '/new', name: 'previously-owned-flash_new', methods: ['GET', 'POST'])]
public function newAction(Request $request): RedirectResponse|Response
{
2022-09-30 10:48:14 -04:00
return $this->itemCreate($request, 'previouslyOwnedFlash');
2022-03-03 10:53:48 -05:00
}
2022-02-18 11:34:25 -05:00
2022-03-03 10:53:48 -05:00
/**
* Finds and displays a previouslyOwnedFlash entity.
*/
#[Route(path: '/{id}', name: 'previously-owned-flash_show', methods: ['GET'])]
public function showAction(PreviouslyOwnedFlash $previouslyOwnedFlash): Response
{
2022-09-30 10:48:14 -04:00
return $this->itemView($previouslyOwnedFlash, 'previouslyOwnedFlash');
2022-03-03 10:53:48 -05:00
}
2022-02-18 11:34:25 -05:00
2022-03-03 10:53:48 -05:00
/**
* 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
{
2022-09-30 10:48:14 -04:00
return $this->itemUpdate($request, $previouslyOwnedFlash, 'previouslyOwnedFlash');
2022-03-03 10:53:48 -05:00
}
2017-11-30 15:06:13 -05:00
}