collection-crud/src/Controller/PreviouslyOwnedLensesController.php

57 lines
1.6 KiB
PHP

<?php declare(strict_types=1);
namespace App\Controller;
use App\Entity\PreviouslyOwnedLenses;
use App\Form\PreviouslyOwnedLensesType;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;
/**
* @Route("previously-owned-lens")
*/
class PreviouslyOwnedLensesController extends Controller
{
use FormControllerTrait;
protected const ENTITY = PreviouslyOwnedLenses::class;
protected const FORM = PreviouslyOwnedLensesType::class;
/**
* Lists all previouslyOwnedLense entities.
*
* @Route("/", 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("/{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("/{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');
}
}