diff --git a/config/bundles.php b/config/bundles.php index 3d78d01..ecbdfce 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -1,13 +1,12 @@ - ['all' => true], - Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], - Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], - Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], - Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], - Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true], - Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], - Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], + Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], + Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], + Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], + Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], + Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], + Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], + Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], ]; diff --git a/config/packages/dev/debug.yaml b/config/packages/dev/debug.yaml deleted file mode 100644 index 26d4e53..0000000 --- a/config/packages/dev/debug.yaml +++ /dev/null @@ -1,4 +0,0 @@ -debug: - # Forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser. - # See the "server:dump" command to start a new server. - dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%" diff --git a/config/preload.php b/config/preload.php index 5ebcdb2..b38b648 100644 --- a/config/preload.php +++ b/config/preload.php @@ -1,5 +1,5 @@ -bootEnv(dirname(__DIR__).'/.env'); +(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env'); if ($_SERVER['APP_DEBUG']) { - umask(0000); + umask(0000); - Debug::enable(); + Debug::enable(); } if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) { - Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); + Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); } if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) { - Request::setTrustedHosts([$trustedHosts]); + Request::setTrustedHosts([$trustedHosts]); } -$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); -$request = Request::createFromGlobals(); +$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); +$request = Request::createFromGlobals(); $response = $kernel->handle($request); $response->send(); $kernel->terminate($request, $response); diff --git a/src/Controller/CameraController.php b/src/Controller/CameraController.php index a5b42d0..fd2c740 100644 --- a/src/Controller/CameraController.php +++ b/src/Controller/CameraController.php @@ -2,17 +2,17 @@ namespace App\Controller; -use Doctrine\Persistence\ManagerRegistry; -use LogicException; use App\Entity\Camera; use App\Form\CameraType; use Doctrine\ORM\ORMInvalidArgumentException; +use Doctrine\Persistence\ManagerRegistry; +use LogicException; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Annotation\Route; /** * Camera controller. @@ -20,127 +20,128 @@ use Symfony\Component\HttpFoundation\Request; #[Route(path: 'camera')] class CameraController extends AbstractController { - use FormControllerTrait; - protected const ENTITY = Camera::class; + use FormControllerTrait; - protected const FORM = CameraType::class; + protected const ENTITY = Camera::class; + protected const FORM = CameraType::class; - public function __construct(private readonly ManagerRegistry $managerRegistry) - { - } + public function __construct(private readonly ManagerRegistry $managerRegistry) + { + } - /** - * Lists all camera entities. - */ - #[Route(path: '/', name: 'camera_index', methods: ['GET'])] - public function indexAction() : Response - { - $em = $this->managerRegistry->getManager(); - $receivedItems = $em->getRepository(self::ENTITY)->findBy([ - 'received' => true - ], [ - 'isWorking' => 'ASC', - 'brand' => 'ASC', - 'mount' => 'ASC', - 'model' => 'ASC', - ]); - $newItems = $em->getRepository(self::ENTITY)->findBy([ - 'received' => false - ], [ - 'brand' => 'ASC', - 'mount' => 'ASC', - 'model' => 'ASC', - ]); - $working = array_filter($receivedItems, [$this, 'isWorking']); - $notWorking = array_filter($receivedItems, [$this, 'isNotWorking']); - return $this->render('camera/index.html.twig', [ - 'not_received' => $newItems, - 'not_working' => $notWorking, - 'working' => $working, - ]); - } + /** + * Lists all camera entities. + */ + #[Route(path: '/', name: 'camera_index', methods: ['GET'])] + public function indexAction(): Response + { + $em = $this->managerRegistry->getManager(); + $receivedItems = $em->getRepository(self::ENTITY)->findBy([ + 'received' => true, + ], [ + 'isWorking' => 'ASC', + 'brand' => 'ASC', + 'mount' => 'ASC', + 'model' => 'ASC', + ]); + $newItems = $em->getRepository(self::ENTITY)->findBy([ + 'received' => false, + ], [ + 'brand' => 'ASC', + 'mount' => 'ASC', + 'model' => 'ASC', + ]); + $working = array_filter($receivedItems, [$this, 'isWorking']); + $notWorking = array_filter($receivedItems, [$this, 'isNotWorking']); - /** - * Creates a new camera entity. - */ - #[Route(path: '/new', name: 'camera_new', methods: ['GET', 'POST'])] - public function newAction(Request $request) - { - return $this->itemCreate($request, 'camera/new.html.twig', 'camera', 'camera_show'); - } + return $this->render('camera/index.html.twig', [ + 'not_received' => $newItems, + 'not_working' => $notWorking, + 'working' => $working, + ]); + } - /** - * Finds and displays a camera entity. - */ - #[Route(path: '/{id}', name: 'camera_show', methods: ['GET'])] - public function showAction(Camera $camera) - { - return $this->itemView($camera, 'camera/show.html.twig', 'camera'); - } + /** + * Creates a new camera entity. + */ + #[Route(path: '/new', name: 'camera_new', methods: ['GET', 'POST'])] + public function newAction(Request $request): RedirectResponse|Response + { + return $this->itemCreate($request, 'camera/new.html.twig', 'camera', 'camera_show'); + } - /** - * Displays a form to edit an existing camera entity. - * - * @throws LogicException - */ - #[Route(path: '/{id}/edit', name: 'camera_edit', methods: ['GET', 'POST'])] - public function editAction(Request $request, Camera $camera) - { - return $this->itemUpdate($request, $camera, 'camera/edit.html.twig', 'camera', 'camera_show'); - } + /** + * Finds and displays a camera entity. + */ + #[Route(path: '/{id}', name: 'camera_show', methods: ['GET'])] + public function showAction(Camera $camera): Response + { + return $this->itemView($camera, 'camera/show.html.twig', 'camera'); + } - /** - * Deletes a camera entity. - * - * @throws LogicException - */ - #[Route(path: '/{id}', name: 'camera_delete', methods: ['DELETE'])] - public function deleteAction(Request $request, Camera $camera) : RedirectResponse - { - return $this->itemDelete($request, $camera, 'camera_index'); - } + /** + * Displays a form to edit an existing camera entity. + * + * @throws LogicException + */ + #[Route(path: '/{id}/edit', name: 'camera_edit', methods: ['GET', 'POST'])] + public function editAction(Request $request, Camera $camera): RedirectResponse|Response + { + return $this->itemUpdate($request, $camera, 'camera/edit.html.twig', 'camera', 'camera_show'); + } - /** - * Moves a camera to the previouslyOwned table - * - * @throws LogicException - * @throws ORMInvalidArgumentException - */ - #[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'); - } + /** + * Deletes a camera entity. + * + * @throws LogicException + */ + #[Route(path: '/{id}', name: 'camera_delete', methods: ['DELETE'])] + public function deleteAction(Request $request, Camera $camera): RedirectResponse + { + return $this->itemDelete($request, $camera, 'camera_index'); + } - /** - * Creates a form to delete a camera entity. - * - * @param Camera $camera The camera entity - * - * @return FormInterface The form - */ - private function createDeleteForm(Camera $camera): FormInterface - { - return $this->buildForm($camera, 'camera_delete', 'DELETE'); - } + /** + * Moves a camera to the previouslyOwned table + * + * @throws LogicException + * @throws ORMInvalidArgumentException + */ + #[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'); + } - /** - * Creates a form to move - * - * @param Camera $camera The camera entity - */ - private function createDeacquireForm(Camera $camera): FormInterface - { - return $this->buildForm($camera, 'camera_deacquire'); - } + /** + * Creates a form to delete a camera entity. + * + * @param Camera $camera The camera entity + * + * @return FormInterface The form + */ + private function createDeleteForm(Camera $camera): FormInterface + { + return $this->buildForm($camera, 'camera_delete', 'DELETE'); + } - private function isWorking(Camera $camera): bool - { - return $camera->getIsWorking(); - } + /** + * Creates a form to move + * + * @param Camera $camera The camera entity + */ + private function createDeacquireForm(Camera $camera): FormInterface + { + return $this->buildForm($camera, 'camera_deacquire'); + } - private function isNotWorking(Camera $camera): bool - { - return !$this->isWorking($camera); - } + private function isWorking(Camera $camera): bool + { + return $camera->getIsWorking(); + } + + private function isNotWorking(Camera $camera): bool + { + return ! $this->isWorking($camera); + } } diff --git a/src/Controller/CameraTypeController.php b/src/Controller/CameraTypeController.php index 563b4b8..0011158 100644 --- a/src/Controller/CameraTypeController.php +++ b/src/Controller/CameraTypeController.php @@ -8,75 +8,74 @@ use Doctrine\Persistence\ManagerRegistry; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -use Symfony\Component\HttpFoundation\Request; #[Route(path: 'camera-type')] 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) + { + } - public function __construct(private readonly ManagerRegistry $managerRegistry) - { - } + /** + * Lists all cameraType entities. + */ + #[Route(path: '/', name: 'camera-type_index', methods: ['GET'])] + public function indexAction(): Response + { + return $this->itemListView('cameratype/index.html.twig', 'cameraTypes', [ + 'type' => 'ASC', + ]); + } - /** - * Lists all cameraType entities. - */ - #[Route(path: '/', name: 'camera-type_index', methods: ['GET'])] - public function indexAction(): Response - { - return $this->itemListView('cameratype/index.html.twig', 'cameraTypes', [ - 'type' => 'ASC', - ]); - } + /** + * Creates a new cameraType entity. + */ + #[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'); + } - /** - * Creates a new cameraType entity. - */ - #[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'); - } + /** + * Finds and displays a cameraType entity. + */ + #[Route(path: '/{id}', name: 'camera-type_show', methods: ['GET'])] + public function showAction(CameraType $cameraType): Response + { + return $this->itemView($cameraType, 'cameratype/show.html.twig', 'cameraType'); + } - /** - * Finds and displays a cameraType entity. - */ - #[Route(path: '/{id}', name: 'camera-type_show', methods: ['GET'])] - public function showAction(CameraType $cameraType): Response - { - return $this->itemView($cameraType, 'cameratype/show.html.twig', 'cameraType'); - } + /** + * Displays a form to edit an existing cameraType entity. + */ + #[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'); + } - /** - * Displays a form to edit an existing cameraType entity. - */ - #[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'); - } + /** + * Deletes a cameraType entity. + */ + #[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'); + } - /** - * Deletes a cameraType entity. - */ - #[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'); - } - - /** - * Creates a form to delete a cameraType entity. - */ - private function createDeleteForm(CameraType $cameraType): FormInterface - { - return $this->buildForm($cameraType, 'camera-type_delete', 'DELETE'); - } + /** + * Creates a form to delete a cameraType entity. + */ + private function createDeleteForm(CameraType $cameraType): FormInterface + { + return $this->buildForm($cameraType, 'camera-type_delete', 'DELETE'); + } } diff --git a/src/Controller/DefaultController.php b/src/Controller/DefaultController.php index 3be165e..34d1d9f 100644 --- a/src/Controller/DefaultController.php +++ b/src/Controller/DefaultController.php @@ -3,18 +3,18 @@ namespace App\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -use Symfony\Component\HttpFoundation\Request; class DefaultController extends AbstractController { - #[Route(path: '/', name: 'homepage')] - public function indexAction(Request $request) : Response - { - // replace this example code with whatever you need - return $this->render('default/index.html.twig', [ - 'base_dir' => realpath($this->getParameter('kernel.project_dir')) . DIRECTORY_SEPARATOR, - ]); - } + #[Route(path: '/', name: 'homepage')] + public function indexAction(Request $request): Response + { + // replace this example code with whatever you need + return $this->render('default/index.html.twig', [ + 'base_dir' => realpath($this->getParameter('kernel.project_dir')) . DIRECTORY_SEPARATOR, + ]); + } } diff --git a/src/Controller/FilmController.php b/src/Controller/FilmController.php index efac486..e1c1b72 100644 --- a/src/Controller/FilmController.php +++ b/src/Controller/FilmController.php @@ -2,16 +2,17 @@ namespace App\Controller; -use Doctrine\Persistence\ManagerRegistry; -use LogicException; use App\Entity\Film; use App\Form\FilmType; use Doctrine\Common\Collections\Criteria; +use Doctrine\Persistence\ManagerRegistry; +use LogicException; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -use Symfony\Component\Form\FormInterface; -use Symfony\Component\HttpFoundation\Request; /** * Film controller. @@ -19,93 +20,94 @@ use Symfony\Component\HttpFoundation\Request; #[Route(path: 'film')] class FilmController extends AbstractController { - use FormControllerTrait; - protected const ENTITY = Film::class; + use FormControllerTrait; - protected const FORM = FilmType::class; + protected const ENTITY = Film::class; + protected const FORM = FilmType::class; - public function __construct(private readonly ManagerRegistry $managerRegistry) - { - } + public function __construct(private readonly ManagerRegistry $managerRegistry) + { + } - /** - * Lists all film entities. - */ - #[Route(path: '/', name: 'film_index', methods: ['GET'])] - public function indexAction() : Response - { - $repo = $this->managerRegistry->getManager()->getRepository(self::ENTITY); - $criteria = Criteria::create() - ->where(Criteria::expr()->gt('rollsInCamera', 0)) - ->orderBy([ - 'filmFormat' => Criteria::ASC, - 'brand' => Criteria::ASC, - 'rollsInCamera' => Criteria::DESC, - 'productLine' => Criteria::ASC, - ]); - $inCamera = $repo->matching($criteria); - $notInCamera = $repo->findBy([ - 'rollsInCamera' => 0, - ], [ - 'brand' => 'ASC', - 'productLine' => 'ASC', - 'filmFormat' => 'ASC', - ]); - return $this->render('film/index.html.twig', [ - 'in_camera' => $inCamera, - 'films' => $notInCamera, - ]); - } + /** + * Lists all film entities. + */ + #[Route(path: '/', name: 'film_index', methods: ['GET'])] + public function indexAction(): Response + { + $repo = $this->managerRegistry->getManager()->getRepository(self::ENTITY); + $criteria = Criteria::create() + ->where(Criteria::expr()->gt('rollsInCamera', 0)) + ->orderBy([ + 'filmFormat' => Criteria::ASC, + 'brand' => Criteria::ASC, + 'rollsInCamera' => Criteria::DESC, + 'productLine' => Criteria::ASC, + ]); + $inCamera = $repo->matching($criteria); + $notInCamera = $repo->findBy([ + 'rollsInCamera' => 0, + ], [ + 'brand' => 'ASC', + 'productLine' => 'ASC', + 'filmFormat' => 'ASC', + ]); - /** - * Creates a new film entity. - */ - #[Route(path: '/new', name: 'film_new', methods: ['GET', 'POST'])] - public function newAction(Request $request) - { - return $this->itemCreate($request, 'film/new.html.twig', 'film', 'film_show'); - } + return $this->render('film/index.html.twig', [ + 'in_camera' => $inCamera, + 'films' => $notInCamera, + ]); + } - /** - * Finds and displays a film entity. - */ - #[Route(path: '/{id}', name: 'film_show', methods: ['GET'])] - public function showAction(Film $film) - { - return $this->itemView($film, 'film/show.html.twig', 'film'); - } + /** + * Creates a new film entity. + */ + #[Route(path: '/new', name: 'film_new', methods: ['GET', 'POST'])] + public function newAction(Request $request): RedirectResponse|Response + { + return $this->itemCreate($request, 'film/new.html.twig', 'film', 'film_show'); + } - /** - * Displays a form to edit an existing film entity. - * - * @throws LogicException - */ - #[Route(path: '/{id}/edit', name: 'film_edit', methods: ['GET', 'POST'])] - public function editAction(Request $request, Film $film) - { - return $this->itemUpdate($request, $film, 'film/edit.html.twig', 'film', 'film_show'); - } + /** + * Finds and displays a film entity. + */ + #[Route(path: '/{id}', name: 'film_show', methods: ['GET'])] + public function showAction(Film $film): Response + { + return $this->itemView($film, 'film/show.html.twig', 'film'); + } - /** - * Deletes a film entity. - * - * @throws LogicException - */ - #[Route(path: '/{id}', name: 'film_delete', methods: ['DELETE'])] - public function deleteAction(Request $request, Film $film) - { - return $this->itemDelete($request, $film, 'film_index'); - } + /** + * Displays a form to edit an existing film entity. + * + * @throws LogicException + */ + #[Route(path: '/{id}/edit', name: 'film_edit', methods: ['GET', 'POST'])] + public function editAction(Request $request, Film $film): RedirectResponse|Response + { + return $this->itemUpdate($request, $film, 'film/edit.html.twig', 'film', 'film_show'); + } - /** - * Creates a form to delete a film entity. - * - * @param Film $film The film entity - * - * @return FormInterface The form - */ - private function createDeleteForm(Film $film): FormInterface - { - return $this->buildForm($film, 'film_delete', 'DELETE'); - } + /** + * Deletes a film entity. + * + * @throws LogicException + */ + #[Route(path: '/{id}', name: 'film_delete', methods: ['DELETE'])] + public function deleteAction(Request $request, Film $film): RedirectResponse + { + return $this->itemDelete($request, $film, 'film_index'); + } + + /** + * Creates a form to delete a film entity. + * + * @param Film $film The film entity + * + * @return FormInterface The form + */ + private function createDeleteForm(Film $film): FormInterface + { + return $this->buildForm($film, 'film_delete', 'DELETE'); + } } diff --git a/src/Controller/FlashController.php b/src/Controller/FlashController.php index e033d8f..0cdd3fe 100644 --- a/src/Controller/FlashController.php +++ b/src/Controller/FlashController.php @@ -2,15 +2,15 @@ namespace App\Controller; -use Doctrine\Persistence\ManagerRegistry; -use Symfony\Component\Form\FormInterface; use App\Entity\Flash; use App\Form\FlashType; +use Doctrine\Persistence\ManagerRegistry; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -use Symfony\Component\HttpFoundation\Request; /** * Flash controller. @@ -18,66 +18,65 @@ use Symfony\Component\HttpFoundation\Request; #[Route(path: 'flash')] 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) + { + } - public function __construct(private readonly ManagerRegistry $managerRegistry) - { - } + /** + * Lists all flash entities. + */ + #[Route(path: '/', name: 'flash_index', methods: ['GET'])] + public function indexAction(): Response + { + return $this->itemListView('flash/index.html.twig', 'flashes'); + } - /** - * Lists all flash entities. - */ - #[Route(path: '/', name: 'flash_index', methods: ['GET'])] - public function indexAction(): Response - { - return $this->itemListView('flash/index.html.twig', 'flashes'); - } + /** + * Creates a new flash entity. + */ + #[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'); + } - /** - * Creates a new flash entity. - */ - #[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'); - } + /** + * Finds and displays a flash entity. + */ + #[Route(path: '/{id}', name: 'flash_show', methods: ['GET'])] + public function showAction(Flash $flash): Response + { + return $this->itemView($flash, 'flash/show.html.twig', 'flash'); + } - /** - * Finds and displays a flash entity. - */ - #[Route(path: '/{id}', name: 'flash_show', methods: ['GET'])] - public function showAction(Flash $flash): Response - { - return $this->itemView($flash, 'flash/show.html.twig', 'flash'); - } + /** + * Displays a form to edit an existing flash entity. + */ + #[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'); + } - /** - * Displays a form to edit an existing flash entity. - */ - #[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'); - } + /** + * Deletes a flash entity. + */ + #[Route(path: '/{id}', name: 'flash_delete', methods: ['DELETE'])] + public function deleteAction(Request $request, Flash $flash): RedirectResponse + { + return $this->itemDelete($request, $flash, 'flash_index'); + } - /** - * Deletes a flash entity. - */ - #[Route(path: '/{id}', name: 'flash_delete', methods: ['DELETE'])] - public function deleteAction(Request $request, Flash $flash): RedirectResponse - { - return $this->itemDelete($request, $flash, 'flash_index'); - } - - /** - * Creates a form to delete a flash entity. - */ - private function createDeleteForm(Flash $flash): FormInterface - { - return $this->buildForm($flash, 'flash_delete', 'DELETE'); - } + /** + * Creates a form to delete a flash entity. + */ + private function createDeleteForm(Flash $flash): FormInterface + { + return $this->buildForm($flash, 'flash_delete', 'DELETE'); + } } diff --git a/src/Controller/FormControllerTrait.php b/src/Controller/FormControllerTrait.php index fc3ada5..78f61a5 100644 --- a/src/Controller/FormControllerTrait.php +++ b/src/Controller/FormControllerTrait.php @@ -4,168 +4,177 @@ namespace App\Controller; use Doctrine\Persistence\ManagerRegistry; use Symfony\Component\Form\FormInterface; -use Symfony\Component\HttpFoundation\{Request, Response, RedirectResponse}; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; -trait FormControllerTrait { - private readonly ManagerRegistry $managerRegistry; +trait FormControllerTrait +{ + private readonly ManagerRegistry $managerRegistry; - /** - * Create a form generator - */ - protected function buildForm($item, string $actionRoute, string $method = 'POST'): FormInterface - { - return $this->createFormBuilder() - ->setAction($this->generateUrl($actionRoute, ['id' => $item->getId()])) - ->setMethod($method) - ->getForm(); - } + /** + * Create a form generator + * + * @param mixed $item + */ + protected function buildForm($item, string $actionRoute, string $method = 'POST'): FormInterface + { + return $this->createFormBuilder() + ->setAction($this->generateUrl($actionRoute, ['id' => $item->getId()])) + ->setMethod($method) + ->getForm(); + } - /** - * Show create form / create an item - */ - protected function itemCreate(Request $request, string $template, string $templateKey, string $redirectRoute) - { - $Entity = self::ENTITY; - $item = new $Entity; - $form = $this->createForm(self::FORM, $item); - $form->handleRequest($request); + /** + * Show create form / create an item + */ + protected function itemCreate(Request $request, string $template, string $templateKey, string $redirectRoute) + { + $Entity = self::ENTITY; + $item = new $Entity(); + $form = $this->createForm(self::FORM, $item); + $form->handleRequest($request); - // If creating the item - if ($form->isSubmitted() && $form->isValid()) - { - $em = $this->getDoctrine()->getManager(); - $em->persist($item); - $em->flush(); + // If creating the item + if ($form->isSubmitted() && $form->isValid()) { + $em = $this->getDoctrine()->getManager(); + $em->persist($item); + $em->flush(); - return $this->redirectToRoute($redirectRoute, ['id' => $item->getId()]); - } + return $this->redirectToRoute($redirectRoute, ['id' => $item->getId()]); + } - // If showing the form - return $this->render($template, [ - $templateKey => $item, - 'form' => $form->createView(), - ]); - } + // If showing the form + return $this->render($template, [ + $templateKey => $item, + 'form' => $form->createView(), + ]); + } - /** - * List view for the data type - */ - protected function itemListView(string $template, string $templateKey, array $sort = []): Response - { - $em = $this->managerRegistry->getManager(); + /** + * List view for the data type + */ + protected function itemListView(string $template, string $templateKey, array $sort = []): Response + { + $em = $this->managerRegistry->getManager(); - $items = $em->getRepository(self::ENTITY)->findBy([], $sort); + $items = $em->getRepository(self::ENTITY)->findBy([], $sort); - return $this->render($template, [ - $templateKey => $items, - ]); - } + return $this->render($template, [ + $templateKey => $items, + ]); + } - /** - * View details for a specific item - */ - protected function itemView($item, string $template, string $templateKey): Response - { - $templateData = [ - $templateKey => $item, - ]; + /** + * View details for a specific item + * + * @param mixed $item + */ + protected function itemView($item, string $template, string $templateKey): Response + { + $templateData = [ + $templateKey => $item, + ]; - if (method_exists($this, 'createDeleteForm')) { - $deleteForm = $this->createDeleteForm($item); - $templateData['delete_form'] = $deleteForm->createView(); - } + if (method_exists($this, 'createDeleteForm')) { + $deleteForm = $this->createDeleteForm($item); + $templateData['delete_form'] = $deleteForm->createView(); + } - return $this->render($template, $templateData); - } + return $this->render($template, $templateData); + } - /** - * Show edit form / update an item - */ - protected function itemUpdate(Request $request, $item, string $template, string $templateKey, string $redirectRoute) - { - $editForm = $this->createForm(self::FORM, $item); - $editForm->handleRequest($request); + /** + * Show edit form / update an item + * + * @param mixed $item + */ + protected function itemUpdate(Request $request, $item, string $template, string $templateKey, string $redirectRoute) + { + $editForm = $this->createForm(self::FORM, $item); + $editForm->handleRequest($request); - // If updating the item - if ($editForm->isSubmitted() && $editForm->isValid()) - { - $em = $this->getDoctrine()->getManager(); - $em->persist($item); - $em->flush(); + // If updating the item + if ($editForm->isSubmitted() && $editForm->isValid()) { + $em = $this->getDoctrine()->getManager(); + $em->persist($item); + $em->flush(); - return $this->redirectToRoute($redirectRoute, ['id' => $item->getId()]); - } + return $this->redirectToRoute($redirectRoute, ['id' => $item->getId()]); + } - // If showing the edit form - $templateData = [ - $templateKey => $item, - 'edit_form' => $editForm->createView(), - ]; + // If showing the edit form + $templateData = [ + $templateKey => $item, + 'edit_form' => $editForm->createView(), + ]; - if (method_exists($this, 'createDeleteForm')) - { - $deleteForm = $this->createDeleteForm($item); - $templateData['delete_form'] = $deleteForm->createView(); - } + if (method_exists($this, 'createDeleteForm')) { + $deleteForm = $this->createDeleteForm($item); + $templateData['delete_form'] = $deleteForm->createView(); + } - if (method_exists($this, 'createDeacquireForm')) - { - $deacquireForm = $this->createDeacquireForm($item); - $templateData['deacquire_form'] = $deacquireForm->createView(); - } + if (method_exists($this, 'createDeacquireForm')) { + $deacquireForm = $this->createDeacquireForm($item); + $templateData['deacquire_form'] = $deacquireForm->createView(); + } - if (method_exists($this, 'createReacquireForm')) - { - $reacquireForm = $this->createReacquireForm($item); - $templateData['reacquire_form'] = $reacquireForm->createView(); - } + if (method_exists($this, 'createReacquireForm')) { + $reacquireForm = $this->createReacquireForm($item); + $templateData['reacquire_form'] = $reacquireForm->createView(); + } - return $this->render($template, $templateData); - } + return $this->render($template, $templateData); + } - /** - * Move an item to a previously_owned table - */ - protected function itemDeacquire(Request $request, $item, string $redirectRoute): RedirectResponse - { - $form = $this->createDeacquireForm($item); - $form->handleRequest($request); + /** + * Move an item to a previously_owned table + * + * @param mixed $item + */ + protected function itemDeacquire(Request $request, $item, string $redirectRoute): RedirectResponse + { + $form = $this->createDeacquireForm($item); + $form->handleRequest($request); - $repository = $this->getDoctrine()->getRepository(self::ENTITY); - $repository->deacquire($item); + $repository = $this->getDoctrine()->getRepository(self::ENTITY); + $repository->deacquire($item); - return $this->redirectToRoute($redirectRoute); - } + return $this->redirectToRoute($redirectRoute); + } - /** - * Move an item from a previously_owned table back to the original table - */ - protected function itemReacquire(Request $request, $item, string $redirectRoute): RedirectResponse - { - $form = $this->createReacquireForm($item); - $form->handleRequest($request); + /** + * Move an item from a previously_owned table back to the original table + * + * @param mixed $item + */ + protected function itemReacquire(Request $request, $item, string $redirectRoute): RedirectResponse + { + $form = $this->createReacquireForm($item); + $form->handleRequest($request); - $repository = $this->getDoctrine()->getRepository(self::ENTITY); - $repository->reacquire($item); + $repository = $this->getDoctrine()->getRepository(self::ENTITY); + $repository->reacquire($item); - return $this->redirectToRoute($redirectRoute); - } + return $this->redirectToRoute($redirectRoute); + } - /** - * Actually delete an item - */ - protected function itemDelete(Request $request, $item, string $redirectRoute): RedirectResponse - { - $form = $this->createDeleteForm($item); - $form->handleRequest($request); + /** + * Actually delete an item + * + * @param mixed $item + */ + protected function itemDelete(Request $request, $item, string $redirectRoute): RedirectResponse + { + $form = $this->createDeleteForm($item); + $form->handleRequest($request); - // if ($form->isSubmitted() && $form->isValid()) - { - $em = $this->getDoctrine()->getManager(); - $em->remove($item); - $em->flush(); - } + // if ($form->isSubmitted() && $form->isValid()) - return $this->redirectToRoute($redirectRoute); - } + $em = $this->getDoctrine()->getManager(); + $em->remove($item); + $em->flush(); + + return $this->redirectToRoute($redirectRoute); + } } diff --git a/src/Controller/LensesController.php b/src/Controller/LensesController.php index 9b8c979..93d9533 100644 --- a/src/Controller/LensesController.php +++ b/src/Controller/LensesController.php @@ -2,13 +2,15 @@ namespace App\Controller; -use Doctrine\Persistence\ManagerRegistry; use App\Entity\Lenses; use App\Form\LensesType; +use Doctrine\Persistence\ManagerRegistry; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Form\FormInterface; -use Symfony\Component\HttpFoundation\{Request, RedirectResponse}; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Annotation\Route; /** * Lens controller. @@ -16,113 +18,115 @@ use Symfony\Component\HttpFoundation\{Request, RedirectResponse}; #[Route(path: 'lens')] class LensesController extends AbstractController { - use FormControllerTrait; - protected const ENTITY = Lenses::class; + use FormControllerTrait; - protected const FORM = LensesType::class; + protected const ENTITY = Lenses::class; + protected const FORM = LensesType::class; - public function __construct(private readonly ManagerRegistry $managerRegistry) - { - } + public function __construct(private readonly ManagerRegistry $managerRegistry) + { + } - /** - * Lists all lens entities. - */ - #[Route(path: '/', name: 'lens_index', methods: ['GET'])] - public function indexAction() - { - $em = $this->managerRegistry->getManager(); - $receivedItems = $em->getRepository(self::ENTITY)->findBy([ - 'received' => true - ], [ - 'brand' => 'ASC', - 'productLine' => 'ASC', - 'mount' => 'ASC', - 'minFocalLength' => 'ASC', - 'maxFStop' => 'ASC', - ]); - $newItems = $em->getRepository(self::ENTITY)->findBy([ - 'received' => false - ], [ - 'brand' => 'ASC', - 'productLine' => 'ASC', - 'mount' => 'ASC', - 'minFocalLength' => 'ASC', - 'maxFStop' => 'ASC', - ]); - return $this->render('lenses/index.html.twig', [ - 'not_received' => $newItems, - 'lenses' => $receivedItems, - ]); - } + /** + * Lists all lens entities. + */ + #[Route(path: '/', name: 'lens_index', methods: ['GET'])] + public function indexAction(): Response + { + $em = $this->managerRegistry->getManager(); + $receivedItems = $em->getRepository(self::ENTITY)->findBy([ + 'received' => true, + ], [ + 'brand' => 'ASC', + 'productLine' => 'ASC', + 'mount' => 'ASC', + 'minFocalLength' => 'ASC', + 'maxFStop' => 'ASC', + ]); + $newItems = $em->getRepository(self::ENTITY)->findBy([ + 'received' => false, + ], [ + 'brand' => 'ASC', + 'productLine' => 'ASC', + 'mount' => 'ASC', + 'minFocalLength' => 'ASC', + 'maxFStop' => 'ASC', + ]); - /** - * Creates a new lens entity. - */ - #[Route(path: '/new', name: 'lens_new', methods: ['GET', 'POST'])] - public function newAction(Request $request) - { - return $this->itemCreate($request, 'lenses/new.html.twig', 'lense', 'lens_show'); - } + return $this->render('lenses/index.html.twig', [ + 'not_received' => $newItems, + 'lenses' => $receivedItems, + ]); + } - /** - * Finds and displays a lens entity. - */ - #[Route(path: '/{id}', name: 'lens_show', methods: ['GET'])] - public function showAction(Lenses $lens) - { - return $this->itemView($lens, 'lenses/show.html.twig', 'lense'); - } + /** + * Creates a new lens entity. + */ + #[Route(path: '/new', name: 'lens_new', methods: ['GET', 'POST'])] + public function newAction(Request $request): RedirectResponse|Response + { + return $this->itemCreate($request, 'lenses/new.html.twig', 'lense', 'lens_show'); + } - /** - * Displays a form to edit an existing lens entity. - */ - #[Route(path: '/{id}/edit', name: 'lens_edit', methods: ['GET', 'POST'])] - public function editAction(Request $request, Lenses $lens) - { - return $this->itemUpdate($request, $lens, 'lenses/edit.html.twig', 'lense', 'lens_show'); - } + /** + * Finds and displays a lens entity. + */ + #[Route(path: '/{id}', name: 'lens_show', methods: ['GET'])] + public function showAction(Lenses $lens): Response + { + return $this->itemView($lens, 'lenses/show.html.twig', 'lense'); + } - /** - * Moves a camera to the previouslyOwned table - * - * @param Request $request - * @return RedirectResponse - */ - #[Route(path: '/{id}/deacquire', name: 'lens_deacquire', methods: ['POST'])] - public function deacquireAction(Request $request, Lenses $lens) - { - return $this->itemDeacquire($request, $lens, 'previously-owned-lens_index'); - } + /** + * Displays a form to edit an existing lens entity. + */ + #[Route(path: '/{id}/edit', name: 'lens_edit', methods: ['GET', 'POST'])] + public function editAction(Request $request, Lenses $lens): RedirectResponse|Response + { + return $this->itemUpdate($request, $lens, 'lenses/edit.html.twig', 'lense', 'lens_show'); + } - /** - * Deletes a lens entity. - */ - #[Route(path: '/{id}', name: 'lens_delete', methods: ['DELETE'])] - public function deleteAction(Request $request, Lenses $lens) - { - return $this->itemDelete($request, $lens, 'lens_index'); - } + /** + * Moves a camera to the previouslyOwned table + * + * @param Request $request + * + * @return RedirectResponse + */ + #[Route(path: '/{id}/deacquire', name: 'lens_deacquire', methods: ['POST'])] + public function deacquireAction(Request $request, Lenses $lens): RedirectResponse + { + return $this->itemDeacquire($request, $lens, 'previously-owned-lens_index'); + } - /** - * Creates a form to delete a lens entity. - * - * @param Lenses $lens The lens entity - * - * @return FormInterface The form - */ - private function createDeleteForm(Lenses $lens): FormInterface - { - return $this->buildForm($lens, 'lens_delete', 'DELETE'); - } + /** + * Deletes a lens entity. + */ + #[Route(path: '/{id}', name: 'lens_delete', methods: ['DELETE'])] + public function deleteAction(Request $request, Lenses $lens): RedirectResponse + { + return $this->itemDelete($request, $lens, 'lens_index'); + } - /** - * Creates a form to move - * - * @param Lenses $lens The lens entity - */ - private function createDeacquireForm(Lenses $lens): FormInterface - { - return $this->buildForm($lens, 'lens_deacquire'); - } + /** + * Creates a form to delete a lens entity. + * + * @param Lenses $lens The lens entity + * + * @return FormInterface The form + */ + private function createDeleteForm(Lenses $lens): FormInterface + { + return $this->buildForm($lens, 'lens_delete', 'DELETE'); + } + + /** + * Creates a form to move + * + * @param Lenses $lens The lens entity + */ + private function createDeacquireForm(Lenses $lens): FormInterface + { + return $this->buildForm($lens, 'lens_deacquire'); + } } diff --git a/src/Controller/PreviouslyOwnedCameraController.php b/src/Controller/PreviouslyOwnedCameraController.php index 6368177..65c4170 100644 --- a/src/Controller/PreviouslyOwnedCameraController.php +++ b/src/Controller/PreviouslyOwnedCameraController.php @@ -2,15 +2,18 @@ namespace App\Controller; -use UnexpectedValueException; -use LogicException; -use Doctrine\ORM\ORMInvalidArgumentException; use App\Entity\PreviouslyOwnedCamera; use App\Form\PreviouslyOwnedCameraType; +use Doctrine\ORM\ORMInvalidArgumentException; +use Doctrine\Persistence\ManagerRegistry; +use LogicException; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Form\FormInterface; -use Symfony\Component\HttpFoundation\{RedirectResponse, Request}; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Annotation\Route; +use UnexpectedValueException; /** * Previouslyownedcamera controller. @@ -18,67 +21,73 @@ use Symfony\Component\HttpFoundation\{RedirectResponse, Request}; #[Route(path: 'previously-owned-camera')] class PreviouslyOwnedCameraController extends AbstractController { - use FormControllerTrait; - protected const ENTITY = PreviouslyOwnedCamera::class; + use FormControllerTrait; - protected const FORM = PreviouslyOwnedCameraType::class; + protected const ENTITY = PreviouslyOwnedCamera::class; + protected const FORM = PreviouslyOwnedCameraType::class; - /** - * Lists all previouslyOwnedCamera entities. - * - * @throws UnexpectedValueException - */ - #[Route(path: '/', name: 'previously-owned-camera_index', methods: ['GET'])] - public function indexAction() - { - return $this->itemListView('previouslyownedcamera/index.html.twig', 'previouslyOwnedCameras', [ - 'brand' => 'ASC', - 'mount' => 'ASC', - 'model' => 'ASC', - ]); - } + public function __construct(private readonly ManagerRegistry $managerRegistry) + { + } - /** - * Finds and displays a previouslyOwnedCamera entity. - */ - #[Route(path: '/{id}', name: 'previously-owned-camera_show', methods: ['GET'])] - public function showAction(PreviouslyOwnedCamera $previouslyOwnedCamera) - { - return $this->itemView($previouslyOwnedCamera, 'previouslyownedcamera/show.html.twig', 'previouslyOwnedCamera'); - } + /** + * Lists all previouslyOwnedCamera entities. + * + * @throws UnexpectedValueException + */ + #[Route(path: '/', name: 'previously-owned-camera_index', methods: ['GET'])] + public function indexAction(): Response + { + return $this->itemListView('previouslyownedcamera/index.html.twig', 'previouslyOwnedCameras', [ + 'brand' => 'ASC', + 'mount' => 'ASC', + 'model' => 'ASC', + ]); + } - /** - * Displays a form to edit an existing previouslyOwnedCamera entity. - * - * @throws LogicException - */ - #[Route(path: '/{id}/edit', name: 'previously-owned-camera_edit', methods: ['GET', 'POST'])] - public function editAction(Request $request, PreviouslyOwnedCamera $previouslyOwnedCamera) - { - return $this->itemUpdate($request, $previouslyOwnedCamera, 'previouslyownedcamera/edit.html.twig', 'previouslyOwnedCamera', 'previously-owned-camera_show'); - } + /** + * Finds and displays a previouslyOwnedCamera entity. + */ + #[Route(path: '/{id}', name: 'previously-owned-camera_show', methods: ['GET'])] + public function showAction(PreviouslyOwnedCamera $previouslyOwnedCamera): Response + { + return $this->itemView($previouslyOwnedCamera, 'previouslyownedcamera/show.html.twig', 'previouslyOwnedCamera'); + } - /** - * Moves a camera to the previouslyOwned table - * - * @param Request $request - * @throws LogicException - * @throws ORMInvalidArgumentException - * @return 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'); - } + /** + * Displays a form to edit an existing previouslyOwnedCamera entity. + * + * @throws LogicException + */ + #[Route(path: '/{id}/edit', name: 'previously-owned-camera_edit', methods: ['GET', 'POST'])] + public function editAction(Request $request, PreviouslyOwnedCamera $previouslyOwnedCamera): RedirectResponse|Response + { + return $this->itemUpdate($request, $previouslyOwnedCamera, 'previouslyownedcamera/edit.html.twig', 'previouslyOwnedCamera', 'previously-owned-camera_show'); + } - /** - * Creates a form to move - * - * @param PreviouslyOwnedCamera $camera The camera entity - */ - private function createReacquireForm(PreviouslyOwnedCamera $camera): FormInterface - { - return $this->buildForm($camera, 'previously-owned-camera_reacquire', 'POST'); - } + /** + * Moves a camera to the previouslyOwned table + * + * @param Request $request + * + * @throws LogicException + * @throws ORMInvalidArgumentException + * + * @return 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'); + } + + /** + * Creates a form to move + * + * @param PreviouslyOwnedCamera $camera The camera entity + */ + private function createReacquireForm(PreviouslyOwnedCamera $camera): FormInterface + { + return $this->buildForm($camera, 'previously-owned-camera_reacquire', 'POST'); + } } diff --git a/src/Controller/PreviouslyOwnedFlashController.php b/src/Controller/PreviouslyOwnedFlashController.php index 9a68b06..1c9ccf0 100644 --- a/src/Controller/PreviouslyOwnedFlashController.php +++ b/src/Controller/PreviouslyOwnedFlashController.php @@ -7,9 +7,9 @@ use App\Form\PreviouslyOwnedFlashType; use Doctrine\Persistence\ManagerRegistry; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -use Symfony\Component\HttpFoundation\Request; /** * Previouslyownedflash controller. @@ -17,49 +17,48 @@ use Symfony\Component\HttpFoundation\Request; #[Route(path: 'previously-owned-flash')] 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) + { + } - public function __construct(private readonly ManagerRegistry $managerRegistry) - { - } + /** + * Lists all previouslyOwnedFlash entities. + */ + #[Route(path: '/', name: 'previously-owned-flash_index', methods: ['GET'])] + public function indexAction(): Response + { + return $this->itemListView('previouslyownedflash/index.html.twig', 'previouslyOwnedFlashes'); + } - /** - * Lists all previouslyOwnedFlash entities. - */ - #[Route(path: '/', name: 'previously-owned-flash_index', methods: ['GET'])] - public function indexAction(): Response - { - return $this->itemListView('previouslyownedflash/index.html.twig', 'previouslyOwnedFlashes'); - } + /** + * Creates a new previouslyOwnedFlash entity. + */ + #[Route(path: '/new', name: 'previously-owned-flash_new', methods: ['GET', 'POST'])] + public function newAction(Request $request): RedirectResponse|Response + { + return $this->itemCreate($request, 'previouslyownedflash/new.html.twig', 'previouslyOwnedFlash', 'previously-owned-flash_show'); + } - /** - * Creates a new previouslyOwnedFlash entity. - */ - #[Route(path: '/new', name: 'previously-owned-flash_new', methods: ['GET', 'POST'])] - public function newAction(Request $request) - { - return $this->itemCreate($request, 'previouslyownedflash/new.html.twig', 'previouslyOwnedFlash', 'previously-owned-flash_show'); - } + /** + * Finds and displays a previouslyOwnedFlash entity. + */ + #[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'); + } - /** - * Finds and displays a previouslyOwnedFlash entity. - */ - #[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'); - } - - /** - * Displays a form to edit an existing previouslyOwnedFlash entity. - */ - #[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'); - } + /** + * Displays a form to edit an existing previouslyOwnedFlash entity. + */ + #[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'); + } } diff --git a/src/Controller/PreviouslyOwnedLensesController.php b/src/Controller/PreviouslyOwnedLensesController.php index a718c1f..9e538c1 100644 --- a/src/Controller/PreviouslyOwnedLensesController.php +++ b/src/Controller/PreviouslyOwnedLensesController.php @@ -4,48 +4,55 @@ namespace App\Controller; use App\Entity\PreviouslyOwnedLenses; use App\Form\PreviouslyOwnedLensesType; +use Doctrine\Persistence\ManagerRegistry; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Annotation\Route; #[Route(path: 'previously-owned-lens')] class PreviouslyOwnedLensesController extends AbstractController { - use FormControllerTrait; - protected const ENTITY = PreviouslyOwnedLenses::class; + use FormControllerTrait; - protected const FORM = PreviouslyOwnedLensesType::class; + protected const ENTITY = PreviouslyOwnedLenses::class; + protected const FORM = PreviouslyOwnedLensesType::class; - /** - * Lists all previouslyOwnedLense entities. - */ - #[Route(path: '/', name: 'previously-owned-lens_index', methods: ['GET'])] - public function indexAction() - { - return $this->itemListView('previouslyownedlenses/index.html.twig', 'previouslyOwnedLenses', [ - 'brand' => 'ASC', - 'productLine' => 'ASC', - 'mount' => 'ASC', - 'minFocalLength' => 'ASC', - 'maxFStop' => 'ASC', - ]); - } + public function __construct(private readonly ManagerRegistry $managerRegistry) + { + } - /** - * Finds and displays a previouslyOwnedLense entity. - */ - #[Route(path: '/{id}', name: 'previously-owned-lens_show', methods: ['GET'])] - public function showAction(PreviouslyOwnedLenses $previouslyOwnedLens) - { - return $this->itemView($previouslyOwnedLens, 'previouslyownedlenses/show.html.twig', 'previouslyOwnedLense'); - } + /** + * Lists all previouslyOwnedLense entities. + */ + #[Route(path: '/', name: 'previously-owned-lens_index', methods: ['GET'])] + public function indexAction(): Response + { + return $this->itemListView('previouslyownedlenses/index.html.twig', 'previouslyOwnedLenses', [ + 'brand' => 'ASC', + 'productLine' => 'ASC', + 'mount' => 'ASC', + 'minFocalLength' => 'ASC', + 'maxFStop' => 'ASC', + ]); + } - /** - * Displays a form to edit an existing previouslyOwnedLense entity. - */ - #[Route(path: '/{id}/edit', name: 'previously-owned-lens_edit', methods: ['GET', 'POST'])] - public function editAction(Request $request, PreviouslyOwnedLenses $previouslyOwnedLens) - { - return $this->itemUpdate($request, $previouslyOwnedLens, 'previouslyownedlenses/edit.html.twig', 'previouslyOwnedLense', 'previously-owned-lens_show'); - } + /** + * Finds and displays a previouslyOwnedLense entity. + */ + #[Route(path: '/{id}', name: 'previously-owned-lens_show', methods: ['GET'])] + public function showAction(PreviouslyOwnedLenses $previouslyOwnedLens): Response + { + return $this->itemView($previouslyOwnedLens, 'previouslyownedlenses/show.html.twig', 'previouslyOwnedLense'); + } + + /** + * Displays a form to edit an existing previouslyOwnedLense entity. + */ + #[Route(path: '/{id}/edit', name: 'previously-owned-lens_edit', methods: ['GET', 'POST'])] + public function editAction(Request $request, PreviouslyOwnedLenses $previouslyOwnedLens): RedirectResponse|Response + { + return $this->itemUpdate($request, $previouslyOwnedLens, 'previouslyownedlenses/edit.html.twig', 'previouslyOwnedLense', 'previously-owned-lens_show'); + } } diff --git a/src/Entity/BatteryType.php b/src/Entity/BatteryType.php index 08d4aad..a3f98e6 100644 --- a/src/Entity/BatteryType.php +++ b/src/Entity/BatteryType.php @@ -11,8 +11,8 @@ use Doctrine\ORM\Mapping as ORM; #[ORM\Entity] class BatteryType { - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] - #[ORM\Id] - #[ORM\GeneratedValue(strategy: 'IDENTITY')] - private int $id; + #[ORM\Column(name: 'id', type: 'integer', nullable: false)] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] + private int $id; } diff --git a/src/Entity/Camera.php b/src/Entity/Camera.php index 29ab7d9..a1d9ef3 100644 --- a/src/Entity/Camera.php +++ b/src/Entity/Camera.php @@ -13,10 +13,11 @@ use Doctrine\ORM\Mapping as ORM; #[ORM\Entity(repositoryClass: CameraRepository::class)] class Camera { - use CameraTrait; - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] - #[ORM\Id] - #[ORM\GeneratedValue(strategy: 'IDENTITY')] - #[ORM\SequenceGenerator(sequenceName: 'camera__id_seq', allocationSize: 1, initialValue: 1)] - private int $id; + use CameraTrait; + + #[ORM\Column(name: 'id', type: 'integer', nullable: false)] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] + #[ORM\SequenceGenerator(sequenceName: 'camera__id_seq', allocationSize: 1, initialValue: 1)] + private int $id; } diff --git a/src/Entity/CameraTrait.php b/src/Entity/CameraTrait.php index ccc3cce..d91966f 100644 --- a/src/Entity/CameraTrait.php +++ b/src/Entity/CameraTrait.php @@ -8,211 +8,209 @@ use Doctrine\ORM\Mapping as ORM; * Trait CameraTrait * * Shared columns for camera, and previously_owned_camera tables - * - * @package App\Entity */ trait CameraTrait { - use PurchasePriceTrait; + use PurchasePriceTrait; - #[ORM\ManyToOne(targetEntity: 'CameraType')] - #[ORM\JoinColumn(name: 'type_id', referencedColumnName: 'id', nullable: false)] - private readonly CameraType $type; + #[ORM\ManyToOne(targetEntity: 'CameraType')] + #[ORM\JoinColumn(name: 'type_id', referencedColumnName: 'id', nullable: false)] + private readonly CameraType $type; - #[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: false)] - private readonly string $brand; + #[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: false)] + private readonly string $brand; - #[ORM\Column(name: 'mount', type: 'string', length: 32, nullable: false)] - private readonly string $mount; + #[ORM\Column(name: 'mount', type: 'string', length: 32, nullable: false)] + private readonly string $mount; - #[ORM\Column(name: 'model', type: 'string', length: 255, nullable: false)] - private readonly string $model; + #[ORM\Column(name: 'model', type: 'string', length: 255, nullable: false)] + private readonly string $model; - #[ORM\Column(name: 'is_digital', type: 'boolean', nullable: false)] - private readonly bool $isDigital; + #[ORM\Column(name: 'is_digital', type: 'boolean', nullable: false)] + private readonly bool $isDigital; - #[ORM\Column(name: 'crop_factor', type: 'decimal', precision: 10, scale: 0, nullable: false)] - private string $cropFactor = '1.0'; + #[ORM\Column(name: 'crop_factor', type: 'decimal', precision: 10, scale: 0, nullable: false)] + private string $cropFactor = '1.0'; - #[ORM\Column(name: 'is_working', type: 'boolean', nullable: false)] - private readonly bool $isWorking; + #[ORM\Column(name: 'is_working', type: 'boolean', nullable: false)] + private readonly bool $isWorking; - #[ORM\Column(name: 'notes', type: 'text', nullable: true)] - private readonly ?string $notes; + #[ORM\Column(name: 'notes', type: 'text', nullable: true)] + private readonly ?string $notes; - #[ORM\Column(name: 'serial', type: 'string', length: 20, nullable: false)] - private readonly string $serial; + #[ORM\Column(name: 'serial', type: 'string', length: 20, nullable: false)] + private readonly string $serial; - #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false)] - private bool $formerlyOwned = FALSE; + #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false)] + private bool $formerlyOwned = false; - #[ORM\Column(name: 'battery_type', type: 'string', nullable: true)] - private readonly ?string $batteryType; + #[ORM\Column(name: 'battery_type', type: 'string', nullable: true)] + private readonly ?string $batteryType; - #[ORM\Column(name: 'film_format', type: 'string', nullable: true)] - private ?string $filmFormat = '135'; + #[ORM\Column(name: 'film_format', type: 'string', nullable: true)] + private ?string $filmFormat = '135'; - #[ORM\Column(name: 'received', type: 'boolean', nullable: true)] - private ?bool $received = FALSE; + #[ORM\Column(name: 'received', type: 'boolean', nullable: true)] + private ?bool $received = false; - public function getId(): int - { - return $this->id; - } + public function getId(): int + { + return $this->id; + } - public function setType(CameraType $type = null): self - { - $this->type = $type; + public function setType(?CameraType $type = null): self + { + $this->type = $type; - return $this; - } + return $this; + } - public function getType(): CameraType - { - return $this->type; - } + public function getType(): CameraType + { + return $this->type; + } - public function setBrand(string $brand): self - { - $this->brand = $brand; + public function setBrand(string $brand): self + { + $this->brand = $brand; - return $this; - } + return $this; + } - public function getBrand(): string - { - return $this->brand; - } + public function getBrand(): string + { + return $this->brand; + } - public function setMount(string $mount): self - { - $this->mount = $mount; + public function setMount(string $mount): self + { + $this->mount = $mount; - return $this; - } + return $this; + } - public function getMount(): string - { - return $this->mount; - } + public function getMount(): string + { + return $this->mount; + } - public function setModel(string $model): self - { - $this->model = $model; + public function setModel(string $model): self + { + $this->model = $model; - return $this; - } + return $this; + } - public function getModel(): string - { - return $this->model; - } + public function getModel(): string + { + return $this->model; + } - public function setIsDigital(bool $isDigital): self - { - $this->isDigital = $isDigital; + public function setIsDigital(bool $isDigital): self + { + $this->isDigital = $isDigital; - return $this; - } + return $this; + } - public function getIsDigital(): bool - { - return $this->isDigital; - } + public function getIsDigital(): bool + { + return $this->isDigital; + } - public function setCropFactor(string $cropFactor): self - { - $this->cropFactor = $cropFactor; + public function setCropFactor(string $cropFactor): self + { + $this->cropFactor = $cropFactor; - return $this; - } + return $this; + } - public function getCropFactor(): string - { - return $this->cropFactor; - } + public function getCropFactor(): string + { + return $this->cropFactor; + } - public function setIsWorking(bool $isWorking): self - { - $this->isWorking = $isWorking; + public function setIsWorking(bool $isWorking): self + { + $this->isWorking = $isWorking; - return $this; - } + return $this; + } - public function getIsWorking(): bool - { - return $this->isWorking; - } + public function getIsWorking(): bool + { + return $this->isWorking; + } - public function setNotes(string $notes): self - { - $this->notes = $notes; + public function setNotes(string $notes): self + { + $this->notes = $notes; - return $this; - } + return $this; + } - public function getNotes(): string - { - return $this->notes ?? ''; - } + public function getNotes(): string + { + return $this->notes ?? ''; + } - public function setSerial(string $serial): self - { - $this->serial = $serial; + public function setSerial(string $serial): self + { + $this->serial = $serial; - return $this; - } + return $this; + } - public function getSerial(): string - { - return $this->serial ?? ''; - } + public function getSerial(): string + { + return $this->serial ?? ''; + } - public function setFormerlyOwned(bool $formerlyOwned): self - { - $this->formerlyOwned = $formerlyOwned; + public function setFormerlyOwned(bool $formerlyOwned): self + { + $this->formerlyOwned = $formerlyOwned; - return $this; - } + return $this; + } - public function getFormerlyOwned(): bool - { - return $this->formerlyOwned; - } + public function getFormerlyOwned(): bool + { + return $this->formerlyOwned; + } - public function setBatteryType(string $batteryType): self - { - $this->batteryType = $batteryType; + public function setBatteryType(string $batteryType): self + { + $this->batteryType = $batteryType; - return $this; - } + return $this; + } - public function getBatteryType(): string - { - return $this->batteryType ?? ''; - } + public function getBatteryType(): string + { + return $this->batteryType ?? ''; + } - public function setFilmFormat(string $filmFormat): self - { - $this->filmFormat = $filmFormat; + public function setFilmFormat(string $filmFormat): self + { + $this->filmFormat = $filmFormat; - return $this; - } + return $this; + } - public function getFilmFormat(): string - { - return $this->filmFormat ?? ''; - } + public function getFilmFormat(): string + { + return $this->filmFormat ?? ''; + } - public function setReceived(bool $received): self - { - $this->received = $received; + public function setReceived(bool $received): self + { + $this->received = $received; - return $this; - } + return $this; + } - public function getReceived(): bool - { - return $this->received; - } + public function getReceived(): bool + { + return $this->received; + } } diff --git a/src/Entity/CameraType.php b/src/Entity/CameraType.php index 0559900..8bd7061 100644 --- a/src/Entity/CameraType.php +++ b/src/Entity/CameraType.php @@ -2,8 +2,8 @@ namespace App\Entity; -use Stringable; use Doctrine\ORM\Mapping as ORM; +use Stringable; /** * CameraType @@ -12,75 +12,71 @@ use Doctrine\ORM\Mapping as ORM; #[ORM\Entity] class CameraType implements Stringable { - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] - #[ORM\Id] - #[ORM\GeneratedValue(strategy: 'IDENTITY')] - #[ORM\SequenceGenerator(sequenceName: 'camera.camera_type_id_seq', allocationSize: 1, initialValue: 1)] - private int $id; + #[ORM\Column(name: 'id', type: 'integer', nullable: false)] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] + #[ORM\SequenceGenerator(sequenceName: 'camera.camera_type_id_seq', allocationSize: 1, initialValue: 1)] + private int $id; - #[ORM\Column(name: 'type', type: 'string', length: 255, nullable: false)] - private string $type; + #[ORM\Column(name: 'type', type: 'string', length: 255, nullable: false)] + private string $type; - #[ORM\Column(name: 'description', type: 'text', nullable: true)] - private ?string $description = null; + #[ORM\Column(name: 'description', type: 'text', nullable: true)] + private ?string $description = null; - /** - * Value for serialization - */ - public function __toString(): string - { - return $this->type; - } + /** + * Value for serialization + */ + public function __toString(): string + { + return $this->type; + } - /** - * Get id - */ - public function getId(): int - { - return $this->id; - } + /** + * Get id + */ + public function getId(): int + { + return $this->id; + } - /** - * Set type - * - * - */ - public function setType(string $type): self - { - $this->type = $type; + /** + * Set type + */ + public function setType(string $type): self + { + $this->type = $type; - return $this; - } + return $this; + } - /** - * Set description - * - * - */ - public function setDescription(string $description): self - { - $this->description = $description; + /** + * Set description + */ + public function setDescription(string $description): self + { + $this->description = $description; - return $this; - } + return $this; + } - /** - * Get type - * - * @return string - */ - public function getType(): ?string - { - return $this->type; - } + /** + * Get type + * + * @return string + */ + public function getType(): ?string + { + return $this->type; + } - /** - * Get description - * - * @return string - */ - public function getDescription(): ?string - { - return $this->description; - } + /** + * Get description + * + * @return string + */ + public function getDescription(): ?string + { + return $this->description; + } } diff --git a/src/Entity/Film.php b/src/Entity/Film.php index 46e4164..ccbd148 100644 --- a/src/Entity/Film.php +++ b/src/Entity/Film.php @@ -11,237 +11,250 @@ use Doctrine\ORM\Mapping as ORM; #[ORM\Entity] class Film { - #[ORM\Id] - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] - #[ORM\GeneratedValue(strategy: 'IDENTITY')] - private int $id; + #[ORM\Id] + #[ORM\Column(name: 'id', type: 'integer', nullable: false)] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] + private int $id; - #[ORM\Column(name: 'brand', type: 'string', nullable: false)] - private string $brand; + #[ORM\Column(name: 'brand', type: 'string', nullable: false)] + private string $brand; - #[ORM\Column(name: 'product_line', type: 'string', nullable: true)] - private ?string $productLine = null; + #[ORM\Column(name: 'product_line', type: 'string', nullable: true)] + private ?string $productLine = null; - #[ORM\Column(name: 'film_name', type: 'string', nullable: false)] - private string $filmName; + #[ORM\Column(name: 'film_name', type: 'string', nullable: false)] + private string $filmName; - #[ORM\Column(name: 'film_alias', type: 'string', nullable: true)] - private ?string $filmAlias = null; + #[ORM\Column(name: 'film_alias', type: 'string', nullable: true)] + private ?string $filmAlias = null; - #[ORM\Column(name: 'film_speed_asa', type: 'integer', nullable: false)] - private int $filmSpeedAsa; + #[ORM\Column(name: 'film_speed_asa', type: 'integer', nullable: false)] + private int $filmSpeedAsa; - #[ORM\Column(name: 'film_speed_din', type: 'integer', nullable: false)] - private int $filmSpeedDin; + #[ORM\Column(name: 'film_speed_din', type: 'integer', nullable: false)] + private int $filmSpeedDin; - #[ORM\Column(name: 'film_format', type: 'string', nullable: false)] - private string $filmFormat; + #[ORM\Column(name: 'film_format', type: 'string', nullable: false)] + private string $filmFormat; - #[ORM\Column(name: 'film_base', type: 'string', nullable: false, options: ['default' => 'Cellulose Triacetate'])] - private string $filmBase = 'Cellulose Triacetate'; + #[ORM\Column(name: 'film_base', type: 'string', nullable: false, options: ['default' => 'Cellulose Triacetate'])] + private string $filmBase = 'Cellulose Triacetate'; - #[ORM\Column(name: 'unused_rolls', type: 'integer', nullable: false, options: ['default' => 0])] - private int $unusedRolls = 0; + #[ORM\Column(name: 'unused_rolls', type: 'integer', nullable: false, options: ['default' => 0])] + private int $unusedRolls = 0; - #[ORM\Column(name: 'rolls_in_camera', type: 'integer', nullable: false, options: ['default' => 0])] - private int $rollsInCamera = 0; + #[ORM\Column(name: 'rolls_in_camera', type: 'integer', nullable: false, options: ['default' => 0])] + private int $rollsInCamera = 0; - #[ORM\Column(name: 'developed_rolls', type: 'integer', nullable: false, options: ['default' => 0])] - private int $developedRolls = 0; + #[ORM\Column(name: 'developed_rolls', type: 'integer', nullable: false, options: ['default' => 0])] + private int $developedRolls = 0; - #[ORM\Column(name: 'chemistry', type: 'string', nullable: false, options: ['default' => 'C-41'])] - private string $chemistry = 'C-41'; + #[ORM\Column(name: 'chemistry', type: 'string', nullable: false, options: ['default' => 'C-41'])] + private string $chemistry = 'C-41'; - #[ORM\Column(name: 'notes', type: 'text', nullable: true)] - private ?string $notes = null; + #[ORM\Column(name: 'notes', type: 'text', nullable: true)] + private ?string $notes = null; - public function getId(): int - { - return $this->id; - } + public function getId(): int + { + return $this->id; + } - /** - * @return string - */ - public function getBrand(): ?string - { - return $this->brand; - } + /** + * @return string + */ + public function getBrand(): ?string + { + return $this->brand; + } - public function setBrand(string $brand): self - { - $this->brand = $brand; - return $this; - } + public function setBrand(string $brand): self + { + $this->brand = $brand; - /** - * @return string - */ - public function getProductLine(): ?string - { - return $this->productLine; - } + return $this; + } - /** - * @param string $productLine - */ - public function setProductLine(?string $productLine): self - { - $this->productLine = $productLine; - return $this; - } + /** + * @return string + */ + public function getProductLine(): ?string + { + return $this->productLine; + } - /** - * @return string - */ - public function getFilmName(): ?string - { - return $this->filmName; - } + /** + * @param string $productLine + */ + public function setProductLine(?string $productLine): self + { + $this->productLine = $productLine; - public function setFilmName(string $filmName): self - { - $this->filmName = $filmName; - return $this; - } + return $this; + } - /** - * @return string - */ - public function getFilmAlias(): ?string - { - return $this->filmAlias; - } + /** + * @return string + */ + public function getFilmName(): ?string + { + return $this->filmName; + } - public function setFilmAlias(string $filmAlias): self - { - $this->filmAlias = $filmAlias; - return $this; - } + public function setFilmName(string $filmName): self + { + $this->filmName = $filmName; - /** - * @return int - */ - public function getFilmSpeedAsa(): ?int - { - return $this->filmSpeedAsa; - } + return $this; + } - public function setFilmSpeedAsa(int $filmSpeedAsa): self - { - $this->filmSpeedAsa = $filmSpeedAsa; - return $this; - } + /** + * @return string + */ + public function getFilmAlias(): ?string + { + return $this->filmAlias; + } - /** - * @return int - */ - public function getFilmSpeedDin(): ?int - { - return $this->filmSpeedDin; - } + public function setFilmAlias(string $filmAlias): self + { + $this->filmAlias = $filmAlias; - public function setFilmSpeedDin(int $filmSpeedDin): self - { - $this->filmSpeedDin = $filmSpeedDin; - return $this; - } + return $this; + } - /** - * @return string - */ - public function getFilmFormat(): ?string - { - return $this->filmFormat; - } + /** + * @return int + */ + public function getFilmSpeedAsa(): ?int + { + return $this->filmSpeedAsa; + } - public function setFilmFormat(string $filmFormat): self - { - $this->filmFormat = $filmFormat; - return $this; - } + public function setFilmSpeedAsa(int $filmSpeedAsa): self + { + $this->filmSpeedAsa = $filmSpeedAsa; - /** - * @return string - */ - public function getFilmBase(): ?string - { - return $this->filmBase; - } + return $this; + } - public function setFilmBase(string $filmBase): self - { - $this->filmBase = $filmBase; - return $this; - } + /** + * @return int + */ + public function getFilmSpeedDin(): ?int + { + return $this->filmSpeedDin; + } - /** - * @return int - */ - public function getUnusedRolls(): ?int - { - return $this->unusedRolls; - } + public function setFilmSpeedDin(int $filmSpeedDin): self + { + $this->filmSpeedDin = $filmSpeedDin; - public function setUnusedRolls(int $unusedRolls): self - { - $this->unusedRolls = $unusedRolls; - return $this; - } + return $this; + } - /** - * @return int - */ - public function getRollsInCamera(): ?int - { - return $this->rollsInCamera; - } + /** + * @return string + */ + public function getFilmFormat(): ?string + { + return $this->filmFormat; + } - public function setRollsInCamera(int $rollsInCamera): self - { - $this->rollsInCamera = $rollsInCamera; - return $this; - } + public function setFilmFormat(string $filmFormat): self + { + $this->filmFormat = $filmFormat; - /** - * @return int - */ - public function getDevelopedRolls(): ?int - { - return $this->developedRolls; - } + return $this; + } - public function setDevelopedRolls(int $developedRolls): self - { - $this->developedRolls = $developedRolls; - return $this; - } + /** + * @return string + */ + public function getFilmBase(): ?string + { + return $this->filmBase; + } - /** - * @return string - */ - public function getChemistry(): ?string - { - return $this->chemistry; - } + public function setFilmBase(string $filmBase): self + { + $this->filmBase = $filmBase; - public function setChemistry(string $chemistry): self - { - $this->chemistry = $chemistry; - return $this; - } + return $this; + } - /** - * @return string - */ - public function getNotes(): ?string - { - return $this->notes; - } + /** + * @return int + */ + public function getUnusedRolls(): ?int + { + return $this->unusedRolls; + } - public function setNotes(string $notes): self - { - $this->notes = $notes; - return $this; - } + public function setUnusedRolls(int $unusedRolls): self + { + $this->unusedRolls = $unusedRolls; + + return $this; + } + + /** + * @return int + */ + public function getRollsInCamera(): ?int + { + return $this->rollsInCamera; + } + + public function setRollsInCamera(int $rollsInCamera): self + { + $this->rollsInCamera = $rollsInCamera; + + return $this; + } + + /** + * @return int + */ + public function getDevelopedRolls(): ?int + { + return $this->developedRolls; + } + + public function setDevelopedRolls(int $developedRolls): self + { + $this->developedRolls = $developedRolls; + + return $this; + } + + /** + * @return string + */ + public function getChemistry(): ?string + { + return $this->chemistry; + } + + public function setChemistry(string $chemistry): self + { + $this->chemistry = $chemistry; + + return $this; + } + + /** + * @return string + */ + public function getNotes(): ?string + { + return $this->notes; + } + + public function setNotes(string $notes): self + { + $this->notes = $notes; + + return $this; + } } diff --git a/src/Entity/FilmFormat.php b/src/Entity/FilmFormat.php index 41a1e49..a1ee755 100644 --- a/src/Entity/FilmFormat.php +++ b/src/Entity/FilmFormat.php @@ -8,50 +8,52 @@ use Doctrine\ORM\Mapping as ORM; #[ORM\Entity] class FilmFormat { - #[ORM\Id] - #[ORM\GeneratedValue] - #[ORM\Column(type: 'integer')] - private int $id; + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: 'integer')] + private int $id; - #[ORM\Column(name: 'number_id', type: 'integer')] - private int $numberId; + #[ORM\Column(name: 'number_id', type: 'integer')] + private int $numberId; - #[ORM\Column(name: 'name', type: 'string')] - private string $name; + #[ORM\Column(name: 'name', type: 'string')] + private string $name; - /** - * @return int - */ - public function getId(): ?int - { - return $this->id; - } + /** + * @return int + */ + public function getId(): ?int + { + return $this->id; + } - /** - * @return int - */ - public function getNumberId(): ?int - { - return $this->numberId; - } + /** + * @return int + */ + public function getNumberId(): ?int + { + return $this->numberId; + } - public function setNumberId(int $numberId): self - { - $this->numberId = $numberId; - return $this; - } + public function setNumberId(int $numberId): self + { + $this->numberId = $numberId; - /** - * @return string - */ - public function getName(): ?string - { - return $this->name; - } + return $this; + } - public function setName(string $name): self - { - $this->name = $name; - return $this; - } + /** + * @return string + */ + public function getName(): ?string + { + return $this->name; + } + + public function setName(string $name): self + { + $this->name = $name; + + return $this; + } } diff --git a/src/Entity/Flash.php b/src/Entity/Flash.php index c33eed5..7ba42ca 100644 --- a/src/Entity/Flash.php +++ b/src/Entity/Flash.php @@ -11,16 +11,17 @@ use Doctrine\ORM\Mapping as ORM; #[ORM\Entity] class Flash { - use FlashTrait; - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] - #[ORM\Id] - #[ORM\GeneratedValue(strategy: 'IDENTITY')] - #[ORM\SequenceGenerator(sequenceName: 'camera.flash_id_seq', allocationSize: 1, initialValue: 1)] - private int $id; + use FlashTrait; - #[ORM\Column(name: 'received', type: 'boolean', nullable: false, options: ['default' => false])] - private bool $received = false; + #[ORM\Column(name: 'id', type: 'integer', nullable: false)] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] + #[ORM\SequenceGenerator(sequenceName: 'camera.flash_id_seq', allocationSize: 1, initialValue: 1)] + private int $id; - #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false, options: ['default' => false])] - private bool $formerlyOwned = false; + #[ORM\Column(name: 'received', type: 'boolean', nullable: false, options: ['default' => false])] + private bool $received = false; + + #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false, options: ['default' => false])] + private bool $formerlyOwned = false; } diff --git a/src/Entity/FlashTrait.php b/src/Entity/FlashTrait.php index 7b93228..2cfd875 100644 --- a/src/Entity/FlashTrait.php +++ b/src/Entity/FlashTrait.php @@ -6,351 +6,349 @@ use Doctrine\ORM\Mapping as ORM; trait FlashTrait { - use PurchasePriceTrait; + use PurchasePriceTrait; - #[ORM\Column(name: 'brand', type: 'string', nullable: false)] - private readonly string $brand; + #[ORM\Column(name: 'brand', type: 'string', nullable: false)] + private readonly string $brand; - #[ORM\Column(name: 'model', type: 'string', nullable: false)] - private readonly string $model; + #[ORM\Column(name: 'model', type: 'string', nullable: false)] + private readonly string $model; - #[ORM\Column(name: 'is_auto_flash', type: 'boolean', nullable: false)] - private bool $isAutoFlash = false; + #[ORM\Column(name: 'is_auto_flash', type: 'boolean', nullable: false)] + private bool $isAutoFlash = false; - #[ORM\Column(name: 'is_ttl', type: 'boolean', nullable: false)] - private bool $isTtl = false; + #[ORM\Column(name: 'is_ttl', type: 'boolean', nullable: false)] + private bool $isTtl = false; - #[ORM\Column(name: 'ttl_type', type: 'string', nullable: false)] - private string $ttlType = 'N / A'; + #[ORM\Column(name: 'ttl_type', type: 'string', nullable: false)] + private string $ttlType = 'N / A'; - #[ORM\Column(name: 'is_p_ttl', type: 'boolean', nullable: false)] - private bool $isPTtl = false; + #[ORM\Column(name: 'is_p_ttl', type: 'boolean', nullable: false)] + private bool $isPTtl = false; - #[ORM\Column(name: 'p_ttl_type', type: 'string', nullable: false)] - private string $pTtlType = 'N / A'; + #[ORM\Column(name: 'p_ttl_type', type: 'string', nullable: false)] + private string $pTtlType = 'N / A'; - #[ORM\Column(name: 'guide_number', type: 'string', nullable: true)] - private ?string $guideNumber = ''; + #[ORM\Column(name: 'guide_number', type: 'string', nullable: true)] + private ?string $guideNumber = ''; - #[ORM\Column(name: 'batteries', type: 'string', nullable: false)] - private string $batteries = '4x AA'; + #[ORM\Column(name: 'batteries', type: 'string', nullable: false)] + private string $batteries = '4x AA'; - #[ORM\Column(name: 'notes', type: 'text', nullable: true)] - private readonly ?string $notes; + #[ORM\Column(name: 'notes', type: 'text', nullable: true)] + private readonly ?string $notes; - #[ORM\Column(name: 'serial', type: 'string', nullable: true)] - private readonly ?string $serial; + #[ORM\Column(name: 'serial', type: 'string', nullable: true)] + private readonly ?string $serial; - public function getId(): int - { - return $this->id; - } + public function getId(): int + { + return $this->id; + } - /** - * Set brand - * - * - */ - public function setBrand(string $brand): self - { - $this->brand = $brand; + /** + * Set brand + */ + public function setBrand(string $brand): self + { + $this->brand = $brand; - return $this; - } + return $this; + } - /** - * Get brand - * - * @return string - */ - public function getBrand() - { - return $this->brand; - } + /** + * Get brand + * + * @return string + */ + public function getBrand() + { + return $this->brand; + } - /** - * Set model - * - * @param string $model - * - * @return Flash - */ - public function setModel($model) - { - $this->model = $model; + /** + * Set model + * + * @param string $model + * + * @return Flash + */ + public function setModel($model) + { + $this->model = $model; - return $this; - } + return $this; + } - /** - * Get model - * - * @return string - */ - public function getModel() - { - return $this->model; - } + /** + * Get model + * + * @return string + */ + public function getModel() + { + return $this->model; + } - /** - * Set isAutoFlash - * - * @param boolean $isAutoFlash - * - * @return Flash - */ - public function setIsAutoFlash($isAutoFlash) - { - $this->isAutoFlash = $isAutoFlash; + /** + * Set isAutoFlash + * + * @param bool $isAutoFlash + * + * @return Flash + */ + public function setIsAutoFlash($isAutoFlash) + { + $this->isAutoFlash = $isAutoFlash; - return $this; - } + return $this; + } - /** - * Get isAutoFlash - * - * @return boolean - */ - public function getIsAutoFlash() - { - return $this->isAutoFlash; - } + /** + * Get isAutoFlash + * + * @return bool + */ + public function getIsAutoFlash() + { + return $this->isAutoFlash; + } - /** - * Set isTtl - * - * @param boolean $isTtl - * - * @return Flash - */ - public function setIsTtl($isTtl) - { - $this->isTtl = $isTtl; + /** + * Set isTtl + * + * @param bool $isTtl + * + * @return Flash + */ + public function setIsTtl($isTtl) + { + $this->isTtl = $isTtl; - return $this; - } + return $this; + } - /** - * Get isTtl - * - * @return boolean - */ - public function getIsTtl() - { - return $this->isTtl; - } + /** + * Get isTtl + * + * @return bool + */ + public function getIsTtl() + { + return $this->isTtl; + } - /** - * Set ttlType - * - * @param string $ttlType - * - * @return Flash - */ - public function setTtlType($ttlType) - { - $this->ttlType = $ttlType; + /** + * Set ttlType + * + * @param string $ttlType + * + * @return Flash + */ + public function setTtlType($ttlType) + { + $this->ttlType = $ttlType; - return $this; - } + return $this; + } - /** - * Get ttlType - * - * @return string - */ - public function getTtlType() - { - return $this->ttlType; - } + /** + * Get ttlType + * + * @return string + */ + public function getTtlType() + { + return $this->ttlType; + } - /** - * Set isPTtl - * - * @param boolean $isPTtl - * - * @return Flash - */ - public function setIsPTtl($isPTtl) - { - $this->isPTtl = $isPTtl; + /** + * Set isPTtl + * + * @param bool $isPTtl + * + * @return Flash + */ + public function setIsPTtl($isPTtl) + { + $this->isPTtl = $isPTtl; - return $this; - } + return $this; + } - /** - * Get isPTtl - * - * @return boolean - */ - public function getIsPTtl() - { - return $this->isPTtl; - } + /** + * Get isPTtl + * + * @return bool + */ + public function getIsPTtl() + { + return $this->isPTtl; + } - /** - * Set pTtlType - * - * @param string $pTtlType - */ - public function setPTtlType($pTtlType): self - { - $this->pTtlType = $pTtlType; + /** + * Set pTtlType + * + * @param string $pTtlType + */ + public function setPTtlType($pTtlType): self + { + $this->pTtlType = $pTtlType; - return $this; - } + return $this; + } - /** - * Get pTtlType - * - * @return string - */ - public function getPTtlType() - { - return $this->pTtlType; - } + /** + * Get pTtlType + * + * @return string + */ + public function getPTtlType() + { + return $this->pTtlType; + } - /** - * Set guideNumber - * - * @param string $guideNumber - * - * @return self - */ - public function setGuideNumber($guideNumber) - { - $this->guideNumber = $guideNumber; + /** + * Set guideNumber + * + * @param string $guideNumber + * + * @return self + */ + public function setGuideNumber($guideNumber) + { + $this->guideNumber = $guideNumber; - return $this; - } + return $this; + } - /** - * Get guideNumber - * - * @return string - */ - public function getGuideNumber() - { - return $this->guideNumber; - } + /** + * Get guideNumber + * + * @return string + */ + public function getGuideNumber() + { + return $this->guideNumber; + } - /** - * Set batteries - * - * @param string $batteries - * - * @return Flash - */ - public function setBatteries($batteries): self - { - $this->batteries = $batteries; + /** + * Set batteries + * + * @param string $batteries + * + * @return Flash + */ + public function setBatteries($batteries): self + { + $this->batteries = $batteries; - return $this; - } + return $this; + } - /** - * Get batteries - * - * @return string - */ - public function getBatteries() - { - return $this->batteries; - } + /** + * Get batteries + * + * @return string + */ + public function getBatteries() + { + return $this->batteries; + } - /** - * Set notes - * - * @param string $notes - * - * @return Flash - */ - public function setNotes($notes): self - { - $this->notes = $notes; + /** + * Set notes + * + * @param string $notes + * + * @return Flash + */ + public function setNotes($notes): self + { + $this->notes = $notes; - return $this; - } + return $this; + } - /** - * Get notes - * - * @return string - */ - public function getNotes() - { - return $this->notes; - } + /** + * Get notes + * + * @return string + */ + public function getNotes() + { + return $this->notes; + } - /** - * Set serial - * - * @param string $serial - * - * @return Flash - */ - public function setSerial($serial): self - { - $this->serial = $serial; + /** + * Set serial + * + * @param string $serial + * + * @return Flash + */ + public function setSerial($serial): self + { + $this->serial = $serial; - return $this; - } + return $this; + } - /** - * Get serial - * - * @return string - */ - public function getSerial() - { - return $this->serial; - } + /** + * Get serial + * + * @return string + */ + public function getSerial() + { + return $this->serial; + } - /** - * Set formerlyOwned - * - * @param boolean $formerlyOwned - * - * @return Flash - */ - public function setFormerlyOwned($formerlyOwned): self - { - $this->formerlyOwned = $formerlyOwned; + /** + * Set formerlyOwned + * + * @param bool $formerlyOwned + * + * @return Flash + */ + public function setFormerlyOwned($formerlyOwned): self + { + $this->formerlyOwned = $formerlyOwned; - return $this; - } + return $this; + } - /** - * Get formerlyOwned - * - * @return boolean - */ - public function getFormerlyOwned() - { - return $this->formerlyOwned; - } + /** + * Get formerlyOwned + * + * @return bool + */ + public function getFormerlyOwned() + { + return $this->formerlyOwned; + } - /** - * Set received - * - * @param boolean $received - * - * @return Flash - */ - public function setReceived($received): self - { - $this->received = $received; + /** + * Set received + * + * @param bool $received + * + * @return Flash + */ + public function setReceived($received): self + { + $this->received = $received; - return $this; - } + return $this; + } - /** - * Get received - * - * @return boolean - */ - public function getReceived() - { - return $this->received; - } + /** + * Get received + * + * @return bool + */ + public function getReceived() + { + return $this->received; + } } diff --git a/src/Entity/LensTrait.php b/src/Entity/LensTrait.php index e17cc3c..9a75fb5 100644 --- a/src/Entity/LensTrait.php +++ b/src/Entity/LensTrait.php @@ -6,499 +6,499 @@ use Doctrine\ORM\Mapping as ORM; trait LensTrait { - use PurchasePriceTrait; + use PurchasePriceTrait; - #[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: true)] - private readonly ?string $brand; - - #[ORM\Column(name: 'coatings', type: 'string', length: 64, nullable: true)] - private readonly ?string $coatings; - - #[ORM\Column(name: 'product_line', type: 'string', length: 64, nullable: true)] - private readonly ?string $productLine; - - #[ORM\Column(name: 'model', type: 'string', length: 64, nullable: true)] - private readonly ?string $model; - - #[ORM\Column(name: 'min_f_stop', type: 'string', length: 10, nullable: true)] - private readonly ?string $minFStop; - - #[ORM\Column(name: 'max_f_stop', type: 'float', precision: 10, scale: 0, nullable: true)] - private readonly ?float $maxFStop; - - #[ORM\Column(name: 'min_focal_length', type: 'integer', nullable: true)] - private readonly ?int $minFocalLength; - - #[ORM\Column(name: 'max_focal_length', type: 'integer', nullable: true)] - private readonly ?int $maxFocalLength; - - #[ORM\Column(name: 'serial', type: 'string', length: 10, nullable: true)] - private readonly ?string $serial; - - #[ORM\Column(name: 'notes', type: 'text', nullable: true)] - private readonly ?string $notes; - - #[ORM\Column(name: 'image_size', type: 'string', nullable: false, options: ['default' => '35mm'])] - private string $imageSize = '35mm'; - - #[ORM\Column(name: 'mount', type: 'string', length: 40, nullable: true)] - private readonly ?string $mount; - - #[ORM\Column(name: 'front_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: true)] - private readonly ?string $frontFilterSize; - - #[ORM\Column(name: 'rear_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: true)] - private readonly ? string $rearFilterSize; - - #[ORM\Column(name: 'is_teleconverter', type: 'boolean', nullable: false)] - private bool $isTeleconverter = false; - - #[ORM\Column(name: 'design_elements', type: 'smallint', nullable: true)] - private readonly ?int $designElements; - - #[ORM\Column(name: 'design_groups', type: 'smallint', nullable: true)] - private readonly ?int $designGroups; - - #[ORM\Column(name: 'aperture_blades', type: 'smallint', nullable: true)] - private readonly ?int $apertureBlades; - - - /** - * Get id - */ - public function getId(): int - { - return $this->id; - } - - /** - * Set brand - * - * @param string $brand - */ - public function setBrand($brand): self - { - $this->brand = $brand; - - return $this; - } - - /** - * Get brand - * - * @return string - */ - public function getBrand() - { - return $this->brand; - } - - /** - * Set coatings - * - * @param string $coatings - */ - public function setCoatings($coatings): self - { - $this->coatings = $coatings; - - return $this; - } - - /** - * Get coatings - * - * @return string - */ - public function getCoatings() - { - return $this->coatings; - } - - /** - * Set productLine - * - * @param string $productLine - */ - public function setProductLine($productLine): self - { - $this->productLine = $productLine; - - return $this; - } - - /** - * Get productLine - * - * @return string - */ - public function getProductLine() - { - return $this->productLine; - } - - /** - * Set model - * - * @param string $model - */ - public function setModel($model): self - { - $this->model = $model; - - return $this; - } - - /** - * Get model - * - * @return string - */ - public function getModel() - { - return $this->model; - } - - /** - * Set minFStop - * - * @param string $minFStop - */ - public function setMinFStop($minFStop): self - { - $this->minFStop = $minFStop; - - return $this; - } - - /** - * Get minFStop - * - * @return string - */ - public function getMinFStop() - { - return $this->minFStop; - } - - /** - * Set maxFStop - * - * @param float $maxFStop - */ - public function setMaxFStop($maxFStop): self - { - $this->maxFStop = $maxFStop; - - return $this; - } - - /** - * Get maxFStop - * - * @return float - */ - public function getMaxFStop() - { - return $this->maxFStop; - } - - /** - * Set minFocalLength - * - * @param integer $minFocalLength - */ - public function setMinFocalLength($minFocalLength): self - { - $this->minFocalLength = $minFocalLength; - - return $this; - } - - /** - * Get minFocalLength - * - * @return integer - */ - public function getMinFocalLength() - { - return $this->minFocalLength; - } - - /** - * Set maxFocalLength - * - * @param integer $maxFocalLength - */ - public function setMaxFocalLength($maxFocalLength): self - { - $this->maxFocalLength = $maxFocalLength; - - return $this; - } - - /** - * Get maxFocalLength - * - * @return integer - */ - public function getMaxFocalLength() - { - return $this->maxFocalLength; - } - - /** - * Set serial - * - * @param string $serial - */ - public function setSerial($serial): self - { - $this->serial = $serial; - - return $this; - } - - /** - * Get serial - */ - public function getSerial(): string - { - return $this->serial ?? ''; - } - - /** - * Set notes - * - * @param string $notes - */ - public function setNotes(?string $notes): self - { - $this->notes = $notes; - - return $this; - } - - /** - * Get notes - */ - public function getNotes(): string - { - return $this->notes ?? ''; - } - - /** - * Get image size - */ - public function getImageSize(): string - { - return $this->imageSize; - } - - /** - * Set image size - */ - public function setImageSize(string $imageSize): self - { - $this->imageSize = $imageSize; - return $this; - } - - /** - * Set mount - * - * @param string $mount - */ - public function setMount($mount): self - { - $this->mount = $mount; - - return $this; - } - - /** - * Get mount - * - * @return string - */ - public function getMount() - { - return $this->mount; - } - - /** - * Set received - * - * @param boolean $received - */ - public function setReceived($received): self - { - $this->received = $received; - - return $this; - } - - /** - * Get received - * - * @return boolean - */ - public function getReceived() - { - return $this->received; - } - - /** - * Set formerlyOwned - * - * @param boolean $formerlyOwned - */ - public function setFormerlyOwned($formerlyOwned): self - { - $this->formerlyOwned = $formerlyOwned; - - return $this; - } - - /** - * Get formerlyOwned - * - * @return boolean - */ - public function getFormerlyOwned() - { - return $this->formerlyOwned; - } - - /** - * Set frontFilterSize - * - * @param string $frontFilterSize - */ - public function setFrontFilterSize($frontFilterSize): self - { - $this->frontFilterSize = $frontFilterSize; - - return $this; - } - - /** - * Get frontFilterSize - * - * @return string - */ - public function getFrontFilterSize() - { - return $this->frontFilterSize; - } - - /** - * Set rearFilterSize - * - * @param string $rearFilterSize - */ - public function setRearFilterSize($rearFilterSize): self - { - $this->rearFilterSize = $rearFilterSize; - - return $this; - } - - /** - * Get rearFilterSize - * - * @return string - */ - public function getRearFilterSize() - { - return $this->rearFilterSize; - } - - /** - * Set isTeleconverter - * - * @param boolean $isTeleconverter - */ - public function setIsTeleconverter($isTeleconverter): self - { - $this->isTeleconverter = $isTeleconverter; - - return $this; - } - - /** - * Get isTeleconverter - * - * @return boolean - */ - public function getIsTeleconverter() - { - return $this->isTeleconverter; - } - - /** - * Set designElements - * - * @param integer $designElements - */ - public function setDesignElements($designElements): self - { - $this->designElements = $designElements; - - return $this; - } - - /** - * Get designElements - * - * @return integer - */ - public function getDesignElements() - { - return $this->designElements; - } - - /** - * Set designGroups - * - * @param integer $designGroups - */ - public function setDesignGroups($designGroups): self - { - $this->designGroups = $designGroups; - - return $this; - } - - /** - * Get designGroups - * - * @return integer - */ - public function getDesignGroups() - { - return $this->designGroups; - } - - /** - * Set apertureBlades - * - * @param integer $apertureBlades - */ - public function setApertureBlades($apertureBlades): self - { - $this->apertureBlades = $apertureBlades; - - return $this; - } - - /** - * Get apertureBlades - * - * @return integer - */ - public function getApertureBlades(): ?int - { - return $this->apertureBlades; - } + #[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: true)] + private readonly ?string $brand; + + #[ORM\Column(name: 'coatings', type: 'string', length: 64, nullable: true)] + private readonly ?string $coatings; + + #[ORM\Column(name: 'product_line', type: 'string', length: 64, nullable: true)] + private readonly ?string $productLine; + + #[ORM\Column(name: 'model', type: 'string', length: 64, nullable: true)] + private readonly ?string $model; + + #[ORM\Column(name: 'min_f_stop', type: 'string', length: 10, nullable: true)] + private readonly ?string $minFStop; + + #[ORM\Column(name: 'max_f_stop', type: 'float', precision: 10, scale: 0, nullable: true)] + private readonly ?float $maxFStop; + + #[ORM\Column(name: 'min_focal_length', type: 'integer', nullable: true)] + private readonly ?int $minFocalLength; + + #[ORM\Column(name: 'max_focal_length', type: 'integer', nullable: true)] + private readonly ?int $maxFocalLength; + + #[ORM\Column(name: 'serial', type: 'string', length: 10, nullable: true)] + private readonly ?string $serial; + + #[ORM\Column(name: 'notes', type: 'text', nullable: true)] + private readonly ?string $notes; + + #[ORM\Column(name: 'image_size', type: 'string', nullable: false, options: ['default' => '35mm'])] + private string $imageSize = '35mm'; + + #[ORM\Column(name: 'mount', type: 'string', length: 40, nullable: true)] + private readonly ?string $mount; + + #[ORM\Column(name: 'front_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: true)] + private readonly ?string $frontFilterSize; + + #[ORM\Column(name: 'rear_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: true)] + private readonly ?string $rearFilterSize; + + #[ORM\Column(name: 'is_teleconverter', type: 'boolean', nullable: false)] + private bool $isTeleconverter = false; + + #[ORM\Column(name: 'design_elements', type: 'smallint', nullable: true)] + private readonly ?int $designElements; + + #[ORM\Column(name: 'design_groups', type: 'smallint', nullable: true)] + private readonly ?int $designGroups; + + #[ORM\Column(name: 'aperture_blades', type: 'smallint', nullable: true)] + private readonly ?int $apertureBlades; + + /** + * Get id + */ + public function getId(): int + { + return $this->id; + } + + /** + * Set brand + * + * @param string $brand + */ + public function setBrand($brand): self + { + $this->brand = $brand; + + return $this; + } + + /** + * Get brand + * + * @return string + */ + public function getBrand() + { + return $this->brand; + } + + /** + * Set coatings + * + * @param string $coatings + */ + public function setCoatings($coatings): self + { + $this->coatings = $coatings; + + return $this; + } + + /** + * Get coatings + * + * @return string + */ + public function getCoatings() + { + return $this->coatings; + } + + /** + * Set productLine + * + * @param string $productLine + */ + public function setProductLine($productLine): self + { + $this->productLine = $productLine; + + return $this; + } + + /** + * Get productLine + * + * @return string + */ + public function getProductLine() + { + return $this->productLine; + } + + /** + * Set model + * + * @param string $model + */ + public function setModel($model): self + { + $this->model = $model; + + return $this; + } + + /** + * Get model + * + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Set minFStop + * + * @param string $minFStop + */ + public function setMinFStop($minFStop): self + { + $this->minFStop = $minFStop; + + return $this; + } + + /** + * Get minFStop + * + * @return string + */ + public function getMinFStop() + { + return $this->minFStop; + } + + /** + * Set maxFStop + * + * @param float $maxFStop + */ + public function setMaxFStop($maxFStop): self + { + $this->maxFStop = $maxFStop; + + return $this; + } + + /** + * Get maxFStop + * + * @return float + */ + public function getMaxFStop() + { + return $this->maxFStop; + } + + /** + * Set minFocalLength + * + * @param int $minFocalLength + */ + public function setMinFocalLength($minFocalLength): self + { + $this->minFocalLength = $minFocalLength; + + return $this; + } + + /** + * Get minFocalLength + * + * @return int + */ + public function getMinFocalLength() + { + return $this->minFocalLength; + } + + /** + * Set maxFocalLength + * + * @param int $maxFocalLength + */ + public function setMaxFocalLength($maxFocalLength): self + { + $this->maxFocalLength = $maxFocalLength; + + return $this; + } + + /** + * Get maxFocalLength + * + * @return int + */ + public function getMaxFocalLength() + { + return $this->maxFocalLength; + } + + /** + * Set serial + * + * @param string $serial + */ + public function setSerial($serial): self + { + $this->serial = $serial; + + return $this; + } + + /** + * Get serial + */ + public function getSerial(): string + { + return $this->serial ?? ''; + } + + /** + * Set notes + * + * @param string $notes + */ + public function setNotes(?string $notes): self + { + $this->notes = $notes; + + return $this; + } + + /** + * Get notes + */ + public function getNotes(): string + { + return $this->notes ?? ''; + } + + /** + * Get image size + */ + public function getImageSize(): string + { + return $this->imageSize; + } + + /** + * Set image size + */ + public function setImageSize(string $imageSize): self + { + $this->imageSize = $imageSize; + + return $this; + } + + /** + * Set mount + * + * @param string $mount + */ + public function setMount($mount): self + { + $this->mount = $mount; + + return $this; + } + + /** + * Get mount + * + * @return string + */ + public function getMount() + { + return $this->mount; + } + + /** + * Set received + * + * @param bool $received + */ + public function setReceived($received): self + { + $this->received = $received; + + return $this; + } + + /** + * Get received + * + * @return bool + */ + public function getReceived() + { + return $this->received; + } + + /** + * Set formerlyOwned + * + * @param bool $formerlyOwned + */ + public function setFormerlyOwned($formerlyOwned): self + { + $this->formerlyOwned = $formerlyOwned; + + return $this; + } + + /** + * Get formerlyOwned + * + * @return bool + */ + public function getFormerlyOwned() + { + return $this->formerlyOwned; + } + + /** + * Set frontFilterSize + * + * @param string $frontFilterSize + */ + public function setFrontFilterSize($frontFilterSize): self + { + $this->frontFilterSize = $frontFilterSize; + + return $this; + } + + /** + * Get frontFilterSize + * + * @return string + */ + public function getFrontFilterSize() + { + return $this->frontFilterSize; + } + + /** + * Set rearFilterSize + * + * @param string $rearFilterSize + */ + public function setRearFilterSize($rearFilterSize): self + { + $this->rearFilterSize = $rearFilterSize; + + return $this; + } + + /** + * Get rearFilterSize + * + * @return string + */ + public function getRearFilterSize() + { + return $this->rearFilterSize; + } + + /** + * Set isTeleconverter + * + * @param bool $isTeleconverter + */ + public function setIsTeleconverter($isTeleconverter): self + { + $this->isTeleconverter = $isTeleconverter; + + return $this; + } + + /** + * Get isTeleconverter + * + * @return bool + */ + public function getIsTeleconverter() + { + return $this->isTeleconverter; + } + + /** + * Set designElements + * + * @param int $designElements + */ + public function setDesignElements($designElements): self + { + $this->designElements = $designElements; + + return $this; + } + + /** + * Get designElements + * + * @return int + */ + public function getDesignElements() + { + return $this->designElements; + } + + /** + * Set designGroups + * + * @param int $designGroups + */ + public function setDesignGroups($designGroups): self + { + $this->designGroups = $designGroups; + + return $this; + } + + /** + * Get designGroups + * + * @return int + */ + public function getDesignGroups() + { + return $this->designGroups; + } + + /** + * Set apertureBlades + * + * @param int $apertureBlades + */ + public function setApertureBlades($apertureBlades): self + { + $this->apertureBlades = $apertureBlades; + + return $this; + } + + /** + * Get apertureBlades + * + * @return int + */ + public function getApertureBlades(): ?int + { + return $this->apertureBlades; + } } diff --git a/src/Entity/Lenses.php b/src/Entity/Lenses.php index 45f762d..6cb4007 100644 --- a/src/Entity/Lenses.php +++ b/src/Entity/Lenses.php @@ -12,16 +12,17 @@ use Doctrine\ORM\Mapping as ORM; #[ORM\Entity(repositoryClass: LensesRepository::class)] class Lenses { - 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; + use LensTrait; - #[ORM\Column(name: 'received', type: 'boolean', nullable: false)] - 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 int $id; - #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false)] - private bool $formerlyOwned = false; + #[ORM\Column(name: 'received', type: 'boolean', nullable: false)] + private bool $received = false; + + #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false)] + private bool $formerlyOwned = false; } diff --git a/src/Entity/PreviouslyOwnedCamera.php b/src/Entity/PreviouslyOwnedCamera.php index 6f54429..e241c89 100644 --- a/src/Entity/PreviouslyOwnedCamera.php +++ b/src/Entity/PreviouslyOwnedCamera.php @@ -13,10 +13,11 @@ use Doctrine\ORM\Mapping as ORM; #[ORM\Entity(repositoryClass: CameraRepository::class)] class PreviouslyOwnedCamera { - use CameraTrait; - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] - #[ORM\Id] - #[ORM\GeneratedValue(strategy: 'IDENTITY')] - #[ORM\SequenceGenerator(sequenceName: 'prevously_owned_camera_id_seq', allocationSize: 1, initialValue: 1)] - private int $id; + use CameraTrait; + + #[ORM\Column(name: 'id', type: 'integer', nullable: false)] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] + #[ORM\SequenceGenerator(sequenceName: 'prevously_owned_camera_id_seq', allocationSize: 1, initialValue: 1)] + private int $id; } diff --git a/src/Entity/PreviouslyOwnedFlash.php b/src/Entity/PreviouslyOwnedFlash.php index 9d831d8..3fa94f3 100644 --- a/src/Entity/PreviouslyOwnedFlash.php +++ b/src/Entity/PreviouslyOwnedFlash.php @@ -11,16 +11,16 @@ use Doctrine\ORM\Mapping as ORM; #[ORM\Entity] class PreviouslyOwnedFlash { - use FlashTrait; + use FlashTrait; - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] - #[ORM\Id] - #[ORM\GeneratedValue(strategy: 'IDENTITY')] - private int $id; + #[ORM\Column(name: 'id', type: 'integer', nullable: false)] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] + private int $id; - #[ORM\Column(name: 'received', type: 'boolean', nullable: false, options: ['default' => true])] - private bool $received = true; + #[ORM\Column(name: 'received', type: 'boolean', nullable: false, options: ['default' => true])] + private bool $received = true; - #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false, options: ['default' => true])] - private bool $formerlyOwned = true; + #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false, options: ['default' => true])] + private bool $formerlyOwned = true; } diff --git a/src/Entity/PreviouslyOwnedLenses.php b/src/Entity/PreviouslyOwnedLenses.php index 4e297f0..413e109 100644 --- a/src/Entity/PreviouslyOwnedLenses.php +++ b/src/Entity/PreviouslyOwnedLenses.php @@ -12,15 +12,16 @@ use Doctrine\ORM\Mapping as ORM; #[ORM\Entity(repositoryClass: LensesRepository::class)] class PreviouslyOwnedLenses { - use LensTrait; - #[ORM\Column(name: 'id', type: 'integer', nullable: false)] - #[ORM\Id] - #[ORM\GeneratedValue(strategy: 'IDENTITY')] - private int $id; + use LensTrait; - #[ORM\Column(name: 'received', type: 'boolean', nullable: false)] - private bool $received = true; + #[ORM\Column(name: 'id', type: 'integer', nullable: false)] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] + private int $id; - #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false)] - private bool $formerlyOwned = true; + #[ORM\Column(name: 'received', type: 'boolean', nullable: false)] + private bool $received = true; + + #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false)] + private bool $formerlyOwned = true; } diff --git a/src/Entity/PurchasePriceTrait.php b/src/Entity/PurchasePriceTrait.php index 3b264cd..7feb311 100644 --- a/src/Entity/PurchasePriceTrait.php +++ b/src/Entity/PurchasePriceTrait.php @@ -6,22 +6,22 @@ use Doctrine\ORM\Mapping as ORM; trait PurchasePriceTrait { - #[ORM\Column(name: 'purchase_price', type: 'money', nullable: true)] - private ?string $purchasePrice = null; + #[ORM\Column(name: 'purchase_price', type: 'money', nullable: true)] + private ?string $purchasePrice = null; - public function setPurchasePrice(?string $purchasePrice): self - { - $this->purchasePrice = $purchasePrice; + public function setPurchasePrice(?string $purchasePrice): self + { + $this->purchasePrice = $purchasePrice; - return $this; - } + return $this; + } - public function getPurchasePrice(): string - { - if (empty($this->purchasePrice)) { - return '0'; - } + public function getPurchasePrice(): string + { + if (empty($this->purchasePrice)) { + return '0'; + } - return $this->purchasePrice; - } + return $this->purchasePrice; + } } diff --git a/src/Form/CameraType.php b/src/Form/CameraType.php index a99237e..ceead9a 100644 --- a/src/Form/CameraType.php +++ b/src/Form/CameraType.php @@ -2,68 +2,69 @@ namespace App\Form; -use Symfony\Component\Form\{ - AbstractType, FormBuilderInterface -}; -use Symfony\Component\Form\Extension\Core\Type\{ChoiceType, MoneyType}; -use Symfony\Component\OptionsResolver\Exception\AccessException; -use Symfony\Component\OptionsResolver\OptionsResolver; - use App\Entity\Camera; +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\MoneyType; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\Exception\AccessException; + +use Symfony\Component\OptionsResolver\OptionsResolver; class CameraType extends AbstractType { - /** - * {@inheritdoc} - */ - public function buildForm(FormBuilderInterface $builder, array $options): void - { - $builder->add('brand') - ->add('type') - ->add('isDigital') - ->add('mount') - ->add('model') - ->add('filmFormat', ChoiceType::class, [ - 'choices' => [ - 'Small Format' => [ - '35mm' => '135', - '110' => '110', - ], - 'Medium Format' => [ - '120' => '120', - '127' => '127', - '620' => '620', - ], - ] - ]) - ->add('cropFactor') - ->add('serial') - ->add('purchasePrice', MoneyType::class, [ - 'currency' => 'USD', - ]) - ->add('batteryType') - ->add('received') - ->add('isWorking') - ->add('formerlyOwned') - ->add('notes'); - } + /** + * {@inheritDoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder->add('brand') + ->add('type') + ->add('isDigital') + ->add('mount') + ->add('model') + ->add('filmFormat', ChoiceType::class, [ + 'choices' => [ + 'Small Format' => [ + '35mm' => '135', + '110' => '110', + ], + 'Medium Format' => [ + '120' => '120', + '127' => '127', + '620' => '620', + ], + ], + ]) + ->add('cropFactor') + ->add('serial') + ->add('purchasePrice', MoneyType::class, [ + 'currency' => 'USD', + ]) + ->add('batteryType') + ->add('received') + ->add('isWorking') + ->add('formerlyOwned') + ->add('notes'); + } - /** - * {@inheritdoc} - * @throws AccessException - */ - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults(array( - 'data_class' => Camera::class - )); - } + /** + * {@inheritDoc} + * + * @throws AccessException + */ + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Camera::class, + ]); + } - /** - * {@inheritdoc} - */ - public function getBlockPrefix(): string - { - return 'camerabundle_camera'; - } + /** + * {@inheritDoc} + */ + public function getBlockPrefix(): string + { + return 'camerabundle_camera'; + } } diff --git a/src/Form/CameraTypeType.php b/src/Form/CameraTypeType.php index c59ab4f..c66d0b4 100644 --- a/src/Form/CameraTypeType.php +++ b/src/Form/CameraTypeType.php @@ -2,41 +2,41 @@ namespace App\Form; -use Symfony\Component\Form\{ - AbstractType, FormBuilderInterface -}; -use Symfony\Component\OptionsResolver\OptionsResolver; +use App\Entity\CameraType; +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\Exception\AccessException; -use App\Entity\CameraType; +use Symfony\Component\OptionsResolver\OptionsResolver; class CameraTypeType extends AbstractType { - /** - * {@inheritdoc} - */ - public function buildForm(FormBuilderInterface $builder, array $options): void - { - $builder->add('type') - ->add('description'); - } + /** + * {@inheritDoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder->add('type') + ->add('description'); + } - /** - * {@inheritdoc} - * @throws AccessException - */ - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults(array( - 'data_class' => CameraType::class - )); - } + /** + * {@inheritDoc} + * + * @throws AccessException + */ + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => CameraType::class, + ]); + } - /** - * {@inheritdoc} - */ - public function getBlockPrefix(): string - { - return 'camerabundle_cameratype'; - } + /** + * {@inheritDoc} + */ + public function getBlockPrefix(): string + { + return 'camerabundle_cameratype'; + } } diff --git a/src/Form/FilmType.php b/src/Form/FilmType.php index d6f2697..0ecaccb 100644 --- a/src/Form/FilmType.php +++ b/src/Form/FilmType.php @@ -10,66 +10,66 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class FilmType extends AbstractType { - /** - * {@inheritdoc} - */ - public function buildForm(FormBuilderInterface $builder, array $options): void - { - $builder->add('brand') - ->add('productLine') - ->add('filmName') - ->add('filmAlias') - ->add('filmSpeedAsa') - ->add('filmSpeedDin') - ->add('filmFormat', ChoiceType::class, [ - 'choices' => [ - 'Small Format' => [ - '35mm' => '135', - '110' => '110', - ], - 'Medium Format' => [ - '120' => '120', - '127' => '127', - '620' => '620', - ], - ] - ]) - ->add('filmBase',ChoiceType::class, [ - 'choices' => [ - 'Cellulose Triacetate' => 'Cellulose Triacetate', - 'Polyester' => 'Polyester', - 'Polyethylene Naphtalate' => 'Polyethylene Naphtalate', - ] - ]) - ->add('unusedRolls') - ->add('rollsInCamera') - ->add('developedRolls') - ->add('chemistry', ChoiceType::class, [ - 'choices' => [ - 'B & W' => 'B & W', - 'C-41' => 'C-41', - 'E-6' => 'E-6', - 'Other' => 'Other', - ] - ]) - ->add('notes'); - } + /** + * {@inheritDoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder->add('brand') + ->add('productLine') + ->add('filmName') + ->add('filmAlias') + ->add('filmSpeedAsa') + ->add('filmSpeedDin') + ->add('filmFormat', ChoiceType::class, [ + 'choices' => [ + 'Small Format' => [ + '35mm' => '135', + '110' => '110', + ], + 'Medium Format' => [ + '120' => '120', + '127' => '127', + '620' => '620', + ], + ], + ]) + ->add('filmBase', ChoiceType::class, [ + 'choices' => [ + 'Cellulose Triacetate' => 'Cellulose Triacetate', + 'Polyester' => 'Polyester', + 'Polyethylene Naphtalate' => 'Polyethylene Naphtalate', + ], + ]) + ->add('unusedRolls') + ->add('rollsInCamera') + ->add('developedRolls') + ->add('chemistry', ChoiceType::class, [ + 'choices' => [ + 'B & W' => 'B & W', + 'C-41' => 'C-41', + 'E-6' => 'E-6', + 'Other' => 'Other', + ], + ]) + ->add('notes'); + } - /** - * {@inheritdoc} - */ - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults(array( - 'data_class' => Film::class - )); - } + /** + * {@inheritDoc} + */ + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Film::class, + ]); + } - /** - * {@inheritdoc} - */ - public function getBlockPrefix(): string - { - return 'camerabundle_film'; - } + /** + * {@inheritDoc} + */ + public function getBlockPrefix(): string + { + return 'camerabundle_film'; + } } diff --git a/src/Form/FlashType.php b/src/Form/FlashType.php index 679d4bb..7a02842 100644 --- a/src/Form/FlashType.php +++ b/src/Form/FlashType.php @@ -2,53 +2,53 @@ namespace App\Form; -use Symfony\Component\Form\{ - AbstractType, FormBuilderInterface -}; -use Symfony\Component\OptionsResolver\Exception\AccessException; -use Symfony\Component\OptionsResolver\OptionsResolver; - use App\Entity\Flash; +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\Exception\AccessException; + +use Symfony\Component\OptionsResolver\OptionsResolver; class FlashType extends AbstractType { - /** - * {@inheritdoc} - */ - public function buildForm(FormBuilderInterface $builder, array $options): void - { - $builder->add('brand') - ->add('model') - ->add('isAutoFlash') - ->add('isTtl') - ->add('ttlType') - ->add('isPTtl') - ->add('pTtlType') - ->add('guideNumber') - ->add('purchasePrice') - ->add('batteries') - ->add('notes') - ->add('serial') - ->add('received') - ->add('formerlyOwned'); - } + /** + * {@inheritDoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder->add('brand') + ->add('model') + ->add('isAutoFlash') + ->add('isTtl') + ->add('ttlType') + ->add('isPTtl') + ->add('pTtlType') + ->add('guideNumber') + ->add('purchasePrice') + ->add('batteries') + ->add('notes') + ->add('serial') + ->add('received') + ->add('formerlyOwned'); + } - /** - * {@inheritdoc} - * @throws AccessException - */ - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults(array( - 'data_class' => Flash::class - )); - } + /** + * {@inheritDoc} + * + * @throws AccessException + */ + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Flash::class, + ]); + } - /** - * {@inheritdoc} - */ - public function getBlockPrefix(): string - { - return 'camerabundle_flash'; - } + /** + * {@inheritDoc} + */ + public function getBlockPrefix(): string + { + return 'camerabundle_flash'; + } } diff --git a/src/Form/LensesType.php b/src/Form/LensesType.php index 03f2389..74460c5 100644 --- a/src/Form/LensesType.php +++ b/src/Form/LensesType.php @@ -2,73 +2,74 @@ namespace App\Form; -use Symfony\Component\Form\{ - AbstractType, Extension\Core\Type\ChoiceType, FormBuilderInterface -}; -use Symfony\Component\OptionsResolver\Exception\AccessException; -use Symfony\Component\OptionsResolver\OptionsResolver; - use App\Entity\Lenses; +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\Exception\AccessException; + +use Symfony\Component\OptionsResolver\OptionsResolver; class LensesType extends AbstractType { - /** - * {@inheritdoc} - */ - public function buildForm(FormBuilderInterface $builder, array $options): void - { - $builder->add('brand') - ->add('coatings') - ->add('productLine') - ->add('model') - ->add('mount') - ->add('imageSize', ChoiceType::class, [ - 'choices' => [ - 'Small Format' => [ - '35mm' => '35mm', - 'APS-C' => 'APS-C', - 'Micro 4/3' => 'Micro 4/3', - ], - 'Medium Format' => [ - '6x6' => '6x6cm', - '6x4.5' => '6x4.5cm', - '4x4' => '4x4cm', - ] - ] - ]) - ->add('minFStop') - ->add('maxFStop') - ->add('minFocalLength') - ->add('maxFocalLength') - ->add('serial') - ->add('purchasePrice') - ->add('notes') - ->add('received') - ->add('formerlyOwned') - ->add('frontFilterSize') - ->add('rearFilterSize') - ->add('isTeleconverter') - ->add('designElements') - ->add('designGroups') - ->add('apertureBlades'); - } + /** + * {@inheritDoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder->add('brand') + ->add('coatings') + ->add('productLine') + ->add('model') + ->add('mount') + ->add('imageSize', ChoiceType::class, [ + 'choices' => [ + 'Small Format' => [ + '35mm' => '35mm', + 'APS-C' => 'APS-C', + 'Micro 4/3' => 'Micro 4/3', + ], + 'Medium Format' => [ + '6x6' => '6x6cm', + '6x4.5' => '6x4.5cm', + '4x4' => '4x4cm', + ], + ], + ]) + ->add('minFStop') + ->add('maxFStop') + ->add('minFocalLength') + ->add('maxFocalLength') + ->add('serial') + ->add('purchasePrice') + ->add('notes') + ->add('received') + ->add('formerlyOwned') + ->add('frontFilterSize') + ->add('rearFilterSize') + ->add('isTeleconverter') + ->add('designElements') + ->add('designGroups') + ->add('apertureBlades'); + } - /** - * {@inheritdoc} - * @throws AccessException - */ - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults(array( - 'data_class' => Lenses::class - )); - } + /** + * {@inheritDoc} + * + * @throws AccessException + */ + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Lenses::class, + ]); + } - /** - * {@inheritdoc} - */ - public function getBlockPrefix(): string - { - return 'camerabundle_lenses'; - } + /** + * {@inheritDoc} + */ + public function getBlockPrefix(): string + { + return 'camerabundle_lenses'; + } } diff --git a/src/Form/PreviouslyOwnedCameraType.php b/src/Form/PreviouslyOwnedCameraType.php index fa3b6e4..c0348ee 100644 --- a/src/Form/PreviouslyOwnedCameraType.php +++ b/src/Form/PreviouslyOwnedCameraType.php @@ -2,51 +2,53 @@ namespace App\Form; -use Symfony\Component\Form\{AbstractType, FormBuilderInterface}; -use Symfony\Component\OptionsResolver\Exception\AccessException; -use Symfony\Component\OptionsResolver\OptionsResolver; - use App\Entity\PreviouslyOwnedCamera; +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\Exception\AccessException; + +use Symfony\Component\OptionsResolver\OptionsResolver; class PreviouslyOwnedCameraType extends AbstractType { - /** - * {@inheritdoc} - */ - public function buildForm(FormBuilderInterface $builder, array $options): void - { - $builder->add('brand') - ->add('mount') - ->add('model') - ->add('isDigital') - ->add('cropFactor') - ->add('isWorking') - ->add('notes') - ->add('serial') - ->add('formerlyOwned') - ->add('purchasePrice') - ->add('batteryType') - ->add('filmFormat') - ->add('received') - ->add('type'); - } + /** + * {@inheritDoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder->add('brand') + ->add('mount') + ->add('model') + ->add('isDigital') + ->add('cropFactor') + ->add('isWorking') + ->add('notes') + ->add('serial') + ->add('formerlyOwned') + ->add('purchasePrice') + ->add('batteryType') + ->add('filmFormat') + ->add('received') + ->add('type'); + } - /** - * {@inheritdoc} - * @throws AccessException - */ - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults(array( - 'data_class' => PreviouslyOwnedCamera::class - )); - } + /** + * {@inheritDoc} + * + * @throws AccessException + */ + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => PreviouslyOwnedCamera::class, + ]); + } - /** - * {@inheritdoc} - */ - public function getBlockPrefix(): string - { - return 'camerabundle_previouslyownedcamera'; - } + /** + * {@inheritDoc} + */ + public function getBlockPrefix(): string + { + return 'camerabundle_previouslyownedcamera'; + } } diff --git a/src/Form/PreviouslyOwnedFlashType.php b/src/Form/PreviouslyOwnedFlashType.php index c061a73..a400b75 100644 --- a/src/Form/PreviouslyOwnedFlashType.php +++ b/src/Form/PreviouslyOwnedFlashType.php @@ -2,52 +2,54 @@ namespace App\Form; -use Symfony\Component\Form\{AbstractType, FormBuilderInterface}; -use Symfony\Component\OptionsResolver\Exception\AccessException; -use Symfony\Component\OptionsResolver\OptionsResolver; - use App\Entity\PreviouslyOwnedFlash; +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\Exception\AccessException; + +use Symfony\Component\OptionsResolver\OptionsResolver; class PreviouslyOwnedFlashType extends AbstractType { - /** - * {@inheritdoc} - */ - public function buildForm(FormBuilderInterface $builder, array $options): void - { - $builder - ->add('brand') - ->add('model') - ->add('isAutoFlash') - ->add('isTtl') - ->add('ttlType') - ->add('isPTtl') - ->add('pTtlType') - ->add('guideNumber') - ->add('purchasePrice') - ->add('batteries') - ->add('notes') - ->add('serial') - ->add('received') - ->add('formerlyOwned'); - } + /** + * {@inheritDoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder + ->add('brand') + ->add('model') + ->add('isAutoFlash') + ->add('isTtl') + ->add('ttlType') + ->add('isPTtl') + ->add('pTtlType') + ->add('guideNumber') + ->add('purchasePrice') + ->add('batteries') + ->add('notes') + ->add('serial') + ->add('received') + ->add('formerlyOwned'); + } - /** - * {@inheritdoc} - * @throws AccessException - */ - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults(array( - 'data_class' => PreviouslyOwnedFlash::class - )); - } + /** + * {@inheritDoc} + * + * @throws AccessException + */ + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => PreviouslyOwnedFlash::class, + ]); + } - /** - * {@inheritdoc} - */ - public function getBlockPrefix(): string - { - return 'camerabundle_previouslyownedflash'; - } + /** + * {@inheritDoc} + */ + public function getBlockPrefix(): string + { + return 'camerabundle_previouslyownedflash'; + } } diff --git a/src/Form/PreviouslyOwnedLensesType.php b/src/Form/PreviouslyOwnedLensesType.php index b219b70..75e8262 100644 --- a/src/Form/PreviouslyOwnedLensesType.php +++ b/src/Form/PreviouslyOwnedLensesType.php @@ -2,58 +2,60 @@ namespace App\Form; -use Symfony\Component\Form\{AbstractType, FormBuilderInterface}; -use Symfony\Component\OptionsResolver\Exception\AccessException; -use Symfony\Component\OptionsResolver\OptionsResolver; - use App\Entity\PreviouslyOwnedLenses; +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\Exception\AccessException; + +use Symfony\Component\OptionsResolver\OptionsResolver; class PreviouslyOwnedLensesType extends AbstractType { - /** - * {@inheritdoc} - */ - public function buildForm(FormBuilderInterface $builder, array $options): void - { - $builder->add('brand') - ->add('coatings') - ->add('productLine') - ->add('model') - ->add('minFStop') - ->add('maxFStop') - ->add('minFocalLength') - ->add('maxFocalLength') - ->add('serial') - ->add('purchasePrice') - ->add('notes') - ->add('mount') - ->add('imageSize') - ->add('received') - ->add('formerlyOwned') - ->add('frontFilterSize') - ->add('rearFilterSize') - ->add('isTeleconverter') - ->add('designElements') - ->add('designGroups') - ->add('apertureBlades'); - } + /** + * {@inheritDoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder->add('brand') + ->add('coatings') + ->add('productLine') + ->add('model') + ->add('minFStop') + ->add('maxFStop') + ->add('minFocalLength') + ->add('maxFocalLength') + ->add('serial') + ->add('purchasePrice') + ->add('notes') + ->add('mount') + ->add('imageSize') + ->add('received') + ->add('formerlyOwned') + ->add('frontFilterSize') + ->add('rearFilterSize') + ->add('isTeleconverter') + ->add('designElements') + ->add('designGroups') + ->add('apertureBlades'); + } - /** - * {@inheritdoc} - * @throws AccessException - */ - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults(array( - 'data_class' => PreviouslyOwnedLenses::class - )); - } + /** + * {@inheritDoc} + * + * @throws AccessException + */ + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => PreviouslyOwnedLenses::class, + ]); + } - /** - * {@inheritdoc} - */ - public function getBlockPrefix(): string - { - return 'camerabundle_previouslyownedlenses'; - } + /** + * {@inheritDoc} + */ + public function getBlockPrefix(): string + { + return 'camerabundle_previouslyownedlenses'; + } } diff --git a/src/Kernel.php b/src/Kernel.php index 05e1e50..8f044a9 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -18,20 +18,20 @@ use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; class Kernel extends BaseKernel { - use MicroKernelTrait; + use MicroKernelTrait; - protected function configureContainer(ContainerConfigurator $container): void - { - $container->import('../config/{packages}/*.yaml'); - $container->import('../config/{packages}/'.$this->environment.'/*.yaml'); - $container->import('../config/{services}.yaml'); - $container->import('../config/{services}_'.$this->environment.'.yaml'); - } + protected function configureContainer(ContainerConfigurator $container): void + { + $container->import('../config/{packages}/*.yaml'); + $container->import('../config/{packages}/' . $this->environment . '/*.yaml'); + $container->import('../config/{services}.yaml'); + $container->import('../config/{services}_' . $this->environment . '.yaml'); + } - protected function configureRoutes(RoutingConfigurator $routes): void - { - $routes->import('../config/{routes}/'.$this->environment.'/*.yaml'); - $routes->import('../config/{routes}/*.yaml'); - $routes->import('../config/{routes}.yaml'); - } + protected function configureRoutes(RoutingConfigurator $routes): void + { + $routes->import('../config/{routes}/' . $this->environment . '/*.yaml'); + $routes->import('../config/{routes}/*.yaml'); + $routes->import('../config/{routes}.yaml'); + } } diff --git a/src/Repository/AcquireTrait.php b/src/Repository/AcquireTrait.php index 6766180..b9b1d99 100644 --- a/src/Repository/AcquireTrait.php +++ b/src/Repository/AcquireTrait.php @@ -4,41 +4,39 @@ namespace App\Repository; use ReflectionObject; use Throwable; -trait AcquireTrait { - /** - * Move a record from the table represented by $currentRecord - * into the table represented by $newRecord - * - * @param mixed $currentRecord - * @param mixed $newRecord - */ - protected function moveRecord($currentRecord, $newRecord): void - { - $em = $this->getEntityManager(); +trait AcquireTrait +{ + /** + * Move a record from the table represented by $currentRecord + * into the table represented by $newRecord + * + * @param mixed $currentRecord + * @param mixed $newRecord + */ + protected function moveRecord($currentRecord, $newRecord): void + { + $em = $this->getEntityManager(); - $old = new ReflectionObject($currentRecord); - $new = new ReflectionObject($newRecord); + $old = new ReflectionObject($currentRecord); + $new = new ReflectionObject($newRecord); - foreach ($old->getProperties() as $property) { - $propertyName = $property->getName(); - if ($new->hasProperty($propertyName)) { - $newProperty = $new->getProperty($propertyName); - $newProperty->setAccessible(true); - $property->setAccessible(true); - $newProperty->setValue($newRecord, $property->getValue($currentRecord)); - } - } + foreach ($old->getProperties() as $property) { + $propertyName = $property->getName(); + if ($new->hasProperty($propertyName)) { + $newProperty = $new->getProperty($propertyName); + $newProperty->setAccessible(true); + $property->setAccessible(true); + $newProperty->setValue($newRecord, $property->getValue($currentRecord)); + } + } - try - { - $em->persist($newRecord); - $em->remove($currentRecord); - $em->flush(); - } - catch (Throwable) - { - dump($newRecord); - } - } + try { + $em->persist($newRecord); + $em->remove($currentRecord); + $em->flush(); + } catch (Throwable) { + dump($newRecord); + } + } } diff --git a/src/Repository/CameraRepository.php b/src/Repository/CameraRepository.php index a9d2928..5761beb 100644 --- a/src/Repository/CameraRepository.php +++ b/src/Repository/CameraRepository.php @@ -2,35 +2,33 @@ namespace App\Repository; -use App\Entity\{Camera, PreviouslyOwnedCamera}; -use Doctrine\ORM\{ - EntityRepository, ORMInvalidArgumentException -}; +use App\Entity\Camera; +use App\Entity\PreviouslyOwnedCamera; +use Doctrine\ORM\EntityRepository; +use Doctrine\ORM\ORMInvalidArgumentException; -class CameraRepository extends EntityRepository { +class CameraRepository extends EntityRepository +{ + use AcquireTrait; - use AcquireTrait; + /** + * @throws ORMInvalidArgumentException + */ + public function deacquire(Camera $currentRecord): void + { + $currentRecord->setFormerlyOwned(true) + ->setReceived(true); - /** - * @param Camera $currentRecord - * @throws ORMInvalidArgumentException - */ - public function deacquire(Camera $currentRecord): void - { - $currentRecord->setFormerlyOwned(true) - ->setReceived(true); + $this->moveRecord($currentRecord, new PreviouslyOwnedCamera()); + } - $this->moveRecord($currentRecord, new PreviouslyOwnedCamera()); - } + /** + * @throws ORMInvalidArgumentException + */ + public function reacquire(PreviouslyOwnedCamera $currentRecord): void + { + $currentRecord->setFormerlyOwned(false); - /** - * @param PreviouslyOwnedCamera $currentRecord - * @throws ORMInvalidArgumentException - */ - public function reacquire(PreviouslyOwnedCamera $currentRecord): void - { - $currentRecord->setFormerlyOwned(false); - - $this->moveRecord($currentRecord, new Camera()); - } + $this->moveRecord($currentRecord, new Camera()); + } } diff --git a/src/Repository/FlashRepository.php b/src/Repository/FlashRepository.php index a6635ca..34732d9 100644 --- a/src/Repository/FlashRepository.php +++ b/src/Repository/FlashRepository.php @@ -2,35 +2,33 @@ namespace App\Repository; -use App\Entity\{Flash, PreviouslyOwnedFlash}; -use Doctrine\ORM\{ - EntityRepository, ORMInvalidArgumentException -}; +use App\Entity\Flash; +use App\Entity\PreviouslyOwnedFlash; +use Doctrine\ORM\EntityRepository; +use Doctrine\ORM\ORMInvalidArgumentException; -class FlashRepository extends EntityRepository { +class FlashRepository extends EntityRepository +{ + use AcquireTrait; - use AcquireTrait; + /** + * @throws ORMInvalidArgumentException + */ + public function deacquire(Flash $currentRecord): void + { + $currentRecord->setFormerlyOwned(true) + ->setReceived(true); - /** - * @param Flash $currentRecord - * @throws ORMInvalidArgumentException - */ - public function deacquire(Flash $currentRecord): void - { - $currentRecord->setFormerlyOwned(true) - ->setReceived(true); + $this->moveRecord($currentRecord, new PreviouslyOwnedFlash()); + } - $this->moveRecord($currentRecord, new PreviouslyOwnedFlash()); - } + /** + * @throws ORMInvalidArgumentException + */ + public function reacquire(PreviouslyOwnedFlash $currentRecord): void + { + $currentRecord->setFormerlyOwned(false); - /** - * @param PreviouslyOwnedFlash $currentRecord - * @throws ORMInvalidArgumentException - */ - public function reacquire(PreviouslyOwnedFlash $currentRecord): void - { - $currentRecord->setFormerlyOwned(false); - - $this->moveRecord($currentRecord, new Flash()); - } + $this->moveRecord($currentRecord, new Flash()); + } } diff --git a/src/Repository/LensesRepository.php b/src/Repository/LensesRepository.php index e6dff27..dae94cf 100644 --- a/src/Repository/LensesRepository.php +++ b/src/Repository/LensesRepository.php @@ -2,31 +2,26 @@ namespace App\Repository; -use App\Entity\{Lenses, PreviouslyOwnedLenses}; +use App\Entity\Lenses; +use App\Entity\PreviouslyOwnedLenses; use Doctrine\ORM\EntityRepository; class LensesRepository extends EntityRepository { - use AcquireTrait; + use AcquireTrait; - /** - * @param Lenses $currentRecord - */ - public function deacquire(Lenses $currentRecord): void - { - $currentRecord->setFormerlyOwned(true) - ->setReceived(true); + public function deacquire(Lenses $currentRecord): void + { + $currentRecord->setFormerlyOwned(true) + ->setReceived(true); - $this->moveRecord($currentRecord, new PreviouslyOwnedLenses()); - } + $this->moveRecord($currentRecord, new PreviouslyOwnedLenses()); + } - /** - * @param PreviouslyOwnedLenses $currentRecord - */ - public function reacquire(PreviouslyOwnedLenses $currentRecord): void - { - $currentRecord->setFormerlyOwned(false); + public function reacquire(PreviouslyOwnedLenses $currentRecord): void + { + $currentRecord->setFormerlyOwned(false); - $this->moveRecord($currentRecord, new Lenses()); - } + $this->moveRecord($currentRecord, new Lenses()); + } } diff --git a/src/Types/MoneyType.php b/src/Types/MoneyType.php index 8ef44c7..ea4d711 100644 --- a/src/Types/MoneyType.php +++ b/src/Types/MoneyType.php @@ -2,30 +2,30 @@ namespace App\Types; -use Doctrine\DBAL\Types\Type; +use App\ValueObject\Money; use Doctrine\DBAL\Platforms\AbstractPlatform; -use App\ValueObject\Money; +use Doctrine\DBAL\Types\Type; -class MoneyType extends Type { +class MoneyType extends Type +{ + public function getSQLDeclaration(array $column, AbstractPlatform $platform): string + { + return 'MONEY'; + } - public function getSQLDeclaration(array $column, AbstractPlatform $platform): string - { - return 'MONEY'; - } + public function convertToPHPValue($value, AbstractPlatform $platform): float + { + return (float) (string) new Money($value); + } - public function convertToPHPValue($value, AbstractPlatform $platform): float - { - return (float) (string)new Money($value); - } + public function getName(): string + { + return 'money'; + } - public function getName(): string - { - return 'money'; - } - - public function requiresSQLCommentHint(AbstractPlatform $platform): bool - { - return TRUE; - } + public function requiresSQLCommentHint(AbstractPlatform $platform): bool + { + return true; + } } diff --git a/src/ValueObject/Money.php b/src/ValueObject/Money.php index b7e44f9..f469940 100644 --- a/src/ValueObject/Money.php +++ b/src/ValueObject/Money.php @@ -1,23 +1,25 @@ -value = (float)str_replace(['$',','], '', $value); - } +class Money implements Stringable +{ + private readonly float $value; - public function getValue(): float - { - return (float)str_replace(['$',','], '', $this->value); - } + public function __construct($value) + { + $this->value = (float) str_replace(['$', ','], '', $value); + } - public function __toString(): string - { - return (string)$this->getValue(); - } + public function getValue(): float + { + return (float) str_replace(['$', ','], '', $this->value); + } + + public function __toString(): string + { + return (string) $this->getValue(); + } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 469dcce..3f725b7 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,11 +1,11 @@ -bootEnv(dirname(__DIR__).'/.env'); + (new Dotenv())->bootEnv(dirname(__DIR__) . '/.env'); } diff --git a/translations/messages.en.php b/translations/messages.en.php index 3d6886f..64455d3 100644 --- a/translations/messages.en.php +++ b/translations/messages.en.php @@ -1,4 +1,4 @@ - '', diff --git a/translations/validators.en.php b/translations/validators.en.php index 79643eb..486c92e 100644 --- a/translations/validators.en.php +++ b/translations/validators.en.php @@ -1,97 +1,97 @@ - 'This value should be false.', - 'This value should be true.' => 'This value should be true.', - 'This value should be of type {{ type }}.' => 'This value should be of type {{ type }}.', - 'This value should be blank.' => 'This value should be blank.', - 'The value you selected is not a valid choice.' => 'The value you selected is not a valid choice.', - 'You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.' => 'You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.', - 'You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.' => 'You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.', - 'One or more of the given values is invalid.' => 'One or more of the given values is invalid.', - 'This field was not expected.' => 'This field was not expected.', - 'This field is missing.' => 'This field is missing.', - 'This value is not a valid date.' => 'This value is not a valid date.', - 'This value is not a valid datetime.' => 'This value is not a valid datetime.', - 'This value is not a valid email address.' => 'This value is not a valid email address.', - 'The file could not be found.' => 'The file could not be found.', - 'The file is not readable.' => 'The file is not readable.', - 'The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.' => 'The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.', - 'The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.' => 'The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.', - 'This value should be {{ limit }} or less.' => 'This value should be {{ limit }} or less.', - 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.' => 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.', - 'This value should be {{ limit }} or more.' => 'This value should be {{ limit }} or more.', - 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.' => 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.', - 'This value should not be blank.' => 'This value should not be blank.', - 'This value should not be null.' => 'This value should not be null.', - 'This value should be null.' => 'This value should be null.', - 'This value is not valid.' => 'This value is not valid.', - 'This value is not a valid time.' => 'This value is not a valid time.', - 'This value is not a valid URL.' => 'This value is not a valid URL.', - 'The two values should be equal.' => 'The two values should be equal.', - 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.' => 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.', - 'The file is too large.' => 'The file is too large.', - 'The file could not be uploaded.' => 'The file could not be uploaded.', - 'This value should be a valid number.' => 'This value should be a valid number.', - 'This file is not a valid image.' => 'This file is not a valid image.', - 'This is not a valid IP address.' => 'This is not a valid IP address.', - 'This value is not a valid language.' => 'This value is not a valid language.', - 'This value is not a valid locale.' => 'This value is not a valid locale.', - 'This value is not a valid country.' => 'This value is not a valid country.', - 'This value is already used.' => 'This value is already used.', - 'The size of the image could not be detected.' => 'The size of the image could not be detected.', - 'The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.' => 'The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.', - 'The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.' => 'The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.', - 'The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.' => 'The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.', - 'The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.' => 'The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.', - 'This value should be the user\'s current password.' => 'This value should be the user\'s current password.', - 'This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.' => 'This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.', - 'The file was only partially uploaded.' => 'The file was only partially uploaded.', - 'No file was uploaded.' => 'No file was uploaded.', - 'No temporary folder was configured in php.ini.' => 'No temporary folder was configured in php.ini, or the configured folder does not exist.', - 'Cannot write temporary file to disk.' => 'Cannot write temporary file to disk.', - 'A PHP extension caused the upload to fail.' => 'A PHP extension caused the upload to fail.', - 'This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.' => 'This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.', - 'This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.' => 'This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.', - 'This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.' => 'This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.', - 'Invalid card number.' => 'Invalid card number.', - 'Unsupported card type or invalid card number.' => 'Unsupported card type or invalid card number.', - 'This is not a valid International Bank Account Number (IBAN).' => 'This is not a valid International Bank Account Number (IBAN).', - 'This value is not a valid ISBN-10.' => 'This value is not a valid ISBN-10.', - 'This value is not a valid ISBN-13.' => 'This value is not a valid ISBN-13.', - 'This value is neither a valid ISBN-10 nor a valid ISBN-13.' => 'This value is neither a valid ISBN-10 nor a valid ISBN-13.', - 'This value is not a valid ISSN.' => 'This value is not a valid ISSN.', - 'This value is not a valid currency.' => 'This value is not a valid currency.', - 'This value should be equal to {{ compared_value }}.' => 'This value should be equal to {{ compared_value }}.', - 'This value should be greater than {{ compared_value }}.' => 'This value should be greater than {{ compared_value }}.', - 'This value should be greater than or equal to {{ compared_value }}.' => 'This value should be greater than or equal to {{ compared_value }}.', - 'This value should be identical to {{ compared_value_type }} {{ compared_value }}.' => 'This value should be identical to {{ compared_value_type }} {{ compared_value }}.', - 'This value should be less than {{ compared_value }}.' => 'This value should be less than {{ compared_value }}.', - 'This value should be less than or equal to {{ compared_value }}.' => 'This value should be less than or equal to {{ compared_value }}.', - 'This value should not be equal to {{ compared_value }}.' => 'This value should not be equal to {{ compared_value }}.', - 'This value should not be identical to {{ compared_value_type }} {{ compared_value }}.' => 'This value should not be identical to {{ compared_value_type }} {{ compared_value }}.', - 'The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.' => 'The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.', - 'The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.' => 'The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.', - 'The image is square ({{ width }}x{{ height }}px). Square images are not allowed.' => 'The image is square ({{ width }}x{{ height }}px). Square images are not allowed.', - 'The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.' => 'The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.', - 'The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.' => 'The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.', - 'An empty file is not allowed.' => 'An empty file is not allowed.', - 'The host could not be resolved.' => 'The host could not be resolved.', - 'This value does not match the expected {{ charset }} charset.' => 'This value does not match the expected {{ charset }} charset.', - 'This is not a valid Business Identifier Code (BIC).' => 'This is not a valid Business Identifier Code (BIC).', - 'Error' => 'Error', - 'This is not a valid UUID.' => 'This is not a valid UUID.', - 'This value should be a multiple of {{ compared_value }}.' => 'This value should be a multiple of {{ compared_value }}.', - 'This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.' => 'This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.', - 'This value should be valid JSON.' => 'This value should be valid JSON.', - 'This collection should contain only unique elements.' => 'This collection should contain only unique elements.', - 'This value should be positive.' => 'This value should be positive.', - 'This value should be either positive or zero.' => 'This value should be either positive or zero.', - 'This value should be negative.' => 'This value should be negative.', - 'This value should be either negative or zero.' => 'This value should be either negative or zero.', - 'This value is not a valid timezone.' => 'This value is not a valid timezone.', - 'This password has been leaked in a data breach, it must not be used. Please use another password.' => 'This password has been leaked in a data breach, it must not be used. Please use another password.', - 'This form should not contain extra fields.' => 'This form should not contain extra fields.', - 'The uploaded file was too large. Please try to upload a smaller file.' => 'The uploaded file was too large. Please try to upload a smaller file.', - 'The CSRF token is invalid. Please try to resubmit the form.' => 'The CSRF token is invalid. Please try to resubmit the form.', + 'This value should be false.' => 'This value should be false.', + 'This value should be true.' => 'This value should be true.', + 'This value should be of type {{ type }}.' => 'This value should be of type {{ type }}.', + 'This value should be blank.' => 'This value should be blank.', + 'The value you selected is not a valid choice.' => 'The value you selected is not a valid choice.', + 'You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.' => 'You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.', + 'You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.' => 'You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.', + 'One or more of the given values is invalid.' => 'One or more of the given values is invalid.', + 'This field was not expected.' => 'This field was not expected.', + 'This field is missing.' => 'This field is missing.', + 'This value is not a valid date.' => 'This value is not a valid date.', + 'This value is not a valid datetime.' => 'This value is not a valid datetime.', + 'This value is not a valid email address.' => 'This value is not a valid email address.', + 'The file could not be found.' => 'The file could not be found.', + 'The file is not readable.' => 'The file is not readable.', + 'The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.' => 'The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.', + 'The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.' => 'The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.', + 'This value should be {{ limit }} or less.' => 'This value should be {{ limit }} or less.', + 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.' => 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.', + 'This value should be {{ limit }} or more.' => 'This value should be {{ limit }} or more.', + 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.' => 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.', + 'This value should not be blank.' => 'This value should not be blank.', + 'This value should not be null.' => 'This value should not be null.', + 'This value should be null.' => 'This value should be null.', + 'This value is not valid.' => 'This value is not valid.', + 'This value is not a valid time.' => 'This value is not a valid time.', + 'This value is not a valid URL.' => 'This value is not a valid URL.', + 'The two values should be equal.' => 'The two values should be equal.', + 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.' => 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.', + 'The file is too large.' => 'The file is too large.', + 'The file could not be uploaded.' => 'The file could not be uploaded.', + 'This value should be a valid number.' => 'This value should be a valid number.', + 'This file is not a valid image.' => 'This file is not a valid image.', + 'This is not a valid IP address.' => 'This is not a valid IP address.', + 'This value is not a valid language.' => 'This value is not a valid language.', + 'This value is not a valid locale.' => 'This value is not a valid locale.', + 'This value is not a valid country.' => 'This value is not a valid country.', + 'This value is already used.' => 'This value is already used.', + 'The size of the image could not be detected.' => 'The size of the image could not be detected.', + 'The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.' => 'The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.', + 'The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.' => 'The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.', + 'The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.' => 'The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.', + 'The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.' => 'The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.', + 'This value should be the user\'s current password.' => 'This value should be the user\'s current password.', + 'This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.' => 'This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.', + 'The file was only partially uploaded.' => 'The file was only partially uploaded.', + 'No file was uploaded.' => 'No file was uploaded.', + 'No temporary folder was configured in php.ini.' => 'No temporary folder was configured in php.ini, or the configured folder does not exist.', + 'Cannot write temporary file to disk.' => 'Cannot write temporary file to disk.', + 'A PHP extension caused the upload to fail.' => 'A PHP extension caused the upload to fail.', + 'This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.' => 'This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.', + 'This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.' => 'This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.', + 'This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.' => 'This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.', + 'Invalid card number.' => 'Invalid card number.', + 'Unsupported card type or invalid card number.' => 'Unsupported card type or invalid card number.', + 'This is not a valid International Bank Account Number (IBAN).' => 'This is not a valid International Bank Account Number (IBAN).', + 'This value is not a valid ISBN-10.' => 'This value is not a valid ISBN-10.', + 'This value is not a valid ISBN-13.' => 'This value is not a valid ISBN-13.', + 'This value is neither a valid ISBN-10 nor a valid ISBN-13.' => 'This value is neither a valid ISBN-10 nor a valid ISBN-13.', + 'This value is not a valid ISSN.' => 'This value is not a valid ISSN.', + 'This value is not a valid currency.' => 'This value is not a valid currency.', + 'This value should be equal to {{ compared_value }}.' => 'This value should be equal to {{ compared_value }}.', + 'This value should be greater than {{ compared_value }}.' => 'This value should be greater than {{ compared_value }}.', + 'This value should be greater than or equal to {{ compared_value }}.' => 'This value should be greater than or equal to {{ compared_value }}.', + 'This value should be identical to {{ compared_value_type }} {{ compared_value }}.' => 'This value should be identical to {{ compared_value_type }} {{ compared_value }}.', + 'This value should be less than {{ compared_value }}.' => 'This value should be less than {{ compared_value }}.', + 'This value should be less than or equal to {{ compared_value }}.' => 'This value should be less than or equal to {{ compared_value }}.', + 'This value should not be equal to {{ compared_value }}.' => 'This value should not be equal to {{ compared_value }}.', + 'This value should not be identical to {{ compared_value_type }} {{ compared_value }}.' => 'This value should not be identical to {{ compared_value_type }} {{ compared_value }}.', + 'The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.' => 'The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.', + 'The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.' => 'The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.', + 'The image is square ({{ width }}x{{ height }}px). Square images are not allowed.' => 'The image is square ({{ width }}x{{ height }}px). Square images are not allowed.', + 'The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.' => 'The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.', + 'The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.' => 'The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.', + 'An empty file is not allowed.' => 'An empty file is not allowed.', + 'The host could not be resolved.' => 'The host could not be resolved.', + 'This value does not match the expected {{ charset }} charset.' => 'This value does not match the expected {{ charset }} charset.', + 'This is not a valid Business Identifier Code (BIC).' => 'This is not a valid Business Identifier Code (BIC).', + 'Error' => 'Error', + 'This is not a valid UUID.' => 'This is not a valid UUID.', + 'This value should be a multiple of {{ compared_value }}.' => 'This value should be a multiple of {{ compared_value }}.', + 'This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.' => 'This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.', + 'This value should be valid JSON.' => 'This value should be valid JSON.', + 'This collection should contain only unique elements.' => 'This collection should contain only unique elements.', + 'This value should be positive.' => 'This value should be positive.', + 'This value should be either positive or zero.' => 'This value should be either positive or zero.', + 'This value should be negative.' => 'This value should be negative.', + 'This value should be either negative or zero.' => 'This value should be either negative or zero.', + 'This value is not a valid timezone.' => 'This value is not a valid timezone.', + 'This password has been leaked in a data breach, it must not be used. Please use another password.' => 'This password has been leaked in a data breach, it must not be used. Please use another password.', + 'This form should not contain extra fields.' => 'This form should not contain extra fields.', + 'The uploaded file was too large. Please try to upload a smaller file.' => 'The uploaded file was too large. Please try to upload a smaller file.', + 'The CSRF token is invalid. Please try to resubmit the form.' => 'The CSRF token is invalid. Please try to resubmit the form.', ];