Convert other PHPDoc annotations to PHP attributes

This commit is contained in:
Timothy Warren 2022-02-17 15:16:47 -05:00
parent dbfe26e27b
commit 372d348b16
10 changed files with 54 additions and 161 deletions

View File

@ -15,25 +15,20 @@ use Symfony\Component\HttpFoundation\Request;
/** /**
* Camera controller. * Camera controller.
*
* @Route("camera")
*/ */
#[Route(path: 'camera')]
class CameraController extends AbstractController class CameraController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = Camera::class; protected const ENTITY = Camera::class;
protected const FORM = CameraType::class; protected const FORM = CameraType::class;
/** /**
* Lists all camera entities. * Lists all camera entities.
*
* @Route("/", name="camera_index", methods={"GET"})
*/ */
public function indexAction(): Response #[Route(path: '/', name: 'camera_index', methods: ['GET'])]
public function indexAction() : Response
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$receivedItems = $em->getRepository(self::ENTITY)->findBy([ $receivedItems = $em->getRepository(self::ENTITY)->findBy([
'received' => true 'received' => true
], [ ], [
@ -49,74 +44,64 @@ class CameraController extends AbstractController
'mount' => 'ASC', 'mount' => 'ASC',
'model' => 'ASC', 'model' => 'ASC',
]); ]);
$working = array_filter($receivedItems, [$this, 'isWorking']); $working = array_filter($receivedItems, [$this, 'isWorking']);
$notWorking = array_filter($receivedItems, [$this, 'isNotWorking']); $notWorking = array_filter($receivedItems, [$this, 'isNotWorking']);
return $this->render('camera/index.html.twig', [ return $this->render('camera/index.html.twig', [
'not_received' => $newItems, 'not_received' => $newItems,
'not_working' => $notWorking, 'not_working' => $notWorking,
'working' => $working, 'working' => $working,
]); ]);
} }
/** /**
* Creates a new camera entity. * Creates a new camera entity.
*
* @Route("/new", name="camera_new", methods={"GET", "POST"})
*/ */
#[Route(path: '/new', name: 'camera_new', methods: ['GET', 'POST'])]
public function newAction(Request $request) public function newAction(Request $request)
{ {
return $this->itemCreate($request, 'camera/new.html.twig', 'camera', 'camera_show'); return $this->itemCreate($request, 'camera/new.html.twig', 'camera', 'camera_show');
} }
/** /**
* Finds and displays a camera entity. * Finds and displays a camera entity.
*
* @Route("/{id}", name="camera_show", methods={"GET"})
*/ */
#[Route(path: '/{id}', name: 'camera_show', methods: ['GET'])]
public function showAction(Camera $camera) public function showAction(Camera $camera)
{ {
return $this->itemView($camera, 'camera/show.html.twig', 'camera'); return $this->itemView($camera, 'camera/show.html.twig', 'camera');
} }
/** /**
* Displays a form to edit an existing camera entity. * Displays a form to edit an existing camera entity.
* *
* @Route("/{id}/edit", name="camera_edit", methods={"GET", "POST"})
* @throws LogicException * @throws LogicException
*/ */
#[Route(path: '/{id}/edit', name: 'camera_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, Camera $camera) public function editAction(Request $request, Camera $camera)
{ {
return $this->itemUpdate($request, $camera, 'camera/edit.html.twig', 'camera', 'camera_show'); return $this->itemUpdate($request, $camera, 'camera/edit.html.twig', 'camera', 'camera_show');
} }
/** /**
* Deletes a camera entity. * Deletes a camera entity.
* *
* @Route("/{id}", name="camera_delete", methods={"DELETE"})
* @throws LogicException * @throws LogicException
*/ */
public function deleteAction(Request $request, Camera $camera): RedirectResponse #[Route(path: '/{id}', name: 'camera_delete', methods: ['DELETE'])]
public function deleteAction(Request $request, Camera $camera) : RedirectResponse
{ {
return $this->itemDelete($request, $camera, 'camera_index'); return $this->itemDelete($request, $camera, 'camera_index');
} }
/** /**
* Moves a camera to the previouslyOwned table * Moves a camera to the previouslyOwned table
* *
* @Route("/{id}/deacquire", name="camera_deacquire", methods={"POST"})
* @param Request $request * @param Request $request
* @param Camera $camera * @param Camera $camera
* @throws LogicException * @throws LogicException
* @throws ORMInvalidArgumentException * @throws ORMInvalidArgumentException
* @return RedirectResponse * @return RedirectResponse
*/ */
public function deacquireAction(Request $request, Camera $camera): RedirectResponse #[Route(path: '/{id}/deacquire', name: 'camera_deacquire', methods: ['POST'])]
public function deacquireAction(Request $request, Camera $camera) : RedirectResponse
{ {
return $this->itemDeacquire($request, $camera, 'previously-owned-camera_index'); return $this->itemDeacquire($request, $camera, 'previously-owned-camera_index');
} }
/** /**
* Creates a form to delete a camera entity. * Creates a form to delete a camera entity.
* *
@ -128,7 +113,6 @@ class CameraController extends AbstractController
{ {
return $this->buildForm($camera, 'camera_delete', 'DELETE'); return $this->buildForm($camera, 'camera_delete', 'DELETE');
} }
/** /**
* Creates a form to move * Creates a form to move
* *
@ -140,12 +124,10 @@ class CameraController extends AbstractController
{ {
return $this->buildForm($camera, 'camera_deacquire'); return $this->buildForm($camera, 'camera_deacquire');
} }
private function isWorking(Camera $camera): bool private function isWorking(Camera $camera): bool
{ {
return $camera->getIsWorking(); return $camera->getIsWorking();
} }
private function isNotWorking(Camera $camera): bool private function isNotWorking(Camera $camera): bool
{ {
return !$this->isWorking($camera); return !$this->isWorking($camera);

View File

@ -11,68 +11,55 @@ use Symfony\Component\HttpFoundation\Request;
/** /**
* Cameratype controller. * Cameratype controller.
*
* @Route("camera-type")
*/ */
#[Route(path: 'camera-type')]
class CameraTypeController extends AbstractController class CameraTypeController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = CameraType::class; protected const ENTITY = CameraType::class;
protected const FORM = CameraTypeType::class; protected const FORM = CameraTypeType::class;
/** /**
* Lists all cameraType entities. * Lists all cameraType entities.
*
* @Route("/", name="camera-type_index", methods={"GET"})
*/ */
#[Route(path: '/', name: 'camera-type_index', methods: ['GET'])]
public function indexAction() public function indexAction()
{ {
return $this->itemListView('cameratype/index.html.twig', 'cameraTypes', [ return $this->itemListView('cameratype/index.html.twig', 'cameraTypes', [
'type' => 'ASC', 'type' => 'ASC',
]); ]);
} }
/** /**
* Creates a new cameraType entity. * Creates a new cameraType entity.
*
* @Route("/new", name="camera-type_new", methods={"GET", "POST"})
*/ */
#[Route(path: '/new', name: 'camera-type_new', methods: ['GET', 'POST'])]
public function newAction(Request $request) public function newAction(Request $request)
{ {
return $this->itemCreate($request, 'cameratype/new.html.twig', 'cameraType', 'camera-type_show'); return $this->itemCreate($request, 'cameratype/new.html.twig', 'cameraType', 'camera-type_show');
} }
/** /**
* Finds and displays a cameraType entity. * Finds and displays a cameraType entity.
*
* @Route("/{id}", name="camera-type_show", methods={"GET"})
*/ */
#[Route(path: '/{id}', name: 'camera-type_show', methods: ['GET'])]
public function showAction(CameraType $cameraType) public function showAction(CameraType $cameraType)
{ {
return $this->itemView($cameraType, 'cameratype/show.html.twig', 'cameraType'); return $this->itemView($cameraType, 'cameratype/show.html.twig', 'cameraType');
} }
/** /**
* Displays a form to edit an existing cameraType entity. * Displays a form to edit an existing cameraType entity.
*
* @Route("/{id}/edit", name="camera-type_edit", methods={"GET", "POST"})
*/ */
#[Route(path: '/{id}/edit', name: 'camera-type_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, CameraType $cameraType) public function editAction(Request $request, CameraType $cameraType)
{ {
return $this->itemUpdate($request, $cameraType, 'cameratype/edit.html.twig', 'cameraType', 'camera-type_show'); return $this->itemUpdate($request, $cameraType, 'cameratype/edit.html.twig', 'cameraType', 'camera-type_show');
} }
/** /**
* Deletes a cameraType entity. * Deletes a cameraType entity.
*
* @Route("/{id}", name="camera-type_delete", methods={"DELETE"})
*/ */
#[Route(path: '/{id}', name: 'camera-type_delete', methods: ['DELETE'])]
public function deleteAction(Request $request, CameraType $cameraType) public function deleteAction(Request $request, CameraType $cameraType)
{ {
return $this->itemDelete($request, $cameraType, 'camera-type_index'); return $this->itemDelete($request, $cameraType, 'camera-type_index');
} }
/** /**
* Creates a form to delete a cameraType entity. * Creates a form to delete a cameraType entity.
* *

View File

@ -9,10 +9,8 @@ use Symfony\Component\HttpFoundation\Request;
class DefaultController extends AbstractController class DefaultController extends AbstractController
{ {
/** #[Route(path: '/', name: 'homepage')]
* @Route("/", name="homepage") public function indexAction(Request $request) : Response
*/
public function indexAction(Request $request): Response
{ {
// replace this example code with whatever you need // replace this example code with whatever you need
return $this->render('default/index.html.twig', [ return $this->render('default/index.html.twig', [

View File

@ -14,26 +14,20 @@ use Symfony\Component\HttpFoundation\Request;
/** /**
* Film controller. * Film controller.
*
* @Route("film")
*/ */
#[Route(path: 'film')]
class FilmController extends AbstractController class FilmController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = Film::class; protected const ENTITY = Film::class;
protected const FORM = FilmType::class; protected const FORM = FilmType::class;
/** /**
* Lists all film entities. * Lists all film entities.
*
* @Route("/", name="film_index", methods={"GET"})
*/ */
public function indexAction(): Response #[Route(path: '/', name: 'film_index', methods: ['GET'])]
public function indexAction() : Response
{ {
$repo = $this->getDoctrine()->getManager()->getRepository(self::ENTITY); $repo = $this->getDoctrine()->getManager()->getRepository(self::ENTITY);
$criteria = Criteria::create() $criteria = Criteria::create()
->where(Criteria::expr()->gt('rollsInCamera', 0)) ->where(Criteria::expr()->gt('rollsInCamera', 0))
->orderBy([ ->orderBy([
@ -42,9 +36,7 @@ class FilmController extends AbstractController
'rollsInCamera' => Criteria::DESC, 'rollsInCamera' => Criteria::DESC,
'productLine' => Criteria::ASC, 'productLine' => Criteria::ASC,
]); ]);
$inCamera = $repo->matching($criteria); $inCamera = $repo->matching($criteria);
$notInCamera = $repo->findBy([ $notInCamera = $repo->findBy([
'rollsInCamera' => 0, 'rollsInCamera' => 0,
], [ ], [
@ -52,55 +44,47 @@ class FilmController extends AbstractController
'productLine' => 'ASC', 'productLine' => 'ASC',
'filmFormat' => 'ASC', 'filmFormat' => 'ASC',
]); ]);
return $this->render('film/index.html.twig', [ return $this->render('film/index.html.twig', [
'in_camera' => $inCamera, 'in_camera' => $inCamera,
'films' => $notInCamera, 'films' => $notInCamera,
]); ]);
} }
/** /**
* Creates a new film entity. * Creates a new film entity.
*
* @Route("/new", name="film_new", methods={"GET", "POST"})
*/ */
#[Route(path: '/new', name: 'film_new', methods: ['GET', 'POST'])]
public function newAction(Request $request) public function newAction(Request $request)
{ {
return $this->itemCreate($request, 'film/new.html.twig', 'film', 'film_show'); return $this->itemCreate($request, 'film/new.html.twig', 'film', 'film_show');
} }
/** /**
* Finds and displays a film entity. * Finds and displays a film entity.
*
* @Route("/{id}", name="film_show", methods={"GET"})
*/ */
#[Route(path: '/{id}', name: 'film_show', methods: ['GET'])]
public function showAction(Film $film) public function showAction(Film $film)
{ {
return $this->itemView($film, 'film/show.html.twig', 'film'); return $this->itemView($film, 'film/show.html.twig', 'film');
} }
/** /**
* Displays a form to edit an existing film entity. * Displays a form to edit an existing film entity.
* *
* @Route("/{id}/edit", name="film_edit", methods={"GET", "POST"})
* @throws LogicException * @throws LogicException
*/ */
#[Route(path: '/{id}/edit', name: 'film_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, Film $film) public function editAction(Request $request, Film $film)
{ {
return $this->itemUpdate($request, $film, 'film/edit.html.twig', 'film', 'film_show'); return $this->itemUpdate($request, $film, 'film/edit.html.twig', 'film', 'film_show');
} }
/** /**
* Deletes a film entity. * Deletes a film entity.
* *
* @Route("/{id}", name="film_delete", methods={"DELETE"})
* @throws LogicException * @throws LogicException
*/ */
#[Route(path: '/{id}', name: 'film_delete', methods: ['DELETE'])]
public function deleteAction(Request $request, Film $film) public function deleteAction(Request $request, Film $film)
{ {
return $this->itemDelete($request, $film, 'film_index'); return $this->itemDelete($request, $film, 'film_index');
} }
/** /**
* Creates a form to delete a film entity. * Creates a form to delete a film entity.
* *

View File

@ -11,66 +11,53 @@ use Symfony\Component\HttpFoundation\Request;
/** /**
* Flash controller. * Flash controller.
*
* @Route("flash")
*/ */
#[Route(path: 'flash')]
class FlashController extends AbstractController class FlashController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = Flash::class; protected const ENTITY = Flash::class;
protected const FORM = FlashType::class; protected const FORM = FlashType::class;
/** /**
* Lists all flash entities. * Lists all flash entities.
*
* @Route("/", name="flash_index", methods={"GET"})
*/ */
#[Route(path: '/', name: 'flash_index', methods: ['GET'])]
public function indexAction() public function indexAction()
{ {
return $this->itemListView('flash/index.html.twig', 'flashes'); return $this->itemListView('flash/index.html.twig', 'flashes');
} }
/** /**
* Creates a new flash entity. * Creates a new flash entity.
*
* @Route("/new", name="flash_new", methods={"GET", "POST"})
*/ */
#[Route(path: '/new', name: 'flash_new', methods: ['GET', 'POST'])]
public function newAction(Request $request) public function newAction(Request $request)
{ {
return $this->itemCreate($request, 'flash/new.html.twig', 'flash', 'flash_show'); return $this->itemCreate($request, 'flash/new.html.twig', 'flash', 'flash_show');
} }
/** /**
* Finds and displays a flash entity. * Finds and displays a flash entity.
*
* @Route("/{id}", name="flash_show", methods={"GET"})
*/ */
#[Route(path: '/{id}', name: 'flash_show', methods: ['GET'])]
public function showAction(Flash $flash) public function showAction(Flash $flash)
{ {
return $this->itemView($flash, 'flash/show.html.twig', 'flash'); return $this->itemView($flash, 'flash/show.html.twig', 'flash');
} }
/** /**
* Displays a form to edit an existing flash entity. * Displays a form to edit an existing flash entity.
*
* @Route("/{id}/edit", name="flash_edit", methods={"GET", "POST"})
*/ */
#[Route(path: '/{id}/edit', name: 'flash_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, Flash $flash) public function editAction(Request $request, Flash $flash)
{ {
return $this->itemUpdate($request, $flash, 'flash/edit.html.twig', 'flash', 'flash_show'); return $this->itemUpdate($request, $flash, 'flash/edit.html.twig', 'flash', 'flash_show');
} }
/** /**
* Deletes a flash entity. * Deletes a flash entity.
*
* @Route("/{id}", name="flash_delete", methods={"DELETE"})
*/ */
#[Route(path: '/{id}', name: 'flash_delete', methods: ['DELETE'])]
public function deleteAction(Request $request, Flash $flash) public function deleteAction(Request $request, Flash $flash)
{ {
return $this->itemDelete($request, $flash, 'flash_index'); return $this->itemDelete($request, $flash, 'flash_index');
} }
/** /**
* Creates a form to delete a flash entity. * Creates a form to delete a flash entity.
* *

View File

@ -11,25 +11,20 @@ use Symfony\Component\HttpFoundation\{Request, RedirectResponse};
/** /**
* Lens controller. * Lens controller.
*
* @Route("lens")
*/ */
#[Route(path: 'lens')]
class LensesController extends AbstractController class LensesController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = Lenses::class; protected const ENTITY = Lenses::class;
protected const FORM = LensesType::class; protected const FORM = LensesType::class;
/** /**
* Lists all lens entities. * Lists all lens entities.
*
* @Route("/", name="lens_index", methods={"GET"})
*/ */
#[Route(path: '/', name: 'lens_index', methods: ['GET'])]
public function indexAction() public function indexAction()
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$receivedItems = $em->getRepository(self::ENTITY)->findBy([ $receivedItems = $em->getRepository(self::ENTITY)->findBy([
'received' => true 'received' => true
], [ ], [
@ -48,66 +43,55 @@ class LensesController extends AbstractController
'minFocalLength' => 'ASC', 'minFocalLength' => 'ASC',
'maxFStop' => 'ASC', 'maxFStop' => 'ASC',
]); ]);
return $this->render('lenses/index.html.twig', [ return $this->render('lenses/index.html.twig', [
'not_received' => $newItems, 'not_received' => $newItems,
'lenses' => $receivedItems, 'lenses' => $receivedItems,
]); ]);
} }
/** /**
* Creates a new lens entity. * Creates a new lens entity.
*
* @Route("/new", name="lens_new", methods={"GET", "POST"})
*/ */
#[Route(path: '/new', name: 'lens_new', methods: ['GET', 'POST'])]
public function newAction(Request $request) public function newAction(Request $request)
{ {
return $this->itemCreate($request, 'lenses/new.html.twig', 'lense', 'lens_show'); return $this->itemCreate($request, 'lenses/new.html.twig', 'lense', 'lens_show');
} }
/** /**
* Finds and displays a lens entity. * Finds and displays a lens entity.
*
* @Route("/{id}", name="lens_show", methods={"GET"})
*/ */
#[Route(path: '/{id}', name: 'lens_show', methods: ['GET'])]
public function showAction(Lenses $lens) public function showAction(Lenses $lens)
{ {
return $this->itemView($lens, 'lenses/show.html.twig', 'lense'); return $this->itemView($lens, 'lenses/show.html.twig', 'lense');
} }
/** /**
* Displays a form to edit an existing lens entity. * Displays a form to edit an existing lens entity.
*
* @Route("/{id}/edit", name="lens_edit", methods={"GET", "POST"})
*/ */
#[Route(path: '/{id}/edit', name: 'lens_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, Lenses $lens) public function editAction(Request $request, Lenses $lens)
{ {
return $this->itemUpdate($request, $lens, 'lenses/edit.html.twig', 'lense', 'lens_show'); return $this->itemUpdate($request, $lens, 'lenses/edit.html.twig', 'lense', 'lens_show');
} }
/** /**
* Moves a camera to the previouslyOwned table * Moves a camera to the previouslyOwned table
* *
* @Route("/{id}/deacquire", name="lens_deacquire", methods={"POST"})
* @param Request $request * @param Request $request
* @param Lenses $lens * @param Lenses $lens
* @return RedirectResponse * @return RedirectResponse
*/ */
#[Route(path: '/{id}/deacquire', name: 'lens_deacquire', methods: ['POST'])]
public function deacquireAction(Request $request, Lenses $lens) public function deacquireAction(Request $request, Lenses $lens)
{ {
return $this->itemDeacquire($request, $lens, 'previously-owned-lens_index'); return $this->itemDeacquire($request, $lens, 'previously-owned-lens_index');
} }
/** /**
* Deletes a lens entity. * Deletes a lens entity.
*
* @Route("/{id}", name="lens_delete", methods={"DELETE"})
*/ */
#[Route(path: '/{id}', name: 'lens_delete', methods: ['DELETE'])]
public function deleteAction(Request $request, Lenses $lens) public function deleteAction(Request $request, Lenses $lens)
{ {
return $this->itemDelete($request, $lens, 'lens_index'); return $this->itemDelete($request, $lens, 'lens_index');
} }
/** /**
* Creates a form to delete a lens entity. * Creates a form to delete a lens entity.
* *
@ -119,8 +103,6 @@ class LensesController extends AbstractController
{ {
return $this->buildForm($lens, 'lens_delete', 'DELETE'); return $this->buildForm($lens, 'lens_delete', 'DELETE');
} }
/** /**
* Creates a form to move * Creates a form to move
* *

View File

@ -14,22 +14,19 @@ use Symfony\Component\HttpFoundation\{RedirectResponse, Request};
/** /**
* Previouslyownedcamera controller. * Previouslyownedcamera controller.
*
* @Route("previously-owned-camera")
*/ */
#[Route(path: 'previously-owned-camera')]
class PreviouslyOwnedCameraController extends AbstractController class PreviouslyOwnedCameraController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = PreviouslyOwnedCamera::class; protected const ENTITY = PreviouslyOwnedCamera::class;
protected const FORM = PreviouslyOwnedCameraType::class; protected const FORM = PreviouslyOwnedCameraType::class;
/** /**
* Lists all previouslyOwnedCamera entities. * Lists all previouslyOwnedCamera entities.
* *
* @Route("/", name="previously-owned-camera_index", methods={"GET"})
* @throws UnexpectedValueException * @throws UnexpectedValueException
*/ */
#[Route(path: '/', name: 'previously-owned-camera_index', methods: ['GET'])]
public function indexAction() public function indexAction()
{ {
return $this->itemListView('previouslyownedcamera/index.html.twig', 'previouslyOwnedCameras', [ return $this->itemListView('previouslyownedcamera/index.html.twig', 'previouslyOwnedCameras', [
@ -38,44 +35,38 @@ class PreviouslyOwnedCameraController extends AbstractController
'model' => 'ASC', 'model' => 'ASC',
]); ]);
} }
/** /**
* Finds and displays a previouslyOwnedCamera entity. * Finds and displays a previouslyOwnedCamera entity.
*
* @Route("/{id}", name="previously-owned-camera_show", methods={"GET"})
*/ */
#[Route(path: '/{id}', name: 'previously-owned-camera_show', methods: ['GET'])]
public function showAction(PreviouslyOwnedCamera $previouslyOwnedCamera) public function showAction(PreviouslyOwnedCamera $previouslyOwnedCamera)
{ {
return $this->itemView($previouslyOwnedCamera, 'previouslyownedcamera/show.html.twig', 'previouslyOwnedCamera'); return $this->itemView($previouslyOwnedCamera, 'previouslyownedcamera/show.html.twig', 'previouslyOwnedCamera');
} }
/** /**
* Displays a form to edit an existing previouslyOwnedCamera entity. * Displays a form to edit an existing previouslyOwnedCamera entity.
* *
* @Route("/{id}/edit", name="previously-owned-camera_edit", methods={"GET", "POST"})
* @throws LogicException * @throws LogicException
*/ */
#[Route(path: '/{id}/edit', name: 'previously-owned-camera_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, PreviouslyOwnedCamera $previouslyOwnedCamera) public function editAction(Request $request, PreviouslyOwnedCamera $previouslyOwnedCamera)
{ {
return $this->itemUpdate($request, $previouslyOwnedCamera, 'previouslyownedcamera/edit.html.twig', 'previouslyOwnedCamera', 'previously-owned-camera_show'); return $this->itemUpdate($request, $previouslyOwnedCamera, 'previouslyownedcamera/edit.html.twig', 'previouslyOwnedCamera', 'previously-owned-camera_show');
} }
/** /**
* Moves a camera to the previouslyOwned table * Moves a camera to the previouslyOwned table
* *
* @Route("/{id}/reacquire", name="previously-owned-camera_reacquire", methods={"POST"})
* @param Request $request * @param Request $request
* @param PreviouslyOwnedCamera $camera * @param PreviouslyOwnedCamera $camera
* @throws LogicException * @throws LogicException
* @throws ORMInvalidArgumentException * @throws ORMInvalidArgumentException
* @return RedirectResponse * @return RedirectResponse
*/ */
public function reacquireAction(Request $request, PreviouslyOwnedCamera $camera): RedirectResponse #[Route(path: '/{id}/reacquire', name: 'previously-owned-camera_reacquire', methods: ['POST'])]
public function reacquireAction(Request $request, PreviouslyOwnedCamera $camera) : RedirectResponse
{ {
return $this->itemReacquire($request, $camera, 'camera_index'); return $this->itemReacquire($request, $camera, 'camera_index');
} }
/** /**
* Creates a form to move * Creates a form to move
* *

View File

@ -10,50 +10,41 @@ use Symfony\Component\HttpFoundation\Request;
/** /**
* Previouslyownedflash controller. * Previouslyownedflash controller.
*
* @Route("previously-owned-flash")
*/ */
#[Route(path: 'previously-owned-flash')]
class PreviouslyOwnedFlashController extends AbstractController class PreviouslyOwnedFlashController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = PreviouslyOwnedFlash::class; protected const ENTITY = PreviouslyOwnedFlash::class;
protected const FORM = PreviouslyOwnedFlashType::class; protected const FORM = PreviouslyOwnedFlashType::class;
/** /**
* Lists all previouslyOwnedFlash entities. * Lists all previouslyOwnedFlash entities.
*
* @Route("/", name="previously-owned-flash_index", methods={"GET"})
*/ */
#[Route(path: '/', name: 'previously-owned-flash_index', methods: ['GET'])]
public function indexAction() public function indexAction()
{ {
return $this->itemListView('previouslyownedflash/index.html.twig', 'previouslyOwnedFlashes'); return $this->itemListView('previouslyownedflash/index.html.twig', 'previouslyOwnedFlashes');
} }
/** /**
* Creates a new previouslyOwnedFlash entity. * Creates a new previouslyOwnedFlash entity.
*
* @Route("/new", name="previously-owned-flash_new", methods={"GET", "POST"})
*/ */
#[Route(path: '/new', name: 'previously-owned-flash_new', methods: ['GET', 'POST'])]
public function newAction(Request $request) public function newAction(Request $request)
{ {
return $this->itemCreate($request, 'previouslyownedflash/new.html.twig', 'previouslyOwnedFlash', 'previously-owned-flash_show'); return $this->itemCreate($request, 'previouslyownedflash/new.html.twig', 'previouslyOwnedFlash', 'previously-owned-flash_show');
} }
/** /**
* Finds and displays a previouslyOwnedFlash entity. * Finds and displays a previouslyOwnedFlash entity.
*
* @Route("/{id}", name="previously-owned-flash_show", methods={"GET"})
*/ */
#[Route(path: '/{id}', name: 'previously-owned-flash_show', methods: ['GET'])]
public function showAction(PreviouslyOwnedFlash $previouslyOwnedFlash) public function showAction(PreviouslyOwnedFlash $previouslyOwnedFlash)
{ {
return $this->itemView($previouslyOwnedFlash, 'previouslyownedcamera/show.html.twig', 'previouslyOwnedFlash'); return $this->itemView($previouslyOwnedFlash, 'previouslyownedcamera/show.html.twig', 'previouslyOwnedFlash');
} }
/** /**
* Displays a form to edit an existing previouslyOwnedFlash entity. * Displays a form to edit an existing previouslyOwnedFlash entity.
*
* @Route("/{id}/edit", name="previously-owned-flash_edit", methods={"GET", "POST"})
*/ */
#[Route(path: '/{id}/edit', name: 'previously-owned-flash_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, PreviouslyOwnedFlash $previouslyOwnedFlash) public function editAction(Request $request, PreviouslyOwnedFlash $previouslyOwnedFlash)
{ {
return $this->itemUpdate($request, $previouslyOwnedFlash, 'previouslyownedflash/edit.html.twig', 'previouslyOwnedFlash', 'previously-owned-flash_show'); return $this->itemUpdate($request, $previouslyOwnedFlash, 'previouslyownedflash/edit.html.twig', 'previouslyOwnedFlash', 'previously-owned-flash_show');

View File

@ -8,21 +8,16 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
/** #[Route(path: 'previously-owned-lens')]
* @Route("previously-owned-lens")
*/
class PreviouslyOwnedLensesController extends AbstractController class PreviouslyOwnedLensesController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = PreviouslyOwnedLenses::class; protected const ENTITY = PreviouslyOwnedLenses::class;
protected const FORM = PreviouslyOwnedLensesType::class; protected const FORM = PreviouslyOwnedLensesType::class;
/** /**
* Lists all previouslyOwnedLense entities. * Lists all previouslyOwnedLense entities.
*
* @Route("/", name="previously-owned-lens_index", methods={"GET"})
*/ */
#[Route(path: '/', name: 'previously-owned-lens_index', methods: ['GET'])]
public function indexAction() public function indexAction()
{ {
return $this->itemListView('previouslyownedlenses/index.html.twig', 'previouslyOwnedLenses', [ return $this->itemListView('previouslyownedlenses/index.html.twig', 'previouslyOwnedLenses', [
@ -33,22 +28,18 @@ class PreviouslyOwnedLensesController extends AbstractController
'maxFStop' => 'ASC', 'maxFStop' => 'ASC',
]); ]);
} }
/** /**
* Finds and displays a previouslyOwnedLense entity. * Finds and displays a previouslyOwnedLense entity.
*
* @Route("/{id}", name="previously-owned-lens_show", methods={"GET"})
*/ */
#[Route(path: '/{id}', name: 'previously-owned-lens_show', methods: ['GET'])]
public function showAction(PreviouslyOwnedLenses $previouslyOwnedLens) public function showAction(PreviouslyOwnedLenses $previouslyOwnedLens)
{ {
return $this->itemView($previouslyOwnedLens, 'previouslyownedlenses/show.html.twig', 'previouslyOwnedLense'); return $this->itemView($previouslyOwnedLens, 'previouslyownedlenses/show.html.twig', 'previouslyOwnedLense');
} }
/** /**
* Displays a form to edit an existing previouslyOwnedLense entity. * Displays a form to edit an existing previouslyOwnedLense entity.
*
* @Route("/{id}/edit", name="previously-owned-lens_edit", methods={"GET", "POST"})
*/ */
#[Route(path: '/{id}/edit', name: 'previously-owned-lens_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, PreviouslyOwnedLenses $previouslyOwnedLens) public function editAction(Request $request, PreviouslyOwnedLenses $previouslyOwnedLens)
{ {
return $this->itemUpdate($request, $previouslyOwnedLens, 'previouslyownedlenses/edit.html.twig', 'previouslyOwnedLense', 'previously-owned-lens_show'); return $this->itemUpdate($request, $previouslyOwnedLens, 'previouslyownedlenses/edit.html.twig', 'previouslyOwnedLense', 'previously-owned-lens_show');

View File

@ -8,7 +8,7 @@ use Doctrine\ORM\Mapping as ORM;
* Camera * Camera
*/ */
#[ORM\Table(name: 'camera', schema: 'camera')] #[ORM\Table(name: 'camera', schema: 'camera')]
#[ORM\Index(name: 'IDX_747C826FC54C8C93', columns: ['type_id'])] #[ORM\Index(columns: ['type_id'], name: 'IDX_747C826FC54C8C93')]
#[ORM\Entity(repositoryClass: 'App\Repository\CameraRepository')] #[ORM\Entity(repositoryClass: 'App\Repository\CameraRepository')]
class Camera class Camera
{ {