Compare commits

...

4 Commits

28 changed files with 354 additions and 892 deletions

View File

@ -24,7 +24,7 @@ doctrine:
mappings: mappings:
App: App:
is_bundle: false is_bundle: false
type: annotation type: attribute
dir: '%kernel.project_dir%/src/Entity' dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity' prefix: 'App\Entity'
alias: App alias: App

View File

@ -2,6 +2,8 @@
namespace App\Controller; namespace App\Controller;
use Doctrine\Persistence\ManagerRegistry;
use LogicException;
use App\Entity\Camera; use App\Entity\Camera;
use App\Form\CameraType; use App\Form\CameraType;
use Doctrine\ORM\ORMInvalidArgumentException; use Doctrine\ORM\ORMInvalidArgumentException;
@ -14,25 +16,26 @@ 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;
public function __construct(private readonly ManagerRegistry $managerRegistry)
{
}
/** /**
* 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->managerRegistry->getManager();
$receivedItems = $em->getRepository(self::ENTITY)->findBy([ $receivedItems = $em->getRepository(self::ENTITY)->findBy([
'received' => true 'received' => true
], [ ], [
@ -48,10 +51,8 @@ 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,
@ -61,9 +62,8 @@ class CameraController extends AbstractController
/** /**
* 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');
@ -71,9 +71,8 @@ class CameraController extends AbstractController
/** /**
* 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');
@ -82,9 +81,9 @@ class CameraController extends AbstractController
/** /**
* 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');
@ -93,10 +92,10 @@ class CameraController extends AbstractController
/** /**
* 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');
} }
@ -104,14 +103,11 @@ class CameraController extends AbstractController
/** /**
* Moves a camera to the previouslyOwned table * Moves a camera to the previouslyOwned table
* *
* @Route("/{id}/deacquire", name="camera_deacquire", methods={"POST"}) * @throws LogicException
* @param Request $request
* @param Camera $camera
* @throws \LogicException
* @throws ORMInvalidArgumentException * @throws ORMInvalidArgumentException
* @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');
} }
@ -132,8 +128,6 @@ class CameraController extends AbstractController
* Creates a form to move * Creates a form to move
* *
* @param Camera $camera The camera entity * @param Camera $camera The camera entity
*
* @return FormInterface
*/ */
private function createDeacquireForm(Camera $camera): FormInterface private function createDeacquireForm(Camera $camera): FormInterface
{ {

View File

@ -4,28 +4,32 @@ namespace App\Controller;
use App\Entity\CameraType; use App\Entity\CameraType;
use App\Form\CameraTypeType; use App\Form\CameraTypeType;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
/** #[Route(path: 'camera-type')]
* Cameratype controller.
*
* @Route("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;
public function __construct(private readonly ManagerRegistry $managerRegistry)
{
}
/** /**
* Lists all cameraType entities. * Lists all cameraType entities.
*
* @Route("/", name="camera-type_index", methods={"GET"})
*/ */
public function indexAction() #[Route(path: '/', name: 'camera-type_index', methods: ['GET'])]
public function indexAction(): Response
{ {
return $this->itemListView('cameratype/index.html.twig', 'cameraTypes', [ return $this->itemListView('cameratype/index.html.twig', 'cameraTypes', [
'type' => 'ASC', 'type' => 'ASC',
@ -34,52 +38,44 @@ class CameraTypeController extends AbstractController
/** /**
* Creates a new cameraType entity. * Creates a new cameraType entity.
*
* @Route("/new", name="camera-type_new", methods={"GET", "POST"})
*/ */
public function newAction(Request $request) #[Route(path: '/new', name: 'camera-type_new', methods: ['GET', 'POST'])]
public function newAction(Request $request): Response
{ {
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"})
*/ */
public function showAction(CameraType $cameraType) #[Route(path: '/{id}', name: 'camera-type_show', methods: ['GET'])]
public function showAction(CameraType $cameraType): Response
{ {
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"})
*/ */
public function editAction(Request $request, CameraType $cameraType) #[Route(path: '/{id}/edit', name: 'camera-type_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, CameraType $cameraType): RedirectResponse|Response
{ {
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"})
*/ */
public function deleteAction(Request $request, CameraType $cameraType) #[Route(path: '/{id}', name: 'camera-type_delete', methods: ['DELETE'])]
public function deleteAction(Request $request, CameraType $cameraType): RedirectResponse
{ {
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.
*
* @param CameraType $cameraType The cameraType entity
*
* @return \Symfony\Component\Form\Form The form
*/ */
private function createDeleteForm(CameraType $cameraType) private function createDeleteForm(CameraType $cameraType): FormInterface
{ {
return $this->buildForm($cameraType, 'camera-type_delete', 'DELETE'); return $this->buildForm($cameraType, 'camera-type_delete', 'DELETE');
} }

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

@ -2,6 +2,8 @@
namespace App\Controller; namespace App\Controller;
use Doctrine\Persistence\ManagerRegistry;
use LogicException;
use App\Entity\Film; use App\Entity\Film;
use App\Form\FilmType; use App\Form\FilmType;
use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\Criteria;
@ -13,26 +15,26 @@ 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;
public function __construct(private readonly ManagerRegistry $managerRegistry)
{
}
/** /**
* 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->managerRegistry->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([
@ -41,9 +43,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,
], [ ], [
@ -51,7 +51,6 @@ 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,
@ -60,9 +59,8 @@ class FilmController extends AbstractController
/** /**
* 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');
@ -70,9 +68,8 @@ class FilmController extends AbstractController
/** /**
* 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');
@ -81,9 +78,9 @@ class FilmController extends AbstractController
/** /**
* 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');
@ -92,9 +89,9 @@ class FilmController extends AbstractController
/** /**
* 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');

View File

@ -2,82 +2,81 @@
namespace App\Controller; namespace App\Controller;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Form\FormInterface;
use App\Entity\Flash; use App\Entity\Flash;
use App\Form\FlashType; use App\Form\FlashType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request; 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;
public function __construct(private readonly ManagerRegistry $managerRegistry)
{
}
/** /**
* Lists all flash entities. * Lists all flash entities.
*
* @Route("/", name="flash_index", methods={"GET"})
*/ */
public function indexAction() #[Route(path: '/', name: 'flash_index', methods: ['GET'])]
public function indexAction(): Response
{ {
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"})
*/ */
public function newAction(Request $request) #[Route(path: '/new', name: 'flash_new', methods: ['GET', 'POST'])]
public function newAction(Request $request): RedirectResponse|Response
{ {
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"})
*/ */
public function showAction(Flash $flash) #[Route(path: '/{id}', name: 'flash_show', methods: ['GET'])]
public function showAction(Flash $flash): Response
{ {
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"})
*/ */
public function editAction(Request $request, Flash $flash) #[Route(path: '/{id}/edit', name: 'flash_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, Flash $flash): RedirectResponse|Response
{ {
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"})
*/ */
public function deleteAction(Request $request, Flash $flash) #[Route(path: '/{id}', name: 'flash_delete', methods: ['DELETE'])]
public function deleteAction(Request $request, Flash $flash): RedirectResponse
{ {
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.
*
* @param Flash $flash The flash entity
*
* @return \Symfony\Component\Form\FormInterface The form
*/ */
private function createDeleteForm(Flash $flash) private function createDeleteForm(Flash $flash): FormInterface
{ {
return $this->buildForm($flash, 'flash_delete', 'DELETE'); return $this->buildForm($flash, 'flash_delete', 'DELETE');
} }

View File

@ -2,10 +2,13 @@
namespace App\Controller; namespace App\Controller;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\{Request, Response, RedirectResponse}; use Symfony\Component\HttpFoundation\{Request, Response, RedirectResponse};
trait FormControllerTrait { trait FormControllerTrait {
private readonly ManagerRegistry $managerRegistry;
/** /**
* Create a form generator * Create a form generator
*/ */
@ -49,7 +52,7 @@ trait FormControllerTrait {
*/ */
protected function itemListView(string $template, string $templateKey, array $sort = []): Response protected function itemListView(string $template, string $templateKey, array $sort = []): Response
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->managerRegistry->getManager();
$items = $em->getRepository(self::ENTITY)->findBy([], $sort); $items = $em->getRepository(self::ENTITY)->findBy([], $sort);

View File

@ -2,6 +2,7 @@
namespace App\Controller; namespace App\Controller;
use Doctrine\Persistence\ManagerRegistry;
use App\Entity\Lenses; use App\Entity\Lenses;
use App\Form\LensesType; use App\Form\LensesType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -11,25 +12,26 @@ 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;
public function __construct(private readonly ManagerRegistry $managerRegistry)
{
}
/** /**
* 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->managerRegistry->getManager();
$receivedItems = $em->getRepository(self::ENTITY)->findBy([ $receivedItems = $em->getRepository(self::ENTITY)->findBy([
'received' => true 'received' => true
], [ ], [
@ -48,7 +50,6 @@ 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,
@ -57,9 +58,8 @@ class LensesController extends AbstractController
/** /**
* 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');
@ -67,9 +67,8 @@ class LensesController extends AbstractController
/** /**
* 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');
@ -77,9 +76,8 @@ class LensesController extends AbstractController
/** /**
* 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');
@ -88,11 +86,10 @@ class LensesController extends AbstractController
/** /**
* 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
* @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');
@ -100,9 +97,8 @@ class LensesController extends AbstractController
/** /**
* 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');
@ -120,13 +116,10 @@ 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
* *
* @param Lenses $lens The lens entity * @param Lenses $lens The lens entity
*
* @return FormInterface
*/ */
private function createDeacquireForm(Lenses $lens): FormInterface private function createDeacquireForm(Lenses $lens): FormInterface
{ {

View File

@ -2,6 +2,9 @@
namespace App\Controller; namespace App\Controller;
use UnexpectedValueException;
use LogicException;
use Doctrine\ORM\ORMInvalidArgumentException;
use App\Entity\PreviouslyOwnedCamera; use App\Entity\PreviouslyOwnedCamera;
use App\Form\PreviouslyOwnedCameraType; use App\Form\PreviouslyOwnedCameraType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -11,22 +14,21 @@ 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,9 +40,8 @@ class PreviouslyOwnedCameraController extends AbstractController
/** /**
* 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');
@ -49,9 +50,9 @@ class PreviouslyOwnedCameraController extends AbstractController
/** /**
* 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');
@ -60,25 +61,21 @@ class PreviouslyOwnedCameraController extends AbstractController
/** /**
* 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 * @throws LogicException
* @throws \LogicException * @throws ORMInvalidArgumentException
* @throws \Doctrine\ORM\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
* *
* @param PreviouslyOwnedCamera $camera The camera entity * @param PreviouslyOwnedCamera $camera The camera entity
*
* @return FormInterface
*/ */
private function createReacquireForm(PreviouslyOwnedCamera $camera): FormInterface private function createReacquireForm(PreviouslyOwnedCamera $camera): FormInterface
{ {

View File

@ -4,36 +4,42 @@ namespace App\Controller;
use App\Entity\PreviouslyOwnedFlash; use App\Entity\PreviouslyOwnedFlash;
use App\Form\PreviouslyOwnedFlashType; use App\Form\PreviouslyOwnedFlashType;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request; 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;
public function __construct(private readonly ManagerRegistry $managerRegistry)
{
}
/** /**
* Lists all previouslyOwnedFlash entities. * Lists all previouslyOwnedFlash entities.
*
* @Route("/", name="previously-owned-flash_index", methods={"GET"})
*/ */
public function indexAction() #[Route(path: '/', name: 'previously-owned-flash_index', methods: ['GET'])]
public function indexAction(): Response
{ {
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');
@ -41,20 +47,18 @@ class PreviouslyOwnedFlashController extends AbstractController
/** /**
* Finds and displays a previouslyOwnedFlash entity. * Finds and displays a previouslyOwnedFlash entity.
*
* @Route("/{id}", name="previously-owned-flash_show", methods={"GET"})
*/ */
public function showAction(PreviouslyOwnedFlash $previouslyOwnedFlash) #[Route(path: '/{id}', name: 'previously-owned-flash_show', methods: ['GET'])]
public function showAction(PreviouslyOwnedFlash $previouslyOwnedFlash): Response
{ {
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"})
*/ */
public function editAction(Request $request, PreviouslyOwnedFlash $previouslyOwnedFlash) #[Route(path: '/{id}/edit', name: 'previously-owned-flash_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, PreviouslyOwnedFlash $previouslyOwnedFlash): RedirectResponse|Response
{ {
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,18 @@ 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', [
@ -36,9 +33,8 @@ class PreviouslyOwnedLensesController extends AbstractController
/** /**
* 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');
@ -46,9 +42,8 @@ class PreviouslyOwnedLensesController extends AbstractController
/** /**
* 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

@ -6,18 +6,13 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* Battery Type * Battery Type
*
* @ORM\Table(name="battery_type", schema="camera")
* @ORM\Entity
*/ */
#[ORM\Table(name: 'battery_type', schema: 'camera')]
#[ORM\Entity]
class BatteryType class BatteryType
{ {
/** #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
* @var integer #[ORM\Id]
* #[ORM\GeneratedValue(strategy: 'IDENTITY')]
* @ORM\Column(name="id", type="integer", nullable=false) private int $id;
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
} }

View File

@ -2,26 +2,21 @@
namespace App\Entity; namespace App\Entity;
use App\Repository\CameraRepository;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* Camera * Camera
*
* @ORM\Table(name="camera", schema="camera", indexes={
@ORM\Index(name="IDX_747C826FC54C8C93", columns={"type_id"})
})
* @ORM\Entity(repositoryClass="App\Repository\CameraRepository")
*/ */
class Camera { #[ORM\Table(name: 'camera', schema: 'camera')]
#[ORM\Index(columns: ['type_id'], name: 'IDX_747C826FC54C8C93')]
#[ORM\Entity(repositoryClass: CameraRepository::class)]
class Camera
{
use CameraTrait; use CameraTrait;
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
/** #[ORM\Id]
* @var integer #[ORM\GeneratedValue(strategy: 'IDENTITY')]
* #[ORM\SequenceGenerator(sequenceName: 'camera__id_seq', allocationSize: 1, initialValue: 1)]
* @ORM\Column(name="id", type="integer", nullable=false) private int $id;
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
* @ORM\SequenceGenerator(sequenceName="camera__id_seq", allocationSize=1, initialValue=1)
*/
private $id;
} }

View File

@ -15,124 +15,51 @@ trait CameraTrait
{ {
use PurchasePriceTrait; use PurchasePriceTrait;
/** #[ORM\ManyToOne(targetEntity: 'CameraType')]
* @var CameraType #[ORM\JoinColumn(name: 'type_id', referencedColumnName: 'id', nullable: false)]
* private readonly CameraType $type;
* @ORM\ManyToOne(targetEntity="CameraType")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="type_id", referencedColumnName="id")
* })
*/
private ?CameraType $type;
/** #[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: false)]
* @var string private readonly string $brand;
*
* @ORM\Column(name="brand", type="string", length=64, nullable=false)
*/
private string $brand;
/** #[ORM\Column(name: 'mount', type: 'string', length: 32, nullable: false)]
* @var string private readonly string $mount;
*
* @ORM\Column(name="mount", type="string", length=32, nullable=false)
*/
private string $mount;
/** #[ORM\Column(name: 'model', type: 'string', length: 255, nullable: false)]
* @var string private readonly string $model;
*
* @ORM\Column(name="model", type="string", length=255, nullable=false)
*/
private string $model;
/** #[ORM\Column(name: 'is_digital', type: 'boolean', nullable: false)]
* @var boolean private readonly bool $isDigital;
*
* @ORM\Column(name="is_digital", type="boolean", nullable=false)
*/
private bool $isDigital;
/** #[ORM\Column(name: 'crop_factor', type: 'decimal', precision: 10, scale: 0, nullable: false)]
* @var string
*
* @ORM\Column(name="crop_factor", type="decimal", precision=10, scale=0, nullable=false)
*/
private string $cropFactor = '1.0'; private string $cropFactor = '1.0';
/** #[ORM\Column(name: 'is_working', type: 'boolean', nullable: false)]
* @var boolean private readonly bool $isWorking;
*
* @ORM\Column(name="is_working", type="boolean", nullable=false)
*/
private bool $isWorking;
/** #[ORM\Column(name: 'notes', type: 'text', nullable: true)]
* @var string private readonly ?string $notes;
*
* @ORM\Column(name="notes", type="text", nullable=true)
*/
private ?string $notes;
/** #[ORM\Column(name: 'serial', type: 'string', length: 20, nullable: false)]
* @var string private readonly string $serial;
*
* @ORM\Column(name="serial", type="string", length=20, nullable=false)
*/
private string $serial;
/** #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false)]
* @var boolean
*
* @ORM\Column(name="formerly_owned", type="boolean", nullable=false)
*/
private bool $formerlyOwned = FALSE; private bool $formerlyOwned = FALSE;
/** #[ORM\Column(name: 'battery_type', type: 'string', nullable: true)]
* @var string private readonly ?string $batteryType;
*
* @ORM\Column(name="purchase_price", type="money", nullable=true)
*/
private $purchasePrice;
/** #[ORM\Column(name: 'film_format', type: 'string', nullable: true)]
* @var string
*
* @ORM\Column(name="battery_type", type="string", nullable=true)
*/
private ?string $batteryType;
/**
* @var string
*
* @ORM\Column(name="film_format", type="string", nullable=true)
*/
private ?string $filmFormat = '135'; private ?string $filmFormat = '135';
/** #[ORM\Column(name: 'received', type: 'boolean', nullable: true)]
* @var boolean
*
* @ORM\Column(name="received", type="boolean", nullable=true)
*/
private ?bool $received = FALSE; private ?bool $received = FALSE;
/**
* Get id
*
* @return integer
*/
public function getId(): int public function getId(): int
{ {
return $this->id; return $this->id;
} }
/**
* Set type
*
* @param CameraType $type
*
* @return self
*/
public function setType(CameraType $type = null): self public function setType(CameraType $type = null): self
{ {
$this->type = $type; $this->type = $type;
@ -140,23 +67,11 @@ trait CameraTrait
return $this; return $this;
} }
/** public function getType(): CameraType
* Get type
*
* @return CameraType
*/
public function getType(): ?CameraType
{ {
return $this->type; return $this->type;
} }
/**
* Set brand
*
* @param string $brand
*
* @return self
*/
public function setBrand(string $brand): self public function setBrand(string $brand): self
{ {
$this->brand = $brand; $this->brand = $brand;
@ -164,23 +79,11 @@ trait CameraTrait
return $this; return $this;
} }
/** public function getBrand(): string
* Get brand
*
* @return string
*/
public function getBrand(): ?string
{ {
return $this->brand; return $this->brand;
} }
/**
* Set mount
*
* @param string $mount
*
* @return self
*/
public function setMount(string $mount): self public function setMount(string $mount): self
{ {
$this->mount = $mount; $this->mount = $mount;
@ -188,23 +91,11 @@ trait CameraTrait
return $this; return $this;
} }
/** public function getMount(): string
* Get mount
*
* @return string
*/
public function getMount(): ?string
{ {
return $this->mount; return $this->mount;
} }
/**
* Set model
*
* @param string $model
*
* @return self
*/
public function setModel(string $model): self public function setModel(string $model): self
{ {
$this->model = $model; $this->model = $model;
@ -212,23 +103,11 @@ trait CameraTrait
return $this; return $this;
} }
/** public function getModel(): string
* Get model
*
* @return string
*/
public function getModel(): ?string
{ {
return $this->model; return $this->model;
} }
/**
* Set isDigital
*
* @param boolean $isDigital
*
* @return self
*/
public function setIsDigital(bool $isDigital): self public function setIsDigital(bool $isDigital): self
{ {
$this->isDigital = $isDigital; $this->isDigital = $isDigital;
@ -236,23 +115,11 @@ trait CameraTrait
return $this; return $this;
} }
/** public function getIsDigital(): bool
* Get isDigital
*
* @return boolean
*/
public function getIsDigital(): ?bool
{ {
return $this->isDigital; return $this->isDigital;
} }
/**
* Set cropFactor
*
* @param string $cropFactor
*
* @return self
*/
public function setCropFactor(string $cropFactor): self public function setCropFactor(string $cropFactor): self
{ {
$this->cropFactor = $cropFactor; $this->cropFactor = $cropFactor;
@ -260,23 +127,11 @@ trait CameraTrait
return $this; return $this;
} }
/**
* Get cropFactor
*
* @return string
*/
public function getCropFactor(): string public function getCropFactor(): string
{ {
return $this->cropFactor; return $this->cropFactor;
} }
/**
* Set isWorking
*
* @param boolean $isWorking
*
* @return self
*/
public function setIsWorking(bool $isWorking): self public function setIsWorking(bool $isWorking): self
{ {
$this->isWorking = $isWorking; $this->isWorking = $isWorking;
@ -284,155 +139,78 @@ trait CameraTrait
return $this; return $this;
} }
/** public function getIsWorking(): bool
* Get isWorking
*
* @return boolean
*/
public function getIsWorking(): ?bool
{ {
return $this->isWorking; return $this->isWorking;
} }
/** public function setNotes(string $notes): self
* Set notes
*
* @param string $notes
*
* @return self
*/
public function setNotes($notes): self
{ {
$this->notes = $notes; $this->notes = $notes;
return $this; return $this;
} }
/**
* Get notes
*
* @return string
*/
public function getNotes(): string public function getNotes(): string
{ {
return $this->notes ?? ''; return $this->notes ?? '';
} }
/** public function setSerial(string $serial): self
* Set serial
*
* @param string $serial
*
* @return self
*/
public function setSerial($serial): self
{ {
$this->serial = $serial; $this->serial = $serial;
return $this; return $this;
} }
/**
* Get serial
*
* @return string
*/
public function getSerial(): string public function getSerial(): string
{ {
return $this->serial ?? ''; return $this->serial ?? '';
} }
/** public function setFormerlyOwned(bool $formerlyOwned): self
* Set formerlyOwned
*
* @param boolean $formerlyOwned
*
* @return self
*/
public function setFormerlyOwned($formerlyOwned): self
{ {
$this->formerlyOwned = $formerlyOwned; $this->formerlyOwned = $formerlyOwned;
return $this; return $this;
} }
/** public function getFormerlyOwned(): bool
* Get formerlyOwned
*
* @return boolean
*/
public function getFormerlyOwned(): ?bool
{ {
return $this->formerlyOwned; return $this->formerlyOwned;
} }
/** public function setBatteryType(string $batteryType): self
* Set batteryType
*
* @param string $batteryType
*
* @return self
*/
public function setBatteryType($batteryType): self
{ {
$this->batteryType = $batteryType; $this->batteryType = $batteryType;
return $this; return $this;
} }
/** public function getBatteryType(): string
* Get batteryType
*
* @return string
*/
public function getBatteryType(): ?string
{ {
return $this->batteryType; return $this->batteryType ?? '';
} }
/** public function setFilmFormat(string $filmFormat): self
* Set filmFormat
*
* @param string $filmFormat
*
* @return self
*/
public function setFilmFormat($filmFormat): self
{ {
$this->filmFormat = $filmFormat; $this->filmFormat = $filmFormat;
return $this; return $this;
} }
/**
* Get filmFormat
*
* @return string
*/
public function getFilmFormat(): string public function getFilmFormat(): string
{ {
return $this->filmFormat; return $this->filmFormat ?? '';
} }
/** public function setReceived(bool $received): self
* Set received
*
* @param boolean $received
*
* @return self
*/
public function setReceived($received): self
{ {
$this->received = $received; $this->received = $received;
return $this; return $this;
} }
/**
* Get received
*
* @return boolean
*/
public function getReceived(): bool public function getReceived(): bool
{ {
return $this->received; return $this->received;

View File

@ -2,56 +2,44 @@
namespace App\Entity; namespace App\Entity;
use Stringable;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* CameraType * CameraType
*
* @ORM\Table(name="camera_type", schema="camera")
* @ORM\Entity
*/ */
class CameraType #[ORM\Table(name: 'camera_type', schema: 'camera')]
#[ORM\Entity]
class CameraType implements Stringable
{ {
/** #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
* @var integer #[ORM\Id]
* #[ORM\GeneratedValue(strategy: 'IDENTITY')]
* @ORM\Column(name="id", type="integer", nullable=false) #[ORM\SequenceGenerator(sequenceName: 'camera.camera_type_id_seq', allocationSize: 1, initialValue: 1)]
* @ORM\Id private int $id;
* @ORM\GeneratedValue(strategy="IDENTITY")
* @ORM\SequenceGenerator(sequenceName="camera.camera_type_id_seq", allocationSize=1, initialValue=1)
*/
private $id;
/** /**
* @var string * @var string
*
* @ORM\Column(name="type", type="string", length=255, nullable=false)
*/ */
#[ORM\Column(name: 'type', type: 'string', length: 255, nullable: false)]
private string $type; private string $type;
/** /**
* @var string * @var string
*
* @ORM\Column(name="description", type="text", nullable=true)
*/ */
private ?string $description; #[ORM\Column(name: 'description', type: 'text', nullable: true)]
private ?string $description = null;
/** /**
* Value for serialization * Value for serialization
*
* @return string
*/ */
public function __toString(): string public function __toString(): string
{ {
return $this->type; return $this->type;
} }
/** /**
* Get id * Get id
*
* @return integer
*/ */
public function getId(): int public function getId(): int
{ {
@ -61,9 +49,7 @@ class CameraType
/** /**
* Set type * Set type
* *
* @param string $type
* *
* @return CameraType
*/ */
public function setType(string $type): self public function setType(string $type): self
{ {
@ -75,9 +61,7 @@ class CameraType
/** /**
* Set description * Set description
* *
* @param string $description
* *
* @return CameraType
*/ */
public function setDescription(string $description): self public function setDescription(string $description): self
{ {

View File

@ -6,115 +6,94 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* Camera * Camera
*
* @ORM\Table(name="film", schema="camera")
* @ORM\Entity
*/ */
class Film { #[ORM\Table(name: 'film', schema: 'camera')]
#[ORM\Entity]
/** class Film
* @var integer {
* #[ORM\Id]
* @ORM\Id #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
* @ORM\Column(name="id", type="integer", nullable=false) #[ORM\GeneratedValue(strategy: 'IDENTITY')]
* @ORM\GeneratedValue(strategy="IDENTITY") private int $id;
*/
private $id;
/** /**
* @var string * @var string
*
* @ORM\Column(name="brand", type="string", nullable=false)
*/ */
#[ORM\Column(name: 'brand', type: 'string', nullable: false)]
private string $brand; private string $brand;
/** /**
* @var string * @var string
*
* @ORM\Column(name="product_line", type="string", nullable=true)
*/ */
private ?string $productLine; #[ORM\Column(name: 'product_line', type: 'string', nullable: true)]
private ?string $productLine = null;
/** /**
* @var string * @var string
*
* @ORM\Column(name="film_name", type="string", nullable=false)
*/ */
#[ORM\Column(name: 'film_name', type: 'string', nullable: false)]
private string $filmName; private string $filmName;
/** /**
* @var string * @var string
*
* @ORM\Column(name="film_alias", type="string", nullable=true)
*/ */
private ?string $filmAlias; #[ORM\Column(name: 'film_alias', type: 'string', nullable: true)]
private ?string $filmAlias = null;
/** /**
* @var int * @var int
*
* @ORM\Column(name="film_speed_asa", type="integer", nullable=false)
*/ */
#[ORM\Column(name: 'film_speed_asa', type: 'integer', nullable: false)]
private int $filmSpeedAsa; private int $filmSpeedAsa;
/** /**
* @var int * @var int
*
* @ORM\Column(name="film_speed_din", type="integer", nullable=false)
*/ */
#[ORM\Column(name: 'film_speed_din', type: 'integer', nullable: false)]
private int $filmSpeedDin; private int $filmSpeedDin;
/** /**
* @var string * @var string
*
* @ORM\Column(name="film_format", type="string", nullable=false)
*/ */
#[ORM\Column(name: 'film_format', type: 'string', nullable: false)]
private string $filmFormat; private string $filmFormat;
/** /**
* @var string * @var string
*
* @ORM\Column(name="film_base", type="string", nullable=false, options={"default"="Cellulose Triacetate"})
*/ */
#[ORM\Column(name: 'film_base', type: 'string', nullable: false, options: ['default' => 'Cellulose Triacetate'])]
private string $filmBase = 'Cellulose Triacetate'; private string $filmBase = 'Cellulose Triacetate';
/** /**
* @var int * @var int
*
* @ORM\Column(name="unused_rolls", type="integer", nullable=false, options={"default"=0})
*/ */
#[ORM\Column(name: 'unused_rolls', type: 'integer', nullable: false, options: ['default' => 0])]
private int $unusedRolls = 0; private int $unusedRolls = 0;
/** /**
* @var int * @var int
*
* @ORM\Column(name="rolls_in_camera", type="integer", nullable=false, options={"default"=0})
*/ */
#[ORM\Column(name: 'rolls_in_camera', type: 'integer', nullable: false, options: ['default' => 0])]
private int $rollsInCamera = 0; private int $rollsInCamera = 0;
/** /**
* @var int * @var int
*
* @ORM\Column(name="developed_rolls", type="integer", nullable=false, options={"default"=0})
*/ */
#[ORM\Column(name: 'developed_rolls', type: 'integer', nullable: false, options: ['default' => 0])]
private int $developedRolls = 0; private int $developedRolls = 0;
/** /**
* @var string * @var string
*
* @ORM\Column(name="chemistry", type="string", nullable=false, options={"default"="C-41"})
*/ */
#[ORM\Column(name: 'chemistry', type: 'string', nullable: false, options: ['default' => 'C-41'])]
private string $chemistry = 'C-41'; private string $chemistry = 'C-41';
/** /**
* @var string * @var string
*
* @ORM\Column(name="notes", type="text", nullable=true)
*/ */
private ?string $notes; #[ORM\Column(name: 'notes', type: 'text', nullable: true)]
private ?string $notes = null;
/**
* @return int
*/
public function getId(): int public function getId(): int
{ {
return $this->id; return $this->id;
@ -128,10 +107,6 @@ class Film {
return $this->brand; return $this->brand;
} }
/**
* @param string $brand
* @return self
*/
public function setBrand(string $brand): self public function setBrand(string $brand): self
{ {
$this->brand = $brand; $this->brand = $brand;
@ -148,7 +123,6 @@ class Film {
/** /**
* @param string $productLine * @param string $productLine
* @return self
*/ */
public function setProductLine(?string $productLine): self public function setProductLine(?string $productLine): self
{ {
@ -164,10 +138,6 @@ class Film {
return $this->filmName; return $this->filmName;
} }
/**
* @param string $filmName
* @return self
*/
public function setFilmName(string $filmName): self public function setFilmName(string $filmName): self
{ {
$this->filmName = $filmName; $this->filmName = $filmName;
@ -182,10 +152,6 @@ class Film {
return $this->filmAlias; return $this->filmAlias;
} }
/**
* @param string $filmAlias
* @return self
*/
public function setFilmAlias(string $filmAlias): self public function setFilmAlias(string $filmAlias): self
{ {
$this->filmAlias = $filmAlias; $this->filmAlias = $filmAlias;
@ -200,10 +166,6 @@ class Film {
return $this->filmSpeedAsa; return $this->filmSpeedAsa;
} }
/**
* @param int $filmSpeedAsa
* @return self
*/
public function setFilmSpeedAsa(int $filmSpeedAsa): self public function setFilmSpeedAsa(int $filmSpeedAsa): self
{ {
$this->filmSpeedAsa = $filmSpeedAsa; $this->filmSpeedAsa = $filmSpeedAsa;
@ -218,10 +180,6 @@ class Film {
return $this->filmSpeedDin; return $this->filmSpeedDin;
} }
/**
* @param int $filmSpeedDin
* @return self
*/
public function setFilmSpeedDin(int $filmSpeedDin): self public function setFilmSpeedDin(int $filmSpeedDin): self
{ {
$this->filmSpeedDin = $filmSpeedDin; $this->filmSpeedDin = $filmSpeedDin;
@ -236,10 +194,6 @@ class Film {
return $this->filmFormat; return $this->filmFormat;
} }
/**
* @param string $filmFormat
* @return self
*/
public function setFilmFormat(string $filmFormat): self public function setFilmFormat(string $filmFormat): self
{ {
$this->filmFormat = $filmFormat; $this->filmFormat = $filmFormat;
@ -254,10 +208,6 @@ class Film {
return $this->filmBase; return $this->filmBase;
} }
/**
* @param string $filmBase
* @return self
*/
public function setFilmBase(string $filmBase): self public function setFilmBase(string $filmBase): self
{ {
$this->filmBase = $filmBase; $this->filmBase = $filmBase;
@ -272,10 +222,6 @@ class Film {
return $this->unusedRolls; return $this->unusedRolls;
} }
/**
* @param int $unusedRolls
* @return self
*/
public function setUnusedRolls(int $unusedRolls): self public function setUnusedRolls(int $unusedRolls): self
{ {
$this->unusedRolls = $unusedRolls; $this->unusedRolls = $unusedRolls;
@ -290,10 +236,6 @@ class Film {
return $this->rollsInCamera; return $this->rollsInCamera;
} }
/**
* @param int $rollsInCamera
* @return self
*/
public function setRollsInCamera(int $rollsInCamera): self public function setRollsInCamera(int $rollsInCamera): self
{ {
$this->rollsInCamera = $rollsInCamera; $this->rollsInCamera = $rollsInCamera;
@ -308,10 +250,6 @@ class Film {
return $this->developedRolls; return $this->developedRolls;
} }
/**
* @param int $developedRolls
* @return self
*/
public function setDevelopedRolls(int $developedRolls): self public function setDevelopedRolls(int $developedRolls): self
{ {
$this->developedRolls = $developedRolls; $this->developedRolls = $developedRolls;
@ -326,10 +264,6 @@ class Film {
return $this->chemistry; return $this->chemistry;
} }
/**
* @param string $chemistry
* @return self
*/
public function setChemistry(string $chemistry): self public function setChemistry(string $chemistry): self
{ {
$this->chemistry = $chemistry; $this->chemistry = $chemistry;
@ -344,10 +278,6 @@ class Film {
return $this->notes; return $this->notes;
} }
/**
* @param string $notes
* @return self
*/
public function setNotes(string $notes): self public function setNotes(string $notes): self
{ {
$this->notes = $notes; $this->notes = $notes;

View File

@ -4,31 +4,25 @@ namespace App\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** #[ORM\Table(name: 'film_format', schema: 'camera')]
* @ORM\Table(name="film_format", schema="camera") #[ORM\Entity]
* @ORM\Entity
*/
class FilmFormat class FilmFormat
{ {
/** #[ORM\Id]
* @ORM\Id #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: 'integer')]
* @ORM\Column(type="integer")
*/
private int $id; private int $id;
/** /**
* @var int * @var int
*
* @ORM\Column(name="number_id", type="integer")
*/ */
#[ORM\Column(name: 'number_id', type: 'integer')]
private int $numberId; private int $numberId;
/** /**
* @var string * @var string
*
* @ORM\Column(name="name", type="string")
*/ */
#[ORM\Column(name: 'name', type: 'string')]
private string $name; private string $name;
/** /**
@ -47,10 +41,6 @@ class FilmFormat
return $this->numberId; return $this->numberId;
} }
/**
* @param int $numberId
* @return self
*/
public function setNumberId(int $numberId): self public function setNumberId(int $numberId): self
{ {
$this->numberId = $numberId; $this->numberId = $numberId;
@ -65,10 +55,6 @@ class FilmFormat
return $this->name; return $this->name;
} }
/**
* @param string $name
* @return self
*/
public function setName(string $name): self public function setName(string $name): self
{ {
$this->name = $name; $this->name = $name;

View File

@ -6,36 +6,27 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* Camera.flash * Camera.flash
*
* @ORM\Table(name="flash", schema="camera")
* @ORM\Entity
*/ */
#[ORM\Table(name: 'flash', schema: 'camera')]
#[ORM\Entity]
class Flash class Flash
{ {
use FlashTrait; use FlashTrait;
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
/** #[ORM\Id]
* @var integer #[ORM\GeneratedValue(strategy: 'IDENTITY')]
* #[ORM\SequenceGenerator(sequenceName: 'camera.flash_id_seq', allocationSize: 1, initialValue: 1)]
* @ORM\Column(name="id", type="integer", nullable=false) private int $id;
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
* @ORM\SequenceGenerator(sequenceName="camera.flash_id_seq", allocationSize=1, initialValue=1)
*/
private $id;
/** /**
* @var boolean * @var boolean
*
* @ORM\Column(name="received", type="boolean", nullable=false, options={"default" : false})
*/ */
#[ORM\Column(name: 'received', type: 'boolean', nullable: false, options: ['default' => false])]
private bool $received = false; private bool $received = false;
/** /**
* @var boolean * @var boolean
*
* @ORM\Column(name="formerly_owned", type="boolean", nullable=false, options={"default" : false})
*/ */
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false, options: ['default' => false])]
private bool $formerlyOwned = false; private bool $formerlyOwned = false;
} }

View File

@ -8,95 +8,39 @@ trait FlashTrait
{ {
use PurchasePriceTrait; use PurchasePriceTrait;
/** #[ORM\Column(name: 'brand', type: 'string', nullable: false)]
* @var string private readonly string $brand;
*
* @ORM\Column(name="brand", type="string", nullable=false)
*/
private string $brand;
/** #[ORM\Column(name: 'model', type: 'string', nullable: false)]
* @var string private readonly string $model;
*
* @ORM\Column(name="model", type="string", nullable=false)
*/
private string $model;
/** #[ORM\Column(name: 'is_auto_flash', type: 'boolean', nullable: false)]
* @var boolean
*
* @ORM\Column(name="is_auto_flash", type="boolean", nullable=false)
*/
private bool $isAutoFlash = false; private bool $isAutoFlash = false;
/** #[ORM\Column(name: 'is_ttl', type: 'boolean', nullable: false)]
* @var boolean
*
* @ORM\Column(name="is_ttl", type="boolean", nullable=false)
*/
private bool $isTtl = false; private bool $isTtl = false;
/** #[ORM\Column(name: 'ttl_type', type: 'string', nullable: false)]
* @var string
*
* @ORM\Column(name="ttl_type", type="string", nullable=false)
*/
private string $ttlType = 'N / A'; private string $ttlType = 'N / A';
/** #[ORM\Column(name: 'is_p_ttl', type: 'boolean', nullable: false)]
* @var boolean
*
* @ORM\Column(name="is_p_ttl", type="boolean", nullable=false)
*/
private bool $isPTtl = false; private bool $isPTtl = false;
/** #[ORM\Column(name: 'p_ttl_type', type: 'string', nullable: false)]
* @var string
*
* @ORM\Column(name="p_ttl_type", type="string", nullable=false)
*/
private string $pTtlType = 'N / A'; private string $pTtlType = 'N / A';
/** #[ORM\Column(name: 'guide_number', type: 'string', nullable: true)]
* @var string private ?string $guideNumber = '';
*
* @ORM\Column(name="guide_number", type="string", nullable=true)
*/
private string $guideNumber;
/** #[ORM\Column(name: 'batteries', type: 'string', nullable: false)]
* @var string
*
* @ORM\Column(name="purchase_price", type="money", nullable=true)
*/
private ?string $purchasePrice;
/**
* @var string
*
* @ORM\Column(name="batteries", type="string", nullable=false)
*/
private string $batteries = '4x AA'; private string $batteries = '4x AA';
/** #[ORM\Column(name: 'notes', type: 'text', nullable: true)]
* @var string private readonly ?string $notes;
*
* @ORM\Column(name="notes", type="text", nullable=true)
*/
private ?string $notes;
/** #[ORM\Column(name: 'serial', type: 'string', nullable: true)]
* @var string private readonly ?string $serial;
*
* @ORM\Column(name="serial", type="string", nullable=true)
*/
private ?string $serial;
/**
* Get id
*
* @return integer
*/
public function getId(): int public function getId(): int
{ {
return $this->id; return $this->id;
@ -105,11 +49,9 @@ trait FlashTrait
/** /**
* Set brand * Set brand
* *
* @param string $brand
* *
* @return self
*/ */
public function setBrand($brand) public function setBrand(string $brand): self
{ {
$this->brand = $brand; $this->brand = $brand;
@ -250,8 +192,6 @@ trait FlashTrait
* Set pTtlType * Set pTtlType
* *
* @param string $pTtlType * @param string $pTtlType
*
* @return self
*/ */
public function setPTtlType($pTtlType): self public function setPTtlType($pTtlType): self
{ {

View File

@ -2,148 +2,123 @@
namespace App\Entity; namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
trait LensTrait trait LensTrait
{ {
use PurchasePriceTrait; use PurchasePriceTrait;
/** /**
* @var string * @var string
*
* @ORM\Column(name="brand", type="string", length=64, nullable=true)
*/ */
private ?string $brand; #[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: true)]
private readonly ?string $brand;
/** /**
* @var string * @var string
*
* @ORM\Column(name="coatings", type="string", length=64, nullable=true)
*/ */
private ?string $coatings; #[ORM\Column(name: 'coatings', type: 'string', length: 64, nullable: true)]
private readonly ?string $coatings;
/** /**
* @var string * @var string
*
* @ORM\Column(name="product_line", type="string", length=64, nullable=true)
*/ */
private ?string $productLine; #[ORM\Column(name: 'product_line', type: 'string', length: 64, nullable: true)]
private readonly ?string $productLine;
/** /**
* @var string * @var string
*
* @ORM\Column(name="model", type="string", length=64, nullable=true)
*/ */
private ?string $model; #[ORM\Column(name: 'model', type: 'string', length: 64, nullable: true)]
private readonly ?string $model;
/** /**
* @var string * @var string
*
* @ORM\Column(name="min_f_stop", type="string", length=10, nullable=true)
*/ */
private ?string $minFStop; #[ORM\Column(name: 'min_f_stop', type: 'string', length: 10, nullable: true)]
private readonly ?string $minFStop;
/** /**
* @var float * @var float
*
* @ORM\Column(name="max_f_stop", type="float", precision=10, scale=0, nullable=true)
*/ */
private ?float $maxFStop; #[ORM\Column(name: 'max_f_stop', type: 'float', precision: 10, scale: 0, nullable: true)]
private readonly ?float $maxFStop;
/** /**
* @var integer * @var integer
*
* @ORM\Column(name="min_focal_length", type="integer", nullable=true)
*/ */
private ?int $minFocalLength; #[ORM\Column(name: 'min_focal_length', type: 'integer', nullable: true)]
private readonly ?int $minFocalLength;
/** /**
* @var integer * @var integer
*
* @ORM\Column(name="max_focal_length", type="integer", nullable=true)
*/ */
private ?int $maxFocalLength; #[ORM\Column(name: 'max_focal_length', type: 'integer', nullable: true)]
private readonly ?int $maxFocalLength;
/** /**
* @var string * @var string
*
* @ORM\Column(name="serial", type="string", length=10, nullable=true)
*/ */
private ?string $serial; #[ORM\Column(name: 'serial', type: 'string', length: 10, nullable: true)]
private readonly ?string $serial;
/** /**
* @var string * @var string
*
* @ORM\Column(name="purchase_price", type="money", nullable=true)
*/ */
private ?string $purchasePrice; #[ORM\Column(name: 'notes', type: 'text', nullable: true)]
private readonly ?string $notes;
/** /**
* @var string * @var string
*
* @ORM\Column(name="notes", type="text", nullable=true)
*/
private ?string $notes;
/**
* @var string
*
* @ORM\Column(name="image_size", type="string", nullable=false, options={"default"="35mm"})
*/ */
#[ORM\Column(name: 'image_size', type: 'string', nullable: false, options: ['default' => '35mm'])]
private string $imageSize = '35mm'; private string $imageSize = '35mm';
/** /**
* @var string * @var string
*
* @ORM\Column(name="mount", type="string", length=40, nullable=true)
*/ */
private ?string $mount; #[ORM\Column(name: 'mount', type: 'string', length: 40, nullable: true)]
private readonly ?string $mount;
/** /**
* @var string * @var string
*
* @ORM\Column(name="front_filter_size", type="decimal", precision=10, scale=0, nullable=true)
*/ */
private ?string $frontFilterSize; #[ORM\Column(name: 'front_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: true)]
private readonly ?string $frontFilterSize;
/** /**
* @var string * @var string
*
* @ORM\Column(name="rear_filter_size", type="decimal", precision=10, scale=0, nullable=true)
*/ */
private? string $rearFilterSize; #[ORM\Column(name: 'rear_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: true)]
private readonly ? string $rearFilterSize;
/** /**
* @var boolean * @var boolean
*
* @ORM\Column(name="is_teleconverter", type="boolean", nullable=false)
*/ */
#[ORM\Column(name: 'is_teleconverter', type: 'boolean', nullable: false)]
private bool $isTeleconverter = false; private bool $isTeleconverter = false;
/** /**
* @var integer * @var integer
*
* @ORM\Column(name="design_elements", type="smallint", nullable=true)
*/ */
private ?int $designElements; #[ORM\Column(name: 'design_elements', type: 'smallint', nullable: true)]
private readonly ?int $designElements;
/** /**
* @var integer * @var integer
*
* @ORM\Column(name="design_groups", type="smallint", nullable=true)
*/ */
private ?int $designGroups; #[ORM\Column(name: 'design_groups', type: 'smallint', nullable: true)]
private readonly ?int $designGroups;
/** /**
* @var integer * @var integer
*
* @ORM\Column(name="aperture_blades", type="smallint", nullable=true)
*/ */
private ?int $apertureBlades; #[ORM\Column(name: 'aperture_blades', type: 'smallint', nullable: true)]
private readonly ?int $apertureBlades;
/** /**
* Get id * Get id
*
* @return integer
*/ */
public function getId(): int public function getId(): int
{ {
@ -154,8 +129,6 @@ trait LensTrait
* Set brand * Set brand
* *
* @param string $brand * @param string $brand
*
* @return self
*/ */
public function setBrand($brand): self public function setBrand($brand): self
{ {
@ -178,8 +151,6 @@ trait LensTrait
* Set coatings * Set coatings
* *
* @param string $coatings * @param string $coatings
*
* @return self
*/ */
public function setCoatings($coatings): self public function setCoatings($coatings): self
{ {
@ -202,8 +173,6 @@ trait LensTrait
* Set productLine * Set productLine
* *
* @param string $productLine * @param string $productLine
*
* @return self
*/ */
public function setProductLine($productLine): self public function setProductLine($productLine): self
{ {
@ -226,8 +195,6 @@ trait LensTrait
* Set model * Set model
* *
* @param string $model * @param string $model
*
* @return self
*/ */
public function setModel($model): self public function setModel($model): self
{ {
@ -250,8 +217,6 @@ trait LensTrait
* Set minFStop * Set minFStop
* *
* @param string $minFStop * @param string $minFStop
*
* @return self
*/ */
public function setMinFStop($minFStop): self public function setMinFStop($minFStop): self
{ {
@ -274,8 +239,6 @@ trait LensTrait
* Set maxFStop * Set maxFStop
* *
* @param float $maxFStop * @param float $maxFStop
*
* @return self
*/ */
public function setMaxFStop($maxFStop): self public function setMaxFStop($maxFStop): self
{ {
@ -298,8 +261,6 @@ trait LensTrait
* Set minFocalLength * Set minFocalLength
* *
* @param integer $minFocalLength * @param integer $minFocalLength
*
* @return self
*/ */
public function setMinFocalLength($minFocalLength): self public function setMinFocalLength($minFocalLength): self
{ {
@ -322,8 +283,6 @@ trait LensTrait
* Set maxFocalLength * Set maxFocalLength
* *
* @param integer $maxFocalLength * @param integer $maxFocalLength
*
* @return self
*/ */
public function setMaxFocalLength($maxFocalLength): self public function setMaxFocalLength($maxFocalLength): self
{ {
@ -346,8 +305,6 @@ trait LensTrait
* Set serial * Set serial
* *
* @param string $serial * @param string $serial
*
* @return self
*/ */
public function setSerial($serial): self public function setSerial($serial): self
{ {
@ -358,8 +315,6 @@ trait LensTrait
/** /**
* Get serial * Get serial
*
* @return string
*/ */
public function getSerial(): string public function getSerial(): string
{ {
@ -370,8 +325,6 @@ trait LensTrait
* Set notes * Set notes
* *
* @param string $notes * @param string $notes
*
* @return self
*/ */
public function setNotes(?string $notes): self public function setNotes(?string $notes): self
{ {
@ -382,8 +335,6 @@ trait LensTrait
/** /**
* Get notes * Get notes
*
* @return string
*/ */
public function getNotes(): string public function getNotes(): string
{ {
@ -392,8 +343,6 @@ trait LensTrait
/** /**
* Get image size * Get image size
*
* @return string
*/ */
public function getImageSize(): string public function getImageSize(): string
{ {
@ -402,9 +351,6 @@ trait LensTrait
/** /**
* Set image size * Set image size
*
* @param string $imageSize
* @return self
*/ */
public function setImageSize(string $imageSize): self public function setImageSize(string $imageSize): self
{ {
@ -416,8 +362,6 @@ trait LensTrait
* Set mount * Set mount
* *
* @param string $mount * @param string $mount
*
* @return self
*/ */
public function setMount($mount): self public function setMount($mount): self
{ {
@ -440,8 +384,6 @@ trait LensTrait
* Set received * Set received
* *
* @param boolean $received * @param boolean $received
*
* @return self
*/ */
public function setReceived($received): self public function setReceived($received): self
{ {
@ -464,8 +406,6 @@ trait LensTrait
* Set formerlyOwned * Set formerlyOwned
* *
* @param boolean $formerlyOwned * @param boolean $formerlyOwned
*
* @return self
*/ */
public function setFormerlyOwned($formerlyOwned): self public function setFormerlyOwned($formerlyOwned): self
{ {
@ -488,8 +428,6 @@ trait LensTrait
* Set frontFilterSize * Set frontFilterSize
* *
* @param string $frontFilterSize * @param string $frontFilterSize
*
* @return self
*/ */
public function setFrontFilterSize($frontFilterSize): self public function setFrontFilterSize($frontFilterSize): self
{ {
@ -512,8 +450,6 @@ trait LensTrait
* Set rearFilterSize * Set rearFilterSize
* *
* @param string $rearFilterSize * @param string $rearFilterSize
*
* @return self
*/ */
public function setRearFilterSize($rearFilterSize): self public function setRearFilterSize($rearFilterSize): self
{ {
@ -536,8 +472,6 @@ trait LensTrait
* Set isTeleconverter * Set isTeleconverter
* *
* @param boolean $isTeleconverter * @param boolean $isTeleconverter
*
* @return self
*/ */
public function setIsTeleconverter($isTeleconverter): self public function setIsTeleconverter($isTeleconverter): self
{ {
@ -560,8 +494,6 @@ trait LensTrait
* Set designElements * Set designElements
* *
* @param integer $designElements * @param integer $designElements
*
* @return self
*/ */
public function setDesignElements($designElements): self public function setDesignElements($designElements): self
{ {
@ -584,8 +516,6 @@ trait LensTrait
* Set designGroups * Set designGroups
* *
* @param integer $designGroups * @param integer $designGroups
*
* @return self
*/ */
public function setDesignGroups($designGroups): self public function setDesignGroups($designGroups): self
{ {
@ -608,8 +538,6 @@ trait LensTrait
* Set apertureBlades * Set apertureBlades
* *
* @param integer $apertureBlades * @param integer $apertureBlades
*
* @return self
*/ */
public function setApertureBlades($apertureBlades): self public function setApertureBlades($apertureBlades): self
{ {

View File

@ -2,39 +2,26 @@
namespace App\Entity; namespace App\Entity;
use App\Repository\LensesRepository;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* Camera.lenses * Camera.lenses
*
* @ORM\Table(name="lenses", schema="camera")
* @ORM\Entity(repositoryClass="App\Repository\LensesRepository")
*/ */
#[ORM\Table(name: 'lenses', schema: 'camera')]
#[ORM\Entity(repositoryClass: LensesRepository::class)]
class Lenses class Lenses
{ {
use LensTrait; use LensTrait;
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'camera.lenses_id_seq', allocationSize: 1, initialValue: 1)]
private int $id;
/** #[ORM\Column(name: 'received', type: 'boolean', nullable: false)]
* @var integer private bool $received = false;
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
* @ORM\SequenceGenerator(sequenceName="camera.lenses_id_seq", allocationSize=1, initialValue=1)
*/
private $id;
/** #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false)]
* @var boolean private bool $formerlyOwned = false;
*
* @ORM\Column(name="received", type="boolean", nullable=false)
*/
private $received = false;
/**
* @var boolean
*
* @ORM\Column(name="formerly_owned", type="boolean", nullable=false)
*/
private $formerlyOwned = false;
} }

View File

@ -2,25 +2,21 @@
namespace App\Entity; namespace App\Entity;
use App\Repository\CameraRepository;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* Camera.previouslyOwnedCamera * Camera.previouslyOwnedCamera
*
* @ORM\Table(name="previously_owned_camera", schema="camera", indexes={@ORM\Index(name="IDX_6EF94C6BC54C8C93", columns={"type_id"})})
* @ORM\Entity(repositoryClass="App\Repository\CameraRepository")
*/ */
#[ORM\Table(name: 'previously_owned_camera', schema: 'camera')]
#[ORM\Index(name: 'IDX_6EF94C6BC54C8C93', columns: ['type_id'])]
#[ORM\Entity(repositoryClass: CameraRepository::class)]
class PreviouslyOwnedCamera class PreviouslyOwnedCamera
{ {
use CameraTrait; use CameraTrait;
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
/** #[ORM\Id]
* @var integer #[ORM\GeneratedValue(strategy: 'IDENTITY')]
* #[ORM\SequenceGenerator(sequenceName: 'prevously_owned_camera_id_seq', allocationSize: 1, initialValue: 1)]
* @ORM\Column(name="id", type="integer", nullable=false) private int $id;
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
* @ORM\SequenceGenerator(sequenceName="prevously_owned_camera_id_seq", allocationSize=1, initialValue=1)
*/
private $id;
} }

View File

@ -6,35 +6,21 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* Camera.flash * Camera.flash
*
* @ORM\Table(name="previously_owned_flash", schema="camera")
* @ORM\Entity
*/ */
#[ORM\Table(name: 'previously_owned_flash', schema: 'camera')]
#[ORM\Entity]
class PreviouslyOwnedFlash class PreviouslyOwnedFlash
{ {
use FlashTrait; use FlashTrait;
/** #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
* @var integer #[ORM\Id]
* #[ORM\GeneratedValue(strategy: 'IDENTITY')]
* @ORM\Column(name="id", type="integer", nullable=false) private int $id;
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/** #[ORM\Column(name: 'received', type: 'boolean', nullable: false, options: ['default' => true])]
* @var boolean
*
* @ORM\Column(name="received", type="boolean", nullable=false, options={"default" : true})
*/
private bool $received = true; private bool $received = true;
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false, options: ['default' => true])]
/**
* @var boolean
*
* @ORM\Column(name="formerly_owned", type="boolean", nullable=false, options={"default" : true})
*/
private bool $formerlyOwned = true; private bool $formerlyOwned = true;
} }

View File

@ -2,37 +2,31 @@
namespace App\Entity; namespace App\Entity;
use App\Repository\LensesRepository;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* Camera.previouslyOwnedLenses * Camera.previouslyOwnedLenses
*
* @ORM\Table(name="previously_owned_lenses", schema="camera")
* @ORM\Entity(repositoryClass="App\Repository\LensesRepository")
*/ */
#[ORM\Table(name: 'previously_owned_lenses', schema: 'camera')]
#[ORM\Entity(repositoryClass: LensesRepository::class)]
class PreviouslyOwnedLenses class PreviouslyOwnedLenses
{ {
use LensTrait; use LensTrait;
/** #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
* @var integer #[ORM\Id]
* #[ORM\GeneratedValue(strategy: 'IDENTITY')]
* @ORM\Column(name="id", type="integer", nullable=false) private int $id;
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/** /**
* @var boolean * @var boolean
*
* @ORM\Column(name="received", type="boolean", nullable=false)
*/ */
#[ORM\Column(name: 'received', type: 'boolean', nullable: false)]
private bool $received = true; private bool $received = true;
/** /**
* @var boolean * @var boolean
*
* @ORM\Column(name="formerly_owned", type="boolean", nullable=false)
*/ */
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false)]
private bool $formerlyOwned = true; private bool $formerlyOwned = true;
} }

View File

@ -2,31 +2,24 @@
namespace App\Entity; namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
trait PurchasePriceTrait trait PurchasePriceTrait
{ {
/** #[ORM\Column(name: 'purchase_price', type: 'money', nullable: true)]
* Set purchasePrice private ?string $purchasePrice = null;
*
* @param string $purchasePrice public function setPurchasePrice(?string $purchasePrice): self
*
* @return self
*/
public function setPurchasePrice($purchasePrice): self
{ {
$this->purchasePrice = $purchasePrice; $this->purchasePrice = $purchasePrice;
return $this; return $this;
} }
/** public function getPurchasePrice(): string
* Get purchasePrice
*
* @return string
*/
public function getPurchasePrice()
{ {
if (empty($this->purchasePrice)) { if (empty($this->purchasePrice)) {
return 0; return '0';
} }
return $this->purchasePrice; return $this->purchasePrice;

View File

@ -2,6 +2,8 @@
namespace App\Repository; namespace App\Repository;
use ReflectionObject;
use Throwable;
trait AcquireTrait { trait AcquireTrait {
/** /**
@ -15,8 +17,8 @@ trait AcquireTrait {
{ {
$em = $this->getEntityManager(); $em = $this->getEntityManager();
$old = new \ReflectionObject($currentRecord); $old = new ReflectionObject($currentRecord);
$new = new \ReflectionObject($newRecord); $new = new ReflectionObject($newRecord);
foreach ($old->getProperties() as $property) { foreach ($old->getProperties() as $property) {
$propertyName = $property->getName(); $propertyName = $property->getName();
@ -34,7 +36,7 @@ trait AcquireTrait {
$em->remove($currentRecord); $em->remove($currentRecord);
$em->flush(); $em->flush();
} }
catch (\Throwable $e) catch (Throwable)
{ {
dump($newRecord); dump($newRecord);
} }

View File

@ -1,4 +1,4 @@
<?php <?php declare(strict_types=1);
namespace App\Types; namespace App\Types;
@ -9,7 +9,7 @@ use App\ValueObject\Money;
class MoneyType extends Type { class MoneyType extends Type {
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform): string public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
{ {
return 'MONEY'; return 'MONEY';
} }

View File

@ -2,8 +2,9 @@
namespace App\ValueObject; namespace App\ValueObject;
class Money { use Stringable;
private float $value; class Money implements Stringable {
private readonly float $value;
public function __construct($value) public function __construct($value)
{ {