57 lines
2.0 KiB
PHP
57 lines
2.0 KiB
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace App\Controller;
|
|
|
|
use App\Entity\PreviouslyOwnedLenses;
|
|
use App\Form\PreviouslyOwnedLensesType;
|
|
use Doctrine\Persistence\ManagerRegistry;
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
|
|
use Symfony\Component\Routing\Annotation\Route;
|
|
|
|
#[Route(path: 'previously-owned-lens')]
|
|
class PreviouslyOwnedLensesController extends AbstractController
|
|
{
|
|
use FormControllerTrait;
|
|
|
|
protected const ENTITY = PreviouslyOwnedLenses::class;
|
|
protected const FORM = PreviouslyOwnedLensesType::class;
|
|
|
|
public function __construct(private readonly ManagerRegistry $managerRegistry)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Lists all previouslyOwnedLense entities.
|
|
*/
|
|
#[Route(path: '/', name: 'previously-owned-lens_index', methods: ['GET'])]
|
|
public function indexAction(): Response
|
|
{
|
|
return $this->itemListView('previouslyownedlenses/index.html.twig', 'previouslyOwnedLenses', [
|
|
'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
|
|
{
|
|
return $this->itemView($previouslyOwnedLens, 'previouslyownedlenses/show.html.twig', 'previouslyOwnedLense');
|
|
}
|
|
|
|
/**
|
|
* 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
|
|
{
|
|
return $this->itemUpdate($request, $previouslyOwnedLens, 'previouslyownedlenses/edit.html.twig', 'previouslyOwnedLense', 'previously-owned-lens_show');
|
|
}
|
|
}
|