60 lines
2.0 KiB
PHP
60 lines
2.0 KiB
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace App\Controller;
|
|
|
|
use App\Entity\PreviouslyOwnedLenses;
|
|
use App\Form\PreviouslyOwnedLensesType;
|
|
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;
|
|
|
|
#[Route(path: 'previously-owned-lens')]
|
|
class PreviouslyOwnedLensesController extends AbstractController
|
|
{
|
|
use FormControllerTrait;
|
|
|
|
protected const ENTITY = PreviouslyOwnedLenses::class;
|
|
protected const TEMPLATE_PATH = 'previouslyownedlenses/';
|
|
protected const ROUTE_PREFIX = 'previously-owned-lens_';
|
|
protected const FORM = PreviouslyOwnedLensesType::class;
|
|
|
|
public function __construct(private readonly EntityManagerInterface $entityManager)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Lists all previouslyOwnedLense entities.
|
|
*/
|
|
#[Route(path: '/', name: 'previously-owned-lens_index', methods: ['GET'])]
|
|
public function indexAction(): Response
|
|
{
|
|
return $this->itemListView('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, '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, 'previouslyOwnedLense');
|
|
}
|
|
}
|