Reformat files

This commit is contained in:
Timothy Warren 2022-03-03 10:53:48 -05:00
parent c73feb6264
commit 825b84db8a
46 changed files with 2699 additions and 2662 deletions

View File

@ -1,4 +1,4 @@
<?php <?php declare(strict_types=1);
return [ return [
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
@ -6,7 +6,6 @@ return [
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => 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], Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],

View File

@ -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)%"

View File

@ -1,5 +1,5 @@
<?php <?php declare(strict_types=1);
if (file_exists(dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php')) { if (file_exists(dirname(__DIR__) . '/var/cache/prod/App_KernelProdContainer.preload.php')) {
require dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php'; require dirname(__DIR__) . '/var/cache/prod/App_KernelProdContainer.preload.php';
} }

View File

@ -1,13 +1,15 @@
<?php declare(strict_types=1); <?php
declare(strict_types=1);
use App\Kernel; use App\Kernel;
use Symfony\Component\Dotenv\Dotenv; use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug; use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
require dirname(__DIR__).'/vendor/autoload.php'; require dirname(__DIR__) . '/vendor/autoload.php';
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env'); (new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');
if ($_SERVER['APP_DEBUG']) { if ($_SERVER['APP_DEBUG']) {
umask(0000); umask(0000);

View File

@ -2,17 +2,17 @@
namespace App\Controller; namespace App\Controller;
use Doctrine\Persistence\ManagerRegistry;
use LogicException;
use App\Entity\Camera; use App\Entity\Camera;
use App\Form\CameraType; use App\Form\CameraType;
use Doctrine\ORM\ORMInvalidArgumentException; use Doctrine\ORM\ORMInvalidArgumentException;
use Doctrine\Persistence\ManagerRegistry;
use LogicException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; 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\Form\FormInterface;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/** /**
* Camera controller. * Camera controller.
@ -21,8 +21,8 @@ use Symfony\Component\HttpFoundation\Request;
class CameraController extends AbstractController class CameraController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = Camera::class;
protected const ENTITY = Camera::class;
protected const FORM = CameraType::class; protected const FORM = CameraType::class;
public function __construct(private readonly ManagerRegistry $managerRegistry) public function __construct(private readonly ManagerRegistry $managerRegistry)
@ -33,11 +33,11 @@ class CameraController extends AbstractController
* Lists all camera entities. * Lists all camera entities.
*/ */
#[Route(path: '/', name: 'camera_index', methods: ['GET'])] #[Route(path: '/', name: 'camera_index', methods: ['GET'])]
public function indexAction() : Response public function indexAction(): Response
{ {
$em = $this->managerRegistry->getManager(); $em = $this->managerRegistry->getManager();
$receivedItems = $em->getRepository(self::ENTITY)->findBy([ $receivedItems = $em->getRepository(self::ENTITY)->findBy([
'received' => true 'received' => true,
], [ ], [
'isWorking' => 'ASC', 'isWorking' => 'ASC',
'brand' => 'ASC', 'brand' => 'ASC',
@ -45,7 +45,7 @@ class CameraController extends AbstractController
'model' => 'ASC', 'model' => 'ASC',
]); ]);
$newItems = $em->getRepository(self::ENTITY)->findBy([ $newItems = $em->getRepository(self::ENTITY)->findBy([
'received' => false 'received' => false,
], [ ], [
'brand' => 'ASC', 'brand' => 'ASC',
'mount' => 'ASC', 'mount' => 'ASC',
@ -53,6 +53,7 @@ class CameraController extends AbstractController
]); ]);
$working = array_filter($receivedItems, [$this, 'isWorking']); $working = array_filter($receivedItems, [$this, 'isWorking']);
$notWorking = array_filter($receivedItems, [$this, 'isNotWorking']); $notWorking = array_filter($receivedItems, [$this, 'isNotWorking']);
return $this->render('camera/index.html.twig', [ return $this->render('camera/index.html.twig', [
'not_received' => $newItems, 'not_received' => $newItems,
'not_working' => $notWorking, 'not_working' => $notWorking,
@ -64,7 +65,7 @@ class CameraController extends AbstractController
* Creates a new camera entity. * Creates a new camera entity.
*/ */
#[Route(path: '/new', name: 'camera_new', methods: ['GET', 'POST'])] #[Route(path: '/new', name: 'camera_new', methods: ['GET', 'POST'])]
public function newAction(Request $request) public function newAction(Request $request): RedirectResponse|Response
{ {
return $this->itemCreate($request, 'camera/new.html.twig', 'camera', 'camera_show'); return $this->itemCreate($request, 'camera/new.html.twig', 'camera', 'camera_show');
} }
@ -73,7 +74,7 @@ class CameraController extends AbstractController
* Finds and displays a camera entity. * Finds and displays a camera entity.
*/ */
#[Route(path: '/{id}', name: 'camera_show', methods: ['GET'])] #[Route(path: '/{id}', name: 'camera_show', methods: ['GET'])]
public function showAction(Camera $camera) public function showAction(Camera $camera): Response
{ {
return $this->itemView($camera, 'camera/show.html.twig', 'camera'); return $this->itemView($camera, 'camera/show.html.twig', 'camera');
} }
@ -84,7 +85,7 @@ class CameraController extends AbstractController
* @throws LogicException * @throws LogicException
*/ */
#[Route(path: '/{id}/edit', name: 'camera_edit', methods: ['GET', 'POST'])] #[Route(path: '/{id}/edit', name: 'camera_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, Camera $camera) public function editAction(Request $request, Camera $camera): RedirectResponse|Response
{ {
return $this->itemUpdate($request, $camera, 'camera/edit.html.twig', 'camera', 'camera_show'); return $this->itemUpdate($request, $camera, 'camera/edit.html.twig', 'camera', 'camera_show');
} }
@ -95,7 +96,7 @@ class CameraController extends AbstractController
* @throws LogicException * @throws LogicException
*/ */
#[Route(path: '/{id}', name: 'camera_delete', methods: ['DELETE'])] #[Route(path: '/{id}', name: 'camera_delete', methods: ['DELETE'])]
public function deleteAction(Request $request, Camera $camera) : RedirectResponse public function deleteAction(Request $request, Camera $camera): RedirectResponse
{ {
return $this->itemDelete($request, $camera, 'camera_index'); return $this->itemDelete($request, $camera, 'camera_index');
} }
@ -107,7 +108,7 @@ class CameraController extends AbstractController
* @throws ORMInvalidArgumentException * @throws ORMInvalidArgumentException
*/ */
#[Route(path: '/{id}/deacquire', name: 'camera_deacquire', methods: ['POST'])] #[Route(path: '/{id}/deacquire', name: 'camera_deacquire', methods: ['POST'])]
public function deacquireAction(Request $request, Camera $camera) : RedirectResponse public function deacquireAction(Request $request, Camera $camera): RedirectResponse
{ {
return $this->itemDeacquire($request, $camera, 'previously-owned-camera_index'); return $this->itemDeacquire($request, $camera, 'previously-owned-camera_index');
} }
@ -141,6 +142,6 @@ class CameraController extends AbstractController
private function isNotWorking(Camera $camera): bool private function isNotWorking(Camera $camera): bool
{ {
return !$this->isWorking($camera); return ! $this->isWorking($camera);
} }
} }

View File

@ -8,9 +8,9 @@ use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;
#[Route(path: 'camera-type')] #[Route(path: 'camera-type')]
class CameraTypeController extends AbstractController class CameraTypeController extends AbstractController
@ -18,7 +18,6 @@ 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)

View File

@ -3,14 +3,14 @@
namespace App\Controller; namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;
class DefaultController extends AbstractController class DefaultController extends AbstractController
{ {
#[Route(path: '/', name: 'homepage')] #[Route(path: '/', name: 'homepage')]
public function indexAction(Request $request) : Response public function indexAction(Request $request): Response
{ {
// replace this example code with whatever you need // replace this example code with whatever you need
return $this->render('default/index.html.twig', [ return $this->render('default/index.html.twig', [

View File

@ -2,16 +2,17 @@
namespace App\Controller; namespace App\Controller;
use Doctrine\Persistence\ManagerRegistry;
use LogicException;
use App\Entity\Film; use App\Entity\Film;
use App\Form\FilmType; use App\Form\FilmType;
use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\Criteria;
use Doctrine\Persistence\ManagerRegistry;
use LogicException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
/** /**
* Film controller. * Film controller.
@ -20,8 +21,8 @@ use Symfony\Component\HttpFoundation\Request;
class FilmController extends AbstractController class FilmController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = Film::class;
protected const ENTITY = Film::class;
protected const FORM = FilmType::class; protected const FORM = FilmType::class;
public function __construct(private readonly ManagerRegistry $managerRegistry) public function __construct(private readonly ManagerRegistry $managerRegistry)
@ -32,7 +33,7 @@ class FilmController extends AbstractController
* Lists all film entities. * Lists all film entities.
*/ */
#[Route(path: '/', name: 'film_index', methods: ['GET'])] #[Route(path: '/', name: 'film_index', methods: ['GET'])]
public function indexAction() : Response public function indexAction(): Response
{ {
$repo = $this->managerRegistry->getManager()->getRepository(self::ENTITY); $repo = $this->managerRegistry->getManager()->getRepository(self::ENTITY);
$criteria = Criteria::create() $criteria = Criteria::create()
@ -51,6 +52,7 @@ class FilmController extends AbstractController
'productLine' => 'ASC', 'productLine' => 'ASC',
'filmFormat' => 'ASC', 'filmFormat' => 'ASC',
]); ]);
return $this->render('film/index.html.twig', [ return $this->render('film/index.html.twig', [
'in_camera' => $inCamera, 'in_camera' => $inCamera,
'films' => $notInCamera, 'films' => $notInCamera,
@ -61,7 +63,7 @@ class FilmController extends AbstractController
* Creates a new film entity. * Creates a new film entity.
*/ */
#[Route(path: '/new', name: 'film_new', methods: ['GET', 'POST'])] #[Route(path: '/new', name: 'film_new', methods: ['GET', 'POST'])]
public function newAction(Request $request) public function newAction(Request $request): RedirectResponse|Response
{ {
return $this->itemCreate($request, 'film/new.html.twig', 'film', 'film_show'); return $this->itemCreate($request, 'film/new.html.twig', 'film', 'film_show');
} }
@ -70,7 +72,7 @@ class FilmController extends AbstractController
* Finds and displays a film entity. * Finds and displays a film entity.
*/ */
#[Route(path: '/{id}', name: 'film_show', methods: ['GET'])] #[Route(path: '/{id}', name: 'film_show', methods: ['GET'])]
public function showAction(Film $film) public function showAction(Film $film): Response
{ {
return $this->itemView($film, 'film/show.html.twig', 'film'); return $this->itemView($film, 'film/show.html.twig', 'film');
} }
@ -81,7 +83,7 @@ class FilmController extends AbstractController
* @throws LogicException * @throws LogicException
*/ */
#[Route(path: '/{id}/edit', name: 'film_edit', methods: ['GET', 'POST'])] #[Route(path: '/{id}/edit', name: 'film_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, Film $film) public function editAction(Request $request, Film $film): RedirectResponse|Response
{ {
return $this->itemUpdate($request, $film, 'film/edit.html.twig', 'film', 'film_show'); return $this->itemUpdate($request, $film, 'film/edit.html.twig', 'film', 'film_show');
} }
@ -92,7 +94,7 @@ class FilmController extends AbstractController
* @throws LogicException * @throws LogicException
*/ */
#[Route(path: '/{id}', name: 'film_delete', methods: ['DELETE'])] #[Route(path: '/{id}', name: 'film_delete', methods: ['DELETE'])]
public function deleteAction(Request $request, Film $film) public function deleteAction(Request $request, Film $film): RedirectResponse
{ {
return $this->itemDelete($request, $film, 'film_index'); return $this->itemDelete($request, $film, 'film_index');
} }

View File

@ -2,15 +2,15 @@
namespace App\Controller; namespace App\Controller;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Form\FormInterface;
use App\Entity\Flash; use App\Entity\Flash;
use App\Form\FlashType; use App\Form\FlashType;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;
/** /**
* Flash controller. * Flash controller.
@ -21,7 +21,6 @@ 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)

View File

@ -4,13 +4,18 @@ namespace App\Controller;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\{Request, Response, RedirectResponse}; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
trait FormControllerTrait { trait FormControllerTrait
{
private readonly ManagerRegistry $managerRegistry; private readonly ManagerRegistry $managerRegistry;
/** /**
* Create a form generator * Create a form generator
*
* @param mixed $item
*/ */
protected function buildForm($item, string $actionRoute, string $method = 'POST'): FormInterface protected function buildForm($item, string $actionRoute, string $method = 'POST'): FormInterface
{ {
@ -26,13 +31,12 @@ trait FormControllerTrait {
protected function itemCreate(Request $request, string $template, string $templateKey, string $redirectRoute) protected function itemCreate(Request $request, string $template, string $templateKey, string $redirectRoute)
{ {
$Entity = self::ENTITY; $Entity = self::ENTITY;
$item = new $Entity; $item = new $Entity();
$form = $this->createForm(self::FORM, $item); $form = $this->createForm(self::FORM, $item);
$form->handleRequest($request); $form->handleRequest($request);
// If creating the item // If creating the item
if ($form->isSubmitted() && $form->isValid()) if ($form->isSubmitted() && $form->isValid()) {
{
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->persist($item); $em->persist($item);
$em->flush(); $em->flush();
@ -63,6 +67,8 @@ trait FormControllerTrait {
/** /**
* View details for a specific item * View details for a specific item
*
* @param mixed $item
*/ */
protected function itemView($item, string $template, string $templateKey): Response protected function itemView($item, string $template, string $templateKey): Response
{ {
@ -80,6 +86,8 @@ trait FormControllerTrait {
/** /**
* Show edit form / update an item * Show edit form / update an item
*
* @param mixed $item
*/ */
protected function itemUpdate(Request $request, $item, string $template, string $templateKey, string $redirectRoute) protected function itemUpdate(Request $request, $item, string $template, string $templateKey, string $redirectRoute)
{ {
@ -87,8 +95,7 @@ trait FormControllerTrait {
$editForm->handleRequest($request); $editForm->handleRequest($request);
// If updating the item // If updating the item
if ($editForm->isSubmitted() && $editForm->isValid()) if ($editForm->isSubmitted() && $editForm->isValid()) {
{
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->persist($item); $em->persist($item);
$em->flush(); $em->flush();
@ -102,20 +109,17 @@ trait FormControllerTrait {
'edit_form' => $editForm->createView(), 'edit_form' => $editForm->createView(),
]; ];
if (method_exists($this, 'createDeleteForm')) if (method_exists($this, 'createDeleteForm')) {
{
$deleteForm = $this->createDeleteForm($item); $deleteForm = $this->createDeleteForm($item);
$templateData['delete_form'] = $deleteForm->createView(); $templateData['delete_form'] = $deleteForm->createView();
} }
if (method_exists($this, 'createDeacquireForm')) if (method_exists($this, 'createDeacquireForm')) {
{
$deacquireForm = $this->createDeacquireForm($item); $deacquireForm = $this->createDeacquireForm($item);
$templateData['deacquire_form'] = $deacquireForm->createView(); $templateData['deacquire_form'] = $deacquireForm->createView();
} }
if (method_exists($this, 'createReacquireForm')) if (method_exists($this, 'createReacquireForm')) {
{
$reacquireForm = $this->createReacquireForm($item); $reacquireForm = $this->createReacquireForm($item);
$templateData['reacquire_form'] = $reacquireForm->createView(); $templateData['reacquire_form'] = $reacquireForm->createView();
} }
@ -125,6 +129,8 @@ trait FormControllerTrait {
/** /**
* Move an item to a previously_owned table * Move an item to a previously_owned table
*
* @param mixed $item
*/ */
protected function itemDeacquire(Request $request, $item, string $redirectRoute): RedirectResponse protected function itemDeacquire(Request $request, $item, string $redirectRoute): RedirectResponse
{ {
@ -139,6 +145,8 @@ trait FormControllerTrait {
/** /**
* Move an item from a previously_owned table back to the original table * 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 protected function itemReacquire(Request $request, $item, string $redirectRoute): RedirectResponse
{ {
@ -153,6 +161,8 @@ trait FormControllerTrait {
/** /**
* Actually delete an item * Actually delete an item
*
* @param mixed $item
*/ */
protected function itemDelete(Request $request, $item, string $redirectRoute): RedirectResponse protected function itemDelete(Request $request, $item, string $redirectRoute): RedirectResponse
{ {
@ -160,11 +170,10 @@ trait FormControllerTrait {
$form->handleRequest($request); $form->handleRequest($request);
// if ($form->isSubmitted() && $form->isValid()) // if ($form->isSubmitted() && $form->isValid())
{
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->remove($item); $em->remove($item);
$em->flush(); $em->flush();
}
return $this->redirectToRoute($redirectRoute); return $this->redirectToRoute($redirectRoute);
} }

View File

@ -2,13 +2,15 @@
namespace App\Controller; namespace App\Controller;
use Doctrine\Persistence\ManagerRegistry;
use App\Entity\Lenses; use App\Entity\Lenses;
use App\Form\LensesType; use App\Form\LensesType;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Form\FormInterface; 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. * Lens controller.
@ -17,8 +19,8 @@ use Symfony\Component\HttpFoundation\{Request, RedirectResponse};
class LensesController extends AbstractController class LensesController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = Lenses::class;
protected const ENTITY = Lenses::class;
protected const FORM = LensesType::class; protected const FORM = LensesType::class;
public function __construct(private readonly ManagerRegistry $managerRegistry) public function __construct(private readonly ManagerRegistry $managerRegistry)
@ -29,11 +31,11 @@ class LensesController extends AbstractController
* Lists all lens entities. * Lists all lens entities.
*/ */
#[Route(path: '/', name: 'lens_index', methods: ['GET'])] #[Route(path: '/', name: 'lens_index', methods: ['GET'])]
public function indexAction() public function indexAction(): Response
{ {
$em = $this->managerRegistry->getManager(); $em = $this->managerRegistry->getManager();
$receivedItems = $em->getRepository(self::ENTITY)->findBy([ $receivedItems = $em->getRepository(self::ENTITY)->findBy([
'received' => true 'received' => true,
], [ ], [
'brand' => 'ASC', 'brand' => 'ASC',
'productLine' => 'ASC', 'productLine' => 'ASC',
@ -42,7 +44,7 @@ class LensesController extends AbstractController
'maxFStop' => 'ASC', 'maxFStop' => 'ASC',
]); ]);
$newItems = $em->getRepository(self::ENTITY)->findBy([ $newItems = $em->getRepository(self::ENTITY)->findBy([
'received' => false 'received' => false,
], [ ], [
'brand' => 'ASC', 'brand' => 'ASC',
'productLine' => 'ASC', 'productLine' => 'ASC',
@ -50,6 +52,7 @@ class LensesController extends AbstractController
'minFocalLength' => 'ASC', 'minFocalLength' => 'ASC',
'maxFStop' => 'ASC', 'maxFStop' => 'ASC',
]); ]);
return $this->render('lenses/index.html.twig', [ return $this->render('lenses/index.html.twig', [
'not_received' => $newItems, 'not_received' => $newItems,
'lenses' => $receivedItems, 'lenses' => $receivedItems,
@ -60,7 +63,7 @@ class LensesController extends AbstractController
* Creates a new lens entity. * Creates a new lens entity.
*/ */
#[Route(path: '/new', name: 'lens_new', methods: ['GET', 'POST'])] #[Route(path: '/new', name: 'lens_new', methods: ['GET', 'POST'])]
public function newAction(Request $request) public function newAction(Request $request): RedirectResponse|Response
{ {
return $this->itemCreate($request, 'lenses/new.html.twig', 'lense', 'lens_show'); return $this->itemCreate($request, 'lenses/new.html.twig', 'lense', 'lens_show');
} }
@ -69,7 +72,7 @@ class LensesController extends AbstractController
* Finds and displays a lens entity. * Finds and displays a lens entity.
*/ */
#[Route(path: '/{id}', name: 'lens_show', methods: ['GET'])] #[Route(path: '/{id}', name: 'lens_show', methods: ['GET'])]
public function showAction(Lenses $lens) public function showAction(Lenses $lens): Response
{ {
return $this->itemView($lens, 'lenses/show.html.twig', 'lense'); return $this->itemView($lens, 'lenses/show.html.twig', 'lense');
} }
@ -78,7 +81,7 @@ class LensesController extends AbstractController
* Displays a form to edit an existing lens entity. * Displays a form to edit an existing lens entity.
*/ */
#[Route(path: '/{id}/edit', name: 'lens_edit', methods: ['GET', 'POST'])] #[Route(path: '/{id}/edit', name: 'lens_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, Lenses $lens) public function editAction(Request $request, Lenses $lens): RedirectResponse|Response
{ {
return $this->itemUpdate($request, $lens, 'lenses/edit.html.twig', 'lense', 'lens_show'); return $this->itemUpdate($request, $lens, 'lenses/edit.html.twig', 'lense', 'lens_show');
} }
@ -87,10 +90,11 @@ class LensesController extends AbstractController
* Moves a camera to the previouslyOwned table * Moves a camera to the previouslyOwned table
* *
* @param Request $request * @param Request $request
*
* @return RedirectResponse * @return RedirectResponse
*/ */
#[Route(path: '/{id}/deacquire', name: 'lens_deacquire', methods: ['POST'])] #[Route(path: '/{id}/deacquire', name: 'lens_deacquire', methods: ['POST'])]
public function deacquireAction(Request $request, Lenses $lens) public function deacquireAction(Request $request, Lenses $lens): RedirectResponse
{ {
return $this->itemDeacquire($request, $lens, 'previously-owned-lens_index'); return $this->itemDeacquire($request, $lens, 'previously-owned-lens_index');
} }
@ -99,7 +103,7 @@ class LensesController extends AbstractController
* Deletes a lens entity. * Deletes a lens entity.
*/ */
#[Route(path: '/{id}', name: 'lens_delete', methods: ['DELETE'])] #[Route(path: '/{id}', name: 'lens_delete', methods: ['DELETE'])]
public function deleteAction(Request $request, Lenses $lens) public function deleteAction(Request $request, Lenses $lens): RedirectResponse
{ {
return $this->itemDelete($request, $lens, 'lens_index'); return $this->itemDelete($request, $lens, 'lens_index');
} }

View File

@ -2,15 +2,18 @@
namespace App\Controller; namespace App\Controller;
use UnexpectedValueException;
use LogicException;
use Doctrine\ORM\ORMInvalidArgumentException;
use App\Entity\PreviouslyOwnedCamera; use App\Entity\PreviouslyOwnedCamera;
use App\Form\PreviouslyOwnedCameraType; use App\Form\PreviouslyOwnedCameraType;
use Doctrine\ORM\ORMInvalidArgumentException;
use Doctrine\Persistence\ManagerRegistry;
use LogicException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Form\FormInterface; 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. * Previouslyownedcamera controller.
@ -19,17 +22,21 @@ use Symfony\Component\HttpFoundation\{RedirectResponse, Request};
class PreviouslyOwnedCameraController extends AbstractController class PreviouslyOwnedCameraController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = PreviouslyOwnedCamera::class;
protected const ENTITY = PreviouslyOwnedCamera::class;
protected const FORM = PreviouslyOwnedCameraType::class; protected const FORM = PreviouslyOwnedCameraType::class;
public function __construct(private readonly ManagerRegistry $managerRegistry)
{
}
/** /**
* Lists all previouslyOwnedCamera entities. * Lists all previouslyOwnedCamera entities.
* *
* @throws UnexpectedValueException * @throws UnexpectedValueException
*/ */
#[Route(path: '/', name: 'previously-owned-camera_index', methods: ['GET'])] #[Route(path: '/', name: 'previously-owned-camera_index', methods: ['GET'])]
public function indexAction() public function indexAction(): Response
{ {
return $this->itemListView('previouslyownedcamera/index.html.twig', 'previouslyOwnedCameras', [ return $this->itemListView('previouslyownedcamera/index.html.twig', 'previouslyOwnedCameras', [
'brand' => 'ASC', 'brand' => 'ASC',
@ -42,7 +49,7 @@ class PreviouslyOwnedCameraController extends AbstractController
* Finds and displays a previouslyOwnedCamera entity. * Finds and displays a previouslyOwnedCamera entity.
*/ */
#[Route(path: '/{id}', name: 'previously-owned-camera_show', methods: ['GET'])] #[Route(path: '/{id}', name: 'previously-owned-camera_show', methods: ['GET'])]
public function showAction(PreviouslyOwnedCamera $previouslyOwnedCamera) public function showAction(PreviouslyOwnedCamera $previouslyOwnedCamera): Response
{ {
return $this->itemView($previouslyOwnedCamera, 'previouslyownedcamera/show.html.twig', 'previouslyOwnedCamera'); return $this->itemView($previouslyOwnedCamera, 'previouslyownedcamera/show.html.twig', 'previouslyOwnedCamera');
} }
@ -53,7 +60,7 @@ class PreviouslyOwnedCameraController extends AbstractController
* @throws LogicException * @throws LogicException
*/ */
#[Route(path: '/{id}/edit', name: 'previously-owned-camera_edit', methods: ['GET', 'POST'])] #[Route(path: '/{id}/edit', name: 'previously-owned-camera_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, PreviouslyOwnedCamera $previouslyOwnedCamera) public function editAction(Request $request, PreviouslyOwnedCamera $previouslyOwnedCamera): RedirectResponse|Response
{ {
return $this->itemUpdate($request, $previouslyOwnedCamera, 'previouslyownedcamera/edit.html.twig', 'previouslyOwnedCamera', 'previously-owned-camera_show'); return $this->itemUpdate($request, $previouslyOwnedCamera, 'previouslyownedcamera/edit.html.twig', 'previouslyOwnedCamera', 'previously-owned-camera_show');
} }
@ -62,12 +69,14 @@ class PreviouslyOwnedCameraController extends AbstractController
* Moves a camera to the previouslyOwned table * Moves a camera to the previouslyOwned table
* *
* @param Request $request * @param Request $request
*
* @throws LogicException * @throws LogicException
* @throws ORMInvalidArgumentException * @throws ORMInvalidArgumentException
*
* @return RedirectResponse * @return RedirectResponse
*/ */
#[Route(path: '/{id}/reacquire', name: 'previously-owned-camera_reacquire', methods: ['POST'])] #[Route(path: '/{id}/reacquire', name: 'previously-owned-camera_reacquire', methods: ['POST'])]
public function reacquireAction(Request $request, PreviouslyOwnedCamera $camera) : RedirectResponse public function reacquireAction(Request $request, PreviouslyOwnedCamera $camera): RedirectResponse
{ {
return $this->itemReacquire($request, $camera, 'camera_index'); return $this->itemReacquire($request, $camera, 'camera_index');
} }

View File

@ -7,9 +7,9 @@ use App\Form\PreviouslyOwnedFlashType;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;
/** /**
* Previouslyownedflash controller. * Previouslyownedflash controller.
@ -20,7 +20,6 @@ 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)
@ -40,7 +39,7 @@ class PreviouslyOwnedFlashController extends AbstractController
* Creates a new previouslyOwnedFlash entity. * Creates a new previouslyOwnedFlash entity.
*/ */
#[Route(path: '/new', name: 'previously-owned-flash_new', methods: ['GET', 'POST'])] #[Route(path: '/new', name: 'previously-owned-flash_new', methods: ['GET', 'POST'])]
public function newAction(Request $request) public function newAction(Request $request): RedirectResponse|Response
{ {
return $this->itemCreate($request, 'previouslyownedflash/new.html.twig', 'previouslyOwnedFlash', 'previously-owned-flash_show'); return $this->itemCreate($request, 'previouslyownedflash/new.html.twig', 'previouslyOwnedFlash', 'previously-owned-flash_show');
} }

View File

@ -4,23 +4,30 @@ namespace App\Controller;
use App\Entity\PreviouslyOwnedLenses; use App\Entity\PreviouslyOwnedLenses;
use App\Form\PreviouslyOwnedLensesType; use App\Form\PreviouslyOwnedLensesType;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; 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\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
#[Route(path: 'previously-owned-lens')] #[Route(path: 'previously-owned-lens')]
class PreviouslyOwnedLensesController extends AbstractController class PreviouslyOwnedLensesController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = PreviouslyOwnedLenses::class;
protected const ENTITY = PreviouslyOwnedLenses::class;
protected const FORM = PreviouslyOwnedLensesType::class; protected const FORM = PreviouslyOwnedLensesType::class;
public function __construct(private readonly ManagerRegistry $managerRegistry)
{
}
/** /**
* Lists all previouslyOwnedLense entities. * Lists all previouslyOwnedLense entities.
*/ */
#[Route(path: '/', name: 'previously-owned-lens_index', methods: ['GET'])] #[Route(path: '/', name: 'previously-owned-lens_index', methods: ['GET'])]
public function indexAction() public function indexAction(): Response
{ {
return $this->itemListView('previouslyownedlenses/index.html.twig', 'previouslyOwnedLenses', [ return $this->itemListView('previouslyownedlenses/index.html.twig', 'previouslyOwnedLenses', [
'brand' => 'ASC', 'brand' => 'ASC',
@ -35,7 +42,7 @@ class PreviouslyOwnedLensesController extends AbstractController
* Finds and displays a previouslyOwnedLense entity. * Finds and displays a previouslyOwnedLense entity.
*/ */
#[Route(path: '/{id}', name: 'previously-owned-lens_show', methods: ['GET'])] #[Route(path: '/{id}', name: 'previously-owned-lens_show', methods: ['GET'])]
public function showAction(PreviouslyOwnedLenses $previouslyOwnedLens) public function showAction(PreviouslyOwnedLenses $previouslyOwnedLens): Response
{ {
return $this->itemView($previouslyOwnedLens, 'previouslyownedlenses/show.html.twig', 'previouslyOwnedLense'); return $this->itemView($previouslyOwnedLens, 'previouslyownedlenses/show.html.twig', 'previouslyOwnedLense');
} }
@ -44,7 +51,7 @@ class PreviouslyOwnedLensesController extends AbstractController
* Displays a form to edit an existing previouslyOwnedLense entity. * Displays a form to edit an existing previouslyOwnedLense entity.
*/ */
#[Route(path: '/{id}/edit', name: 'previously-owned-lens_edit', methods: ['GET', 'POST'])] #[Route(path: '/{id}/edit', name: 'previously-owned-lens_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, PreviouslyOwnedLenses $previouslyOwnedLens) public function editAction(Request $request, PreviouslyOwnedLenses $previouslyOwnedLens): RedirectResponse|Response
{ {
return $this->itemUpdate($request, $previouslyOwnedLens, 'previouslyownedlenses/edit.html.twig', 'previouslyOwnedLense', 'previously-owned-lens_show'); return $this->itemUpdate($request, $previouslyOwnedLens, 'previouslyownedlenses/edit.html.twig', 'previouslyOwnedLense', 'previously-owned-lens_show');
} }

View File

@ -14,6 +14,7 @@ use Doctrine\ORM\Mapping as ORM;
class Camera class Camera
{ {
use CameraTrait; use CameraTrait;
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id] #[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\GeneratedValue(strategy: 'IDENTITY')]

View File

@ -8,8 +8,6 @@ use Doctrine\ORM\Mapping as ORM;
* Trait CameraTrait * Trait CameraTrait
* *
* Shared columns for camera, and previously_owned_camera tables * Shared columns for camera, and previously_owned_camera tables
*
* @package App\Entity
*/ */
trait CameraTrait trait CameraTrait
{ {
@ -44,7 +42,7 @@ trait CameraTrait
private readonly string $serial; private readonly string $serial;
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false)] #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false)]
private bool $formerlyOwned = FALSE; private bool $formerlyOwned = false;
#[ORM\Column(name: 'battery_type', type: 'string', nullable: true)] #[ORM\Column(name: 'battery_type', type: 'string', nullable: true)]
private readonly ?string $batteryType; private readonly ?string $batteryType;
@ -53,14 +51,14 @@ trait CameraTrait
private ?string $filmFormat = '135'; private ?string $filmFormat = '135';
#[ORM\Column(name: 'received', type: 'boolean', nullable: true)] #[ORM\Column(name: 'received', type: 'boolean', nullable: true)]
private ?bool $received = FALSE; private ?bool $received = false;
public function getId(): int public function getId(): int
{ {
return $this->id; return $this->id;
} }
public function setType(CameraType $type = null): self public function setType(?CameraType $type = null): self
{ {
$this->type = $type; $this->type = $type;

View File

@ -2,8 +2,8 @@
namespace App\Entity; namespace App\Entity;
use Stringable;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Stringable;
/** /**
* CameraType * CameraType
@ -42,8 +42,6 @@ class CameraType implements Stringable
/** /**
* Set type * Set type
*
*
*/ */
public function setType(string $type): self public function setType(string $type): self
{ {
@ -54,8 +52,6 @@ class CameraType implements Stringable
/** /**
* Set description * Set description
*
*
*/ */
public function setDescription(string $description): self public function setDescription(string $description): self
{ {

View File

@ -71,6 +71,7 @@ class Film
public function setBrand(string $brand): self public function setBrand(string $brand): self
{ {
$this->brand = $brand; $this->brand = $brand;
return $this; return $this;
} }
@ -88,6 +89,7 @@ class Film
public function setProductLine(?string $productLine): self public function setProductLine(?string $productLine): self
{ {
$this->productLine = $productLine; $this->productLine = $productLine;
return $this; return $this;
} }
@ -102,6 +104,7 @@ class Film
public function setFilmName(string $filmName): self public function setFilmName(string $filmName): self
{ {
$this->filmName = $filmName; $this->filmName = $filmName;
return $this; return $this;
} }
@ -116,6 +119,7 @@ class Film
public function setFilmAlias(string $filmAlias): self public function setFilmAlias(string $filmAlias): self
{ {
$this->filmAlias = $filmAlias; $this->filmAlias = $filmAlias;
return $this; return $this;
} }
@ -130,6 +134,7 @@ class Film
public function setFilmSpeedAsa(int $filmSpeedAsa): self public function setFilmSpeedAsa(int $filmSpeedAsa): self
{ {
$this->filmSpeedAsa = $filmSpeedAsa; $this->filmSpeedAsa = $filmSpeedAsa;
return $this; return $this;
} }
@ -144,6 +149,7 @@ class Film
public function setFilmSpeedDin(int $filmSpeedDin): self public function setFilmSpeedDin(int $filmSpeedDin): self
{ {
$this->filmSpeedDin = $filmSpeedDin; $this->filmSpeedDin = $filmSpeedDin;
return $this; return $this;
} }
@ -158,6 +164,7 @@ class Film
public function setFilmFormat(string $filmFormat): self public function setFilmFormat(string $filmFormat): self
{ {
$this->filmFormat = $filmFormat; $this->filmFormat = $filmFormat;
return $this; return $this;
} }
@ -172,6 +179,7 @@ class Film
public function setFilmBase(string $filmBase): self public function setFilmBase(string $filmBase): self
{ {
$this->filmBase = $filmBase; $this->filmBase = $filmBase;
return $this; return $this;
} }
@ -186,6 +194,7 @@ class Film
public function setUnusedRolls(int $unusedRolls): self public function setUnusedRolls(int $unusedRolls): self
{ {
$this->unusedRolls = $unusedRolls; $this->unusedRolls = $unusedRolls;
return $this; return $this;
} }
@ -200,6 +209,7 @@ class Film
public function setRollsInCamera(int $rollsInCamera): self public function setRollsInCamera(int $rollsInCamera): self
{ {
$this->rollsInCamera = $rollsInCamera; $this->rollsInCamera = $rollsInCamera;
return $this; return $this;
} }
@ -214,6 +224,7 @@ class Film
public function setDevelopedRolls(int $developedRolls): self public function setDevelopedRolls(int $developedRolls): self
{ {
$this->developedRolls = $developedRolls; $this->developedRolls = $developedRolls;
return $this; return $this;
} }
@ -228,6 +239,7 @@ class Film
public function setChemistry(string $chemistry): self public function setChemistry(string $chemistry): self
{ {
$this->chemistry = $chemistry; $this->chemistry = $chemistry;
return $this; return $this;
} }
@ -242,6 +254,7 @@ class Film
public function setNotes(string $notes): self public function setNotes(string $notes): self
{ {
$this->notes = $notes; $this->notes = $notes;
return $this; return $this;
} }
} }

View File

@ -38,6 +38,7 @@ class FilmFormat
public function setNumberId(int $numberId): self public function setNumberId(int $numberId): self
{ {
$this->numberId = $numberId; $this->numberId = $numberId;
return $this; return $this;
} }
@ -52,6 +53,7 @@ class FilmFormat
public function setName(string $name): self public function setName(string $name): self
{ {
$this->name = $name; $this->name = $name;
return $this; return $this;
} }
} }

View File

@ -12,6 +12,7 @@ use Doctrine\ORM\Mapping as ORM;
class Flash class Flash
{ {
use FlashTrait; use FlashTrait;
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id] #[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\GeneratedValue(strategy: 'IDENTITY')]

View File

@ -48,8 +48,6 @@ trait FlashTrait
/** /**
* Set brand * Set brand
*
*
*/ */
public function setBrand(string $brand): self public function setBrand(string $brand): self
{ {
@ -95,7 +93,7 @@ trait FlashTrait
/** /**
* Set isAutoFlash * Set isAutoFlash
* *
* @param boolean $isAutoFlash * @param bool $isAutoFlash
* *
* @return Flash * @return Flash
*/ */
@ -109,7 +107,7 @@ trait FlashTrait
/** /**
* Get isAutoFlash * Get isAutoFlash
* *
* @return boolean * @return bool
*/ */
public function getIsAutoFlash() public function getIsAutoFlash()
{ {
@ -119,7 +117,7 @@ trait FlashTrait
/** /**
* Set isTtl * Set isTtl
* *
* @param boolean $isTtl * @param bool $isTtl
* *
* @return Flash * @return Flash
*/ */
@ -133,7 +131,7 @@ trait FlashTrait
/** /**
* Get isTtl * Get isTtl
* *
* @return boolean * @return bool
*/ */
public function getIsTtl() public function getIsTtl()
{ {
@ -167,7 +165,7 @@ trait FlashTrait
/** /**
* Set isPTtl * Set isPTtl
* *
* @param boolean $isPTtl * @param bool $isPTtl
* *
* @return Flash * @return Flash
*/ */
@ -181,7 +179,7 @@ trait FlashTrait
/** /**
* Get isPTtl * Get isPTtl
* *
* @return boolean * @return bool
*/ */
public function getIsPTtl() public function getIsPTtl()
{ {
@ -309,7 +307,7 @@ trait FlashTrait
/** /**
* Set formerlyOwned * Set formerlyOwned
* *
* @param boolean $formerlyOwned * @param bool $formerlyOwned
* *
* @return Flash * @return Flash
*/ */
@ -323,7 +321,7 @@ trait FlashTrait
/** /**
* Get formerlyOwned * Get formerlyOwned
* *
* @return boolean * @return bool
*/ */
public function getFormerlyOwned() public function getFormerlyOwned()
{ {
@ -333,7 +331,7 @@ trait FlashTrait
/** /**
* Set received * Set received
* *
* @param boolean $received * @param bool $received
* *
* @return Flash * @return Flash
*/ */
@ -347,7 +345,7 @@ trait FlashTrait
/** /**
* Get received * Get received
* *
* @return boolean * @return bool
*/ */
public function getReceived() public function getReceived()
{ {

View File

@ -48,7 +48,7 @@ trait LensTrait
private readonly ?string $frontFilterSize; private readonly ?string $frontFilterSize;
#[ORM\Column(name: 'rear_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: true)] #[ORM\Column(name: 'rear_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: true)]
private readonly ? string $rearFilterSize; private readonly ?string $rearFilterSize;
#[ORM\Column(name: 'is_teleconverter', type: 'boolean', nullable: false)] #[ORM\Column(name: 'is_teleconverter', type: 'boolean', nullable: false)]
private bool $isTeleconverter = false; private bool $isTeleconverter = false;
@ -62,7 +62,6 @@ trait LensTrait
#[ORM\Column(name: 'aperture_blades', type: 'smallint', nullable: true)] #[ORM\Column(name: 'aperture_blades', type: 'smallint', nullable: true)]
private readonly ?int $apertureBlades; private readonly ?int $apertureBlades;
/** /**
* Get id * Get id
*/ */
@ -206,7 +205,7 @@ trait LensTrait
/** /**
* Set minFocalLength * Set minFocalLength
* *
* @param integer $minFocalLength * @param int $minFocalLength
*/ */
public function setMinFocalLength($minFocalLength): self public function setMinFocalLength($minFocalLength): self
{ {
@ -218,7 +217,7 @@ trait LensTrait
/** /**
* Get minFocalLength * Get minFocalLength
* *
* @return integer * @return int
*/ */
public function getMinFocalLength() public function getMinFocalLength()
{ {
@ -228,7 +227,7 @@ trait LensTrait
/** /**
* Set maxFocalLength * Set maxFocalLength
* *
* @param integer $maxFocalLength * @param int $maxFocalLength
*/ */
public function setMaxFocalLength($maxFocalLength): self public function setMaxFocalLength($maxFocalLength): self
{ {
@ -240,7 +239,7 @@ trait LensTrait
/** /**
* Get maxFocalLength * Get maxFocalLength
* *
* @return integer * @return int
*/ */
public function getMaxFocalLength() public function getMaxFocalLength()
{ {
@ -301,6 +300,7 @@ trait LensTrait
public function setImageSize(string $imageSize): self public function setImageSize(string $imageSize): self
{ {
$this->imageSize = $imageSize; $this->imageSize = $imageSize;
return $this; return $this;
} }
@ -329,7 +329,7 @@ trait LensTrait
/** /**
* Set received * Set received
* *
* @param boolean $received * @param bool $received
*/ */
public function setReceived($received): self public function setReceived($received): self
{ {
@ -341,7 +341,7 @@ trait LensTrait
/** /**
* Get received * Get received
* *
* @return boolean * @return bool
*/ */
public function getReceived() public function getReceived()
{ {
@ -351,7 +351,7 @@ trait LensTrait
/** /**
* Set formerlyOwned * Set formerlyOwned
* *
* @param boolean $formerlyOwned * @param bool $formerlyOwned
*/ */
public function setFormerlyOwned($formerlyOwned): self public function setFormerlyOwned($formerlyOwned): self
{ {
@ -363,7 +363,7 @@ trait LensTrait
/** /**
* Get formerlyOwned * Get formerlyOwned
* *
* @return boolean * @return bool
*/ */
public function getFormerlyOwned() public function getFormerlyOwned()
{ {
@ -417,7 +417,7 @@ trait LensTrait
/** /**
* Set isTeleconverter * Set isTeleconverter
* *
* @param boolean $isTeleconverter * @param bool $isTeleconverter
*/ */
public function setIsTeleconverter($isTeleconverter): self public function setIsTeleconverter($isTeleconverter): self
{ {
@ -429,7 +429,7 @@ trait LensTrait
/** /**
* Get isTeleconverter * Get isTeleconverter
* *
* @return boolean * @return bool
*/ */
public function getIsTeleconverter() public function getIsTeleconverter()
{ {
@ -439,7 +439,7 @@ trait LensTrait
/** /**
* Set designElements * Set designElements
* *
* @param integer $designElements * @param int $designElements
*/ */
public function setDesignElements($designElements): self public function setDesignElements($designElements): self
{ {
@ -451,7 +451,7 @@ trait LensTrait
/** /**
* Get designElements * Get designElements
* *
* @return integer * @return int
*/ */
public function getDesignElements() public function getDesignElements()
{ {
@ -461,7 +461,7 @@ trait LensTrait
/** /**
* Set designGroups * Set designGroups
* *
* @param integer $designGroups * @param int $designGroups
*/ */
public function setDesignGroups($designGroups): self public function setDesignGroups($designGroups): self
{ {
@ -473,7 +473,7 @@ trait LensTrait
/** /**
* Get designGroups * Get designGroups
* *
* @return integer * @return int
*/ */
public function getDesignGroups() public function getDesignGroups()
{ {
@ -483,7 +483,7 @@ trait LensTrait
/** /**
* Set apertureBlades * Set apertureBlades
* *
* @param integer $apertureBlades * @param int $apertureBlades
*/ */
public function setApertureBlades($apertureBlades): self public function setApertureBlades($apertureBlades): self
{ {
@ -495,7 +495,7 @@ trait LensTrait
/** /**
* Get apertureBlades * Get apertureBlades
* *
* @return integer * @return int
*/ */
public function getApertureBlades(): ?int public function getApertureBlades(): ?int
{ {

View File

@ -13,6 +13,7 @@ use Doctrine\ORM\Mapping as ORM;
class Lenses class Lenses
{ {
use LensTrait; use LensTrait;
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id] #[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\GeneratedValue(strategy: 'IDENTITY')]

View File

@ -14,6 +14,7 @@ use Doctrine\ORM\Mapping as ORM;
class PreviouslyOwnedCamera class PreviouslyOwnedCamera
{ {
use CameraTrait; use CameraTrait;
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id] #[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\GeneratedValue(strategy: 'IDENTITY')]

View File

@ -13,6 +13,7 @@ use Doctrine\ORM\Mapping as ORM;
class PreviouslyOwnedLenses class PreviouslyOwnedLenses
{ {
use LensTrait; use LensTrait;
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id] #[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\GeneratedValue(strategy: 'IDENTITY')]

View File

@ -2,19 +2,19 @@
namespace App\Form; 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 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 class CameraType extends AbstractType
{ {
/** /**
* {@inheritdoc} * {@inheritDoc}
*/ */
public function buildForm(FormBuilderInterface $builder, array $options): void public function buildForm(FormBuilderInterface $builder, array $options): void
{ {
@ -34,7 +34,7 @@ class CameraType extends AbstractType
'127' => '127', '127' => '127',
'620' => '620', '620' => '620',
], ],
] ],
]) ])
->add('cropFactor') ->add('cropFactor')
->add('serial') ->add('serial')
@ -49,18 +49,19 @@ class CameraType extends AbstractType
} }
/** /**
* {@inheritdoc} * {@inheritDoc}
*
* @throws AccessException * @throws AccessException
*/ */
public function configureOptions(OptionsResolver $resolver): void public function configureOptions(OptionsResolver $resolver): void
{ {
$resolver->setDefaults(array( $resolver->setDefaults([
'data_class' => Camera::class 'data_class' => Camera::class,
)); ]);
} }
/** /**
* {@inheritdoc} * {@inheritDoc}
*/ */
public function getBlockPrefix(): string public function getBlockPrefix(): string
{ {

View File

@ -2,18 +2,17 @@
namespace App\Form; namespace App\Form;
use Symfony\Component\Form\{ use App\Entity\CameraType;
AbstractType, FormBuilderInterface use Symfony\Component\Form\AbstractType;
}; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\Exception\AccessException; use Symfony\Component\OptionsResolver\Exception\AccessException;
use App\Entity\CameraType; use Symfony\Component\OptionsResolver\OptionsResolver;
class CameraTypeType extends AbstractType class CameraTypeType extends AbstractType
{ {
/** /**
* {@inheritdoc} * {@inheritDoc}
*/ */
public function buildForm(FormBuilderInterface $builder, array $options): void public function buildForm(FormBuilderInterface $builder, array $options): void
{ {
@ -22,18 +21,19 @@ class CameraTypeType extends AbstractType
} }
/** /**
* {@inheritdoc} * {@inheritDoc}
*
* @throws AccessException * @throws AccessException
*/ */
public function configureOptions(OptionsResolver $resolver): void public function configureOptions(OptionsResolver $resolver): void
{ {
$resolver->setDefaults(array( $resolver->setDefaults([
'data_class' => CameraType::class 'data_class' => CameraType::class,
)); ]);
} }
/** /**
* {@inheritdoc} * {@inheritDoc}
*/ */
public function getBlockPrefix(): string public function getBlockPrefix(): string
{ {

View File

@ -11,7 +11,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class FilmType extends AbstractType class FilmType extends AbstractType
{ {
/** /**
* {@inheritdoc} * {@inheritDoc}
*/ */
public function buildForm(FormBuilderInterface $builder, array $options): void public function buildForm(FormBuilderInterface $builder, array $options): void
{ {
@ -32,14 +32,14 @@ class FilmType extends AbstractType
'127' => '127', '127' => '127',
'620' => '620', '620' => '620',
], ],
] ],
]) ])
->add('filmBase',ChoiceType::class, [ ->add('filmBase', ChoiceType::class, [
'choices' => [ 'choices' => [
'Cellulose Triacetate' => 'Cellulose Triacetate', 'Cellulose Triacetate' => 'Cellulose Triacetate',
'Polyester' => 'Polyester', 'Polyester' => 'Polyester',
'Polyethylene Naphtalate' => 'Polyethylene Naphtalate', 'Polyethylene Naphtalate' => 'Polyethylene Naphtalate',
] ],
]) ])
->add('unusedRolls') ->add('unusedRolls')
->add('rollsInCamera') ->add('rollsInCamera')
@ -50,23 +50,23 @@ class FilmType extends AbstractType
'C-41' => 'C-41', 'C-41' => 'C-41',
'E-6' => 'E-6', 'E-6' => 'E-6',
'Other' => 'Other', 'Other' => 'Other',
] ],
]) ])
->add('notes'); ->add('notes');
} }
/** /**
* {@inheritdoc} * {@inheritDoc}
*/ */
public function configureOptions(OptionsResolver $resolver): void public function configureOptions(OptionsResolver $resolver): void
{ {
$resolver->setDefaults(array( $resolver->setDefaults([
'data_class' => Film::class 'data_class' => Film::class,
)); ]);
} }
/** /**
* {@inheritdoc} * {@inheritDoc}
*/ */
public function getBlockPrefix(): string public function getBlockPrefix(): string
{ {

View File

@ -2,18 +2,17 @@
namespace App\Form; 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 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 class FlashType extends AbstractType
{ {
/** /**
* {@inheritdoc} * {@inheritDoc}
*/ */
public function buildForm(FormBuilderInterface $builder, array $options): void public function buildForm(FormBuilderInterface $builder, array $options): void
{ {
@ -34,18 +33,19 @@ class FlashType extends AbstractType
} }
/** /**
* {@inheritdoc} * {@inheritDoc}
*
* @throws AccessException * @throws AccessException
*/ */
public function configureOptions(OptionsResolver $resolver): void public function configureOptions(OptionsResolver $resolver): void
{ {
$resolver->setDefaults(array( $resolver->setDefaults([
'data_class' => Flash::class 'data_class' => Flash::class,
)); ]);
} }
/** /**
* {@inheritdoc} * {@inheritDoc}
*/ */
public function getBlockPrefix(): string public function getBlockPrefix(): string
{ {

View File

@ -2,18 +2,18 @@
namespace App\Form; 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 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 class LensesType extends AbstractType
{ {
/** /**
* {@inheritdoc} * {@inheritDoc}
*/ */
public function buildForm(FormBuilderInterface $builder, array $options): void public function buildForm(FormBuilderInterface $builder, array $options): void
{ {
@ -33,8 +33,8 @@ class LensesType extends AbstractType
'6x6' => '6x6cm', '6x6' => '6x6cm',
'6x4.5' => '6x4.5cm', '6x4.5' => '6x4.5cm',
'4x4' => '4x4cm', '4x4' => '4x4cm',
] ],
] ],
]) ])
->add('minFStop') ->add('minFStop')
->add('maxFStop') ->add('maxFStop')
@ -54,18 +54,19 @@ class LensesType extends AbstractType
} }
/** /**
* {@inheritdoc} * {@inheritDoc}
*
* @throws AccessException * @throws AccessException
*/ */
public function configureOptions(OptionsResolver $resolver): void public function configureOptions(OptionsResolver $resolver): void
{ {
$resolver->setDefaults(array( $resolver->setDefaults([
'data_class' => Lenses::class 'data_class' => Lenses::class,
)); ]);
} }
/** /**
* {@inheritdoc} * {@inheritDoc}
*/ */
public function getBlockPrefix(): string public function getBlockPrefix(): string
{ {

View File

@ -2,16 +2,17 @@
namespace App\Form; 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 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 class PreviouslyOwnedCameraType extends AbstractType
{ {
/** /**
* {@inheritdoc} * {@inheritDoc}
*/ */
public function buildForm(FormBuilderInterface $builder, array $options): void public function buildForm(FormBuilderInterface $builder, array $options): void
{ {
@ -32,18 +33,19 @@ class PreviouslyOwnedCameraType extends AbstractType
} }
/** /**
* {@inheritdoc} * {@inheritDoc}
*
* @throws AccessException * @throws AccessException
*/ */
public function configureOptions(OptionsResolver $resolver): void public function configureOptions(OptionsResolver $resolver): void
{ {
$resolver->setDefaults(array( $resolver->setDefaults([
'data_class' => PreviouslyOwnedCamera::class 'data_class' => PreviouslyOwnedCamera::class,
)); ]);
} }
/** /**
* {@inheritdoc} * {@inheritDoc}
*/ */
public function getBlockPrefix(): string public function getBlockPrefix(): string
{ {

View File

@ -2,16 +2,17 @@
namespace App\Form; 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 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 class PreviouslyOwnedFlashType extends AbstractType
{ {
/** /**
* {@inheritdoc} * {@inheritDoc}
*/ */
public function buildForm(FormBuilderInterface $builder, array $options): void public function buildForm(FormBuilderInterface $builder, array $options): void
{ {
@ -33,18 +34,19 @@ class PreviouslyOwnedFlashType extends AbstractType
} }
/** /**
* {@inheritdoc} * {@inheritDoc}
*
* @throws AccessException * @throws AccessException
*/ */
public function configureOptions(OptionsResolver $resolver): void public function configureOptions(OptionsResolver $resolver): void
{ {
$resolver->setDefaults(array( $resolver->setDefaults([
'data_class' => PreviouslyOwnedFlash::class 'data_class' => PreviouslyOwnedFlash::class,
)); ]);
} }
/** /**
* {@inheritdoc} * {@inheritDoc}
*/ */
public function getBlockPrefix(): string public function getBlockPrefix(): string
{ {

View File

@ -2,16 +2,17 @@
namespace App\Form; 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 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 class PreviouslyOwnedLensesType extends AbstractType
{ {
/** /**
* {@inheritdoc} * {@inheritDoc}
*/ */
public function buildForm(FormBuilderInterface $builder, array $options): void public function buildForm(FormBuilderInterface $builder, array $options): void
{ {
@ -39,18 +40,19 @@ class PreviouslyOwnedLensesType extends AbstractType
} }
/** /**
* {@inheritdoc} * {@inheritDoc}
*
* @throws AccessException * @throws AccessException
*/ */
public function configureOptions(OptionsResolver $resolver): void public function configureOptions(OptionsResolver $resolver): void
{ {
$resolver->setDefaults(array( $resolver->setDefaults([
'data_class' => PreviouslyOwnedLenses::class 'data_class' => PreviouslyOwnedLenses::class,
)); ]);
} }
/** /**
* {@inheritdoc} * {@inheritDoc}
*/ */
public function getBlockPrefix(): string public function getBlockPrefix(): string
{ {

View File

@ -23,14 +23,14 @@ class Kernel extends BaseKernel
protected function configureContainer(ContainerConfigurator $container): void protected function configureContainer(ContainerConfigurator $container): void
{ {
$container->import('../config/{packages}/*.yaml'); $container->import('../config/{packages}/*.yaml');
$container->import('../config/{packages}/'.$this->environment.'/*.yaml'); $container->import('../config/{packages}/' . $this->environment . '/*.yaml');
$container->import('../config/{services}.yaml'); $container->import('../config/{services}.yaml');
$container->import('../config/{services}_'.$this->environment.'.yaml'); $container->import('../config/{services}_' . $this->environment . '.yaml');
} }
protected function configureRoutes(RoutingConfigurator $routes): void protected function configureRoutes(RoutingConfigurator $routes): void
{ {
$routes->import('../config/{routes}/'.$this->environment.'/*.yaml'); $routes->import('../config/{routes}/' . $this->environment . '/*.yaml');
$routes->import('../config/{routes}/*.yaml'); $routes->import('../config/{routes}/*.yaml');
$routes->import('../config/{routes}.yaml'); $routes->import('../config/{routes}.yaml');
} }

View File

@ -4,8 +4,9 @@ namespace App\Repository;
use ReflectionObject; use ReflectionObject;
use Throwable; use Throwable;
trait AcquireTrait {
trait AcquireTrait
{
/** /**
* Move a record from the table represented by $currentRecord * Move a record from the table represented by $currentRecord
* into the table represented by $newRecord * into the table represented by $newRecord
@ -30,14 +31,11 @@ trait AcquireTrait {
} }
} }
try try {
{
$em->persist($newRecord); $em->persist($newRecord);
$em->remove($currentRecord); $em->remove($currentRecord);
$em->flush(); $em->flush();
} } catch (Throwable) {
catch (Throwable)
{
dump($newRecord); dump($newRecord);
} }
} }

View File

@ -2,17 +2,16 @@
namespace App\Repository; namespace App\Repository;
use App\Entity\{Camera, PreviouslyOwnedCamera}; use App\Entity\Camera;
use Doctrine\ORM\{ use App\Entity\PreviouslyOwnedCamera;
EntityRepository, ORMInvalidArgumentException use Doctrine\ORM\EntityRepository;
}; use Doctrine\ORM\ORMInvalidArgumentException;
class CameraRepository extends EntityRepository {
class CameraRepository extends EntityRepository
{
use AcquireTrait; use AcquireTrait;
/** /**
* @param Camera $currentRecord
* @throws ORMInvalidArgumentException * @throws ORMInvalidArgumentException
*/ */
public function deacquire(Camera $currentRecord): void public function deacquire(Camera $currentRecord): void
@ -24,7 +23,6 @@ class CameraRepository extends EntityRepository {
} }
/** /**
* @param PreviouslyOwnedCamera $currentRecord
* @throws ORMInvalidArgumentException * @throws ORMInvalidArgumentException
*/ */
public function reacquire(PreviouslyOwnedCamera $currentRecord): void public function reacquire(PreviouslyOwnedCamera $currentRecord): void

View File

@ -2,17 +2,16 @@
namespace App\Repository; namespace App\Repository;
use App\Entity\{Flash, PreviouslyOwnedFlash}; use App\Entity\Flash;
use Doctrine\ORM\{ use App\Entity\PreviouslyOwnedFlash;
EntityRepository, ORMInvalidArgumentException use Doctrine\ORM\EntityRepository;
}; use Doctrine\ORM\ORMInvalidArgumentException;
class FlashRepository extends EntityRepository {
class FlashRepository extends EntityRepository
{
use AcquireTrait; use AcquireTrait;
/** /**
* @param Flash $currentRecord
* @throws ORMInvalidArgumentException * @throws ORMInvalidArgumentException
*/ */
public function deacquire(Flash $currentRecord): void public function deacquire(Flash $currentRecord): void
@ -24,7 +23,6 @@ class FlashRepository extends EntityRepository {
} }
/** /**
* @param PreviouslyOwnedFlash $currentRecord
* @throws ORMInvalidArgumentException * @throws ORMInvalidArgumentException
*/ */
public function reacquire(PreviouslyOwnedFlash $currentRecord): void public function reacquire(PreviouslyOwnedFlash $currentRecord): void

View File

@ -2,16 +2,14 @@
namespace App\Repository; namespace App\Repository;
use App\Entity\{Lenses, PreviouslyOwnedLenses}; use App\Entity\Lenses;
use App\Entity\PreviouslyOwnedLenses;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
class LensesRepository extends EntityRepository class LensesRepository extends EntityRepository
{ {
use AcquireTrait; use AcquireTrait;
/**
* @param Lenses $currentRecord
*/
public function deacquire(Lenses $currentRecord): void public function deacquire(Lenses $currentRecord): void
{ {
$currentRecord->setFormerlyOwned(true) $currentRecord->setFormerlyOwned(true)
@ -20,9 +18,6 @@ class LensesRepository extends EntityRepository
$this->moveRecord($currentRecord, new PreviouslyOwnedLenses()); $this->moveRecord($currentRecord, new PreviouslyOwnedLenses());
} }
/**
* @param PreviouslyOwnedLenses $currentRecord
*/
public function reacquire(PreviouslyOwnedLenses $currentRecord): void public function reacquire(PreviouslyOwnedLenses $currentRecord): void
{ {
$currentRecord->setFormerlyOwned(false); $currentRecord->setFormerlyOwned(false);

View File

@ -2,13 +2,13 @@
namespace App\Types; namespace App\Types;
use Doctrine\DBAL\Types\Type; use App\ValueObject\Money;
use Doctrine\DBAL\Platforms\AbstractPlatform; 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 public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
{ {
return 'MONEY'; return 'MONEY';
@ -16,7 +16,7 @@ class MoneyType extends Type {
public function convertToPHPValue($value, AbstractPlatform $platform): float public function convertToPHPValue($value, AbstractPlatform $platform): float
{ {
return (float) (string)new Money($value); return (float) (string) new Money($value);
} }
public function getName(): string public function getName(): string
@ -26,6 +26,6 @@ class MoneyType extends Type {
public function requiresSQLCommentHint(AbstractPlatform $platform): bool public function requiresSQLCommentHint(AbstractPlatform $platform): bool
{ {
return TRUE; return true;
} }
} }

View File

@ -1,23 +1,25 @@
<?php <?php declare(strict_types=1);
namespace App\ValueObject; namespace App\ValueObject;
use Stringable; use Stringable;
class Money implements Stringable {
class Money implements Stringable
{
private readonly float $value; private readonly float $value;
public function __construct($value) public function __construct($value)
{ {
$this->value = (float)str_replace(['$',','], '', $value); $this->value = (float) str_replace(['$', ','], '', $value);
} }
public function getValue(): float public function getValue(): float
{ {
return (float)str_replace(['$',','], '', $this->value); return (float) str_replace(['$', ','], '', $this->value);
} }
public function __toString(): string public function __toString(): string
{ {
return (string)$this->getValue(); return (string) $this->getValue();
} }
} }

View File

@ -1,11 +1,11 @@
<?php <?php declare(strict_types=1);
use Symfony\Component\Dotenv\Dotenv; use Symfony\Component\Dotenv\Dotenv;
require dirname(__DIR__).'/vendor/autoload.php'; require dirname(__DIR__) . '/vendor/autoload.php';
if (file_exists(dirname(__DIR__).'/config/bootstrap.php')) { if (file_exists(dirname(__DIR__) . '/config/bootstrap.php')) {
require dirname(__DIR__).'/config/bootstrap.php'; require dirname(__DIR__) . '/config/bootstrap.php';
} elseif (method_exists(Dotenv::class, 'bootEnv')) { } elseif (method_exists(Dotenv::class, 'bootEnv')) {
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env'); (new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');
} }

View File

@ -1,4 +1,4 @@
<?php <?php declare(strict_types=1);
return [ return [
'' => '', '' => '',

View File

@ -1,4 +1,4 @@
<?php <?php declare(strict_types=1);
return [ return [
'This value should be false.' => 'This value should be false.', 'This value should be false.' => 'This value should be false.',