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-02-18 11:34:25 -05:00
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
2022-02-18 11:34:25 -05:00
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
2018-07-11 09:18:46 -04:00
use Symfony\Component\Routing\Annotation\Route;
2017-11-30 15:06:13 -05:00
use Symfony\Component\HttpFoundation\Request;
/**
* Previouslyownedflash controller.
*/
#[Route(path: 'previously-owned-flash')]
class PreviouslyOwnedFlashController extends AbstractController
2017-11-30 15:06:13 -05:00
{
2018-07-16 13:50:07 -04:00
use FormControllerTrait;
2022-02-18 11:34:25 -05:00
2018-07-16 13:50:07 -04:00
protected const ENTITY = PreviouslyOwnedFlash::class;
2022-02-18 11:34:25 -05:00
2018-07-16 13:50:07 -04:00
protected const FORM = PreviouslyOwnedFlashType::class;
2022-02-18 11:34:25 -05:00
public function __construct(private readonly ManagerRegistry $managerRegistry)
{
}
2017-11-30 15:06:13 -05:00
/**
* Lists all previouslyOwnedFlash entities.
*/
#[Route(path: '/', name: 'previously-owned-flash_index', methods: ['GET'])]
2022-02-18 11:34:25 -05:00
public function indexAction(): Response
2017-11-30 15:06:13 -05:00
{
2018-07-16 13:50:07 -04:00
return $this->itemListView('previouslyownedflash/index.html.twig', 'previouslyOwnedFlashes');
2017-11-30 15:06:13 -05:00
}
2022-02-18 11:34:25 -05:00
2017-11-30 15:06:13 -05:00
/**
* Creates a new previouslyOwnedFlash entity.
*/
#[Route(path: '/new', name: 'previously-owned-flash_new', methods: ['GET', 'POST'])]
2017-11-30 15:06:13 -05:00
public function newAction(Request $request)
{
2018-07-16 13:50:07 -04:00
return $this->itemCreate($request, 'previouslyownedflash/new.html.twig', 'previouslyOwnedFlash', 'previously-owned-flash_show');
2017-11-30 15:06:13 -05:00
}
2022-02-18 11:34:25 -05:00
2017-11-30 15:06:13 -05:00
/**
* Finds and displays a previouslyOwnedFlash entity.
*/
#[Route(path: '/{id}', name: 'previously-owned-flash_show', methods: ['GET'])]
2022-02-18 11:34:25 -05:00
public function showAction(PreviouslyOwnedFlash $previouslyOwnedFlash): Response
2017-11-30 15:06:13 -05:00
{
2018-07-16 13:50:07 -04:00
return $this->itemView($previouslyOwnedFlash, 'previouslyownedcamera/show.html.twig', 'previouslyOwnedFlash');
2017-11-30 15:06:13 -05:00
}
2022-02-18 11:34:25 -05:00
2017-11-30 15:06:13 -05:00
/**
* Displays a form to edit an existing previouslyOwnedFlash entity.
*/
#[Route(path: '/{id}/edit', name: 'previously-owned-flash_edit', methods: ['GET', 'POST'])]
2022-02-18 11:34:25 -05:00
public function editAction(Request $request, PreviouslyOwnedFlash $previouslyOwnedFlash): RedirectResponse|Response
2017-11-30 15:06:13 -05:00
{
2018-07-16 13:50:07 -04:00
return $this->itemUpdate($request, $previouslyOwnedFlash, 'previouslyownedflash/edit.html.twig', 'previouslyOwnedFlash', 'previously-owned-flash_show');
2017-11-30 15:06:13 -05:00
}
}