collection-crud/src/Controller/PreviouslyOwnedLensesContro...

60 lines
2.0 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\PreviouslyOwnedLenses;
2018-07-16 13:50:07 -04:00
use App\Form\PreviouslyOwnedLensesType;
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};
2022-03-03 10:53:48 -05:00
use Symfony\Component\Routing\Annotation\Route;
2017-11-30 15:06:13 -05:00
#[Route(path: 'previously-owned-lens')]
class PreviouslyOwnedLensesController extends AbstractController
2017-11-30 15:06:13 -05:00
{
2022-03-03 10:53:48 -05:00
use FormControllerTrait;
protected const ENTITY = PreviouslyOwnedLenses::class;
2022-09-29 18:35:53 -04:00
protected const TEMPLATE_PATH = 'previouslyownedlenses/';
protected const ROUTE_PREFIX = 'previously-owned-lens_';
2022-03-03 10:53:48 -05:00
protected const FORM = PreviouslyOwnedLensesType::class;
2022-09-29 18:35:53 -04:00
public function __construct(private readonly EntityManagerInterface $entityManager)
2022-03-03 10:53:48 -05:00
{
}
/**
* Lists all previouslyOwnedLense entities.
*/
#[Route(path: '/', name: 'previously-owned-lens_index', methods: ['GET'])]
public function indexAction(): Response
{
2022-09-30 10:48:14 -04:00
return $this->itemListView('previouslyOwnedLenses', [
2022-03-03 10:53:48 -05:00
'brand' => 'ASC',
'productLine' => 'ASC',
'mount' => 'ASC',
'minFocalLength' => 'ASC',
'maxFStop' => 'ASC',
]);
}
/**
* Finds and displays a previouslyOwnedLense entity.
*/
#[Route(path: '/{id}', name: 'previously-owned-lens_show', methods: ['GET'])]
public function showAction(PreviouslyOwnedLenses $previouslyOwnedLens): Response
{
2022-09-30 10:48:14 -04:00
return $this->itemView($previouslyOwnedLens, 'previouslyOwnedLense');
2022-03-03 10:53:48 -05:00
}
/**
* Displays a form to edit an existing previouslyOwnedLense entity.
*/
#[Route(path: '/{id}/edit', name: 'previously-owned-lens_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, PreviouslyOwnedLenses $previouslyOwnedLens): RedirectResponse|Response
{
2022-09-30 10:48:14 -04:00
return $this->itemUpdate($request, $previouslyOwnedLens, 'previouslyOwnedLense');
2022-03-03 10:53:48 -05:00
}
2017-11-30 15:06:13 -05:00
}