collection-crud/src/Controller/PreviouslyOwnedLensesController.php

52 lines
1.7 KiB
PHP

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