2017-11-30 15:06:13 -05:00
|
|
|
<?php
|
|
|
|
|
2018-02-14 16:42:39 -05:00
|
|
|
namespace App\Controller;
|
2017-11-30 15:06:13 -05:00
|
|
|
|
2018-02-14 16:42:39 -05:00
|
|
|
use App\Entity\PreviouslyOwnedLenses;
|
2017-11-30 15:06:13 -05:00
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
2018-07-11 09:18:46 -04:00
|
|
|
use Symfony\Component\Routing\Annotation\Route;
|
2017-11-30 15:06:13 -05:00
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Previouslyownedlense controller.
|
|
|
|
*
|
|
|
|
* @Route("previously-owned-lens")
|
|
|
|
*/
|
|
|
|
class PreviouslyOwnedLensesController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Lists all previouslyOwnedLense entities.
|
|
|
|
*
|
2018-07-11 09:18:46 -04:00
|
|
|
* @Route("/", name="previously-owned-lens_index", methods={"GET"})
|
2017-11-30 15:06:13 -05:00
|
|
|
*/
|
|
|
|
public function indexAction()
|
|
|
|
{
|
|
|
|
$em = $this->getDoctrine()->getManager();
|
|
|
|
|
2018-07-16 13:10:00 -04:00
|
|
|
$previouslyOwnedLenses = $em->getRepository(PreviouslyOwnedLenses::class)->findBy([], [
|
2017-11-30 15:06:13 -05:00
|
|
|
'brand' => 'ASC',
|
|
|
|
'productLine' => 'ASC',
|
|
|
|
'mount' => 'ASC',
|
|
|
|
'minFocalLength' => 'ASC',
|
|
|
|
'maxFStop' => 'ASC',
|
|
|
|
]);
|
|
|
|
|
|
|
|
return $this->render('previouslyownedlenses/index.html.twig', array(
|
|
|
|
'previouslyOwnedLenses' => $previouslyOwnedLenses,
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Finds and displays a previouslyOwnedLense entity.
|
|
|
|
*
|
2018-07-11 09:18:46 -04:00
|
|
|
* @Route("/{id}", name="previously-owned-lens_show", methods={"GET"})
|
2017-11-30 15:06:13 -05:00
|
|
|
*/
|
|
|
|
public function showAction(PreviouslyOwnedLenses $previouslyOwnedLense)
|
|
|
|
{
|
|
|
|
return $this->render('previouslyownedlenses/show.html.twig', array(
|
|
|
|
'previouslyOwnedLense' => $previouslyOwnedLense,
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Displays a form to edit an existing previouslyOwnedLense entity.
|
|
|
|
*
|
2018-07-11 09:18:46 -04:00
|
|
|
* @Route("/{id}/edit", name="previously-owned-lens_edit", methods={"GET", "POST"})
|
2017-11-30 15:06:13 -05:00
|
|
|
*/
|
|
|
|
public function editAction(Request $request, PreviouslyOwnedLenses $previouslyOwnedLense)
|
|
|
|
{
|
2018-02-14 16:42:39 -05:00
|
|
|
$editForm = $this->createForm('App\Form\PreviouslyOwnedLensesType', $previouslyOwnedLense);
|
2017-11-30 15:06:13 -05:00
|
|
|
$editForm->handleRequest($request);
|
|
|
|
|
|
|
|
if ($editForm->isSubmitted() && $editForm->isValid()) {
|
|
|
|
$this->getDoctrine()->getManager()->flush();
|
|
|
|
|
|
|
|
return $this->redirectToRoute('previously-owned-lens_edit', array('id' => $previouslyOwnedLense->getId()));
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->render('previouslyownedlenses/edit.html.twig', array(
|
|
|
|
'previouslyOwnedLense' => $previouslyOwnedLense,
|
|
|
|
'edit_form' => $editForm->createView(),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|