More refactoring

This commit is contained in:
Timothy Warren 2022-02-18 11:34:25 -05:00
parent 41caca2722
commit ea2ec447e6
21 changed files with 224 additions and 305 deletions

View File

@ -22,10 +22,13 @@ 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)
{ {
} }
/** /**
* Lists all camera entities. * Lists all camera entities.
*/ */
@ -56,6 +59,7 @@ class CameraController extends AbstractController
'working' => $working, 'working' => $working,
]); ]);
} }
/** /**
* Creates a new camera entity. * Creates a new camera entity.
*/ */
@ -64,6 +68,7 @@ class CameraController extends AbstractController
{ {
return $this->itemCreate($request, 'camera/new.html.twig', 'camera', 'camera_show'); return $this->itemCreate($request, 'camera/new.html.twig', 'camera', 'camera_show');
} }
/** /**
* Finds and displays a camera entity. * Finds and displays a camera entity.
*/ */
@ -72,6 +77,7 @@ class CameraController extends AbstractController
{ {
return $this->itemView($camera, 'camera/show.html.twig', 'camera'); return $this->itemView($camera, 'camera/show.html.twig', 'camera');
} }
/** /**
* Displays a form to edit an existing camera entity. * Displays a form to edit an existing camera entity.
* *
@ -82,6 +88,7 @@ class CameraController extends AbstractController
{ {
return $this->itemUpdate($request, $camera, 'camera/edit.html.twig', 'camera', 'camera_show'); return $this->itemUpdate($request, $camera, 'camera/edit.html.twig', 'camera', 'camera_show');
} }
/** /**
* Deletes a camera entity. * Deletes a camera entity.
* *
@ -92,6 +99,7 @@ class CameraController extends AbstractController
{ {
return $this->itemDelete($request, $camera, 'camera_index'); return $this->itemDelete($request, $camera, 'camera_index');
} }
/** /**
* Moves a camera to the previouslyOwned table * Moves a camera to the previouslyOwned table
* *
@ -103,6 +111,7 @@ class CameraController extends AbstractController
{ {
return $this->itemDeacquire($request, $camera, 'previously-owned-camera_index'); return $this->itemDeacquire($request, $camera, 'previously-owned-camera_index');
} }
/** /**
* Creates a form to delete a camera entity. * Creates a form to delete a camera entity.
* *
@ -114,6 +123,7 @@ class CameraController extends AbstractController
{ {
return $this->buildForm($camera, 'camera_delete', 'DELETE'); return $this->buildForm($camera, 'camera_delete', 'DELETE');
} }
/** /**
* Creates a form to move * Creates a form to move
* *
@ -123,10 +133,12 @@ class CameraController extends AbstractController
{ {
return $this->buildForm($camera, 'camera_deacquire'); return $this->buildForm($camera, 'camera_deacquire');
} }
private function isWorking(Camera $camera): bool private function isWorking(Camera $camera): bool
{ {
return $camera->getIsWorking(); return $camera->getIsWorking();
} }
private function isNotWorking(Camera $camera): bool private function isNotWorking(Camera $camera): bool
{ {
return !$this->isWorking($camera); return !$this->isWorking($camera);

View File

@ -2,72 +2,80 @@
namespace App\Controller; namespace App\Controller;
use Symfony\Component\Form\Form;
use App\Entity\CameraType; use App\Entity\CameraType;
use App\Form\CameraTypeType; use App\Form\CameraTypeType;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
/**
* Cameratype controller.
*/
#[Route(path: 'camera-type')] #[Route(path: 'camera-type')]
class CameraTypeController extends AbstractController class CameraTypeController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = CameraType::class; protected const ENTITY = CameraType::class;
protected const FORM = CameraTypeType::class; protected const FORM = CameraTypeType::class;
public function __construct(private readonly ManagerRegistry $managerRegistry)
{
}
/** /**
* Lists all cameraType entities. * Lists all cameraType entities.
*/ */
#[Route(path: '/', name: 'camera-type_index', methods: ['GET'])] #[Route(path: '/', name: 'camera-type_index', methods: ['GET'])]
public function indexAction() public function indexAction(): Response
{ {
return $this->itemListView('cameratype/index.html.twig', 'cameraTypes', [ return $this->itemListView('cameratype/index.html.twig', 'cameraTypes', [
'type' => 'ASC', 'type' => 'ASC',
]); ]);
} }
/** /**
* Creates a new cameraType entity. * Creates a new cameraType entity.
*/ */
#[Route(path: '/new', name: 'camera-type_new', methods: ['GET', 'POST'])] #[Route(path: '/new', name: 'camera-type_new', methods: ['GET', 'POST'])]
public function newAction(Request $request) public function newAction(Request $request): Response
{ {
return $this->itemCreate($request, 'cameratype/new.html.twig', 'cameraType', 'camera-type_show'); return $this->itemCreate($request, 'cameratype/new.html.twig', 'cameraType', 'camera-type_show');
} }
/** /**
* Finds and displays a cameraType entity. * Finds and displays a cameraType entity.
*/ */
#[Route(path: '/{id}', name: 'camera-type_show', methods: ['GET'])] #[Route(path: '/{id}', name: 'camera-type_show', methods: ['GET'])]
public function showAction(CameraType $cameraType) public function showAction(CameraType $cameraType): Response
{ {
return $this->itemView($cameraType, 'cameratype/show.html.twig', 'cameraType'); return $this->itemView($cameraType, 'cameratype/show.html.twig', 'cameraType');
} }
/** /**
* Displays a form to edit an existing cameraType entity. * Displays a form to edit an existing cameraType entity.
*/ */
#[Route(path: '/{id}/edit', name: 'camera-type_edit', methods: ['GET', 'POST'])] #[Route(path: '/{id}/edit', name: 'camera-type_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, CameraType $cameraType) public function editAction(Request $request, CameraType $cameraType): RedirectResponse|Response
{ {
return $this->itemUpdate($request, $cameraType, 'cameratype/edit.html.twig', 'cameraType', 'camera-type_show'); return $this->itemUpdate($request, $cameraType, 'cameratype/edit.html.twig', 'cameraType', 'camera-type_show');
} }
/** /**
* Deletes a cameraType entity. * Deletes a cameraType entity.
*/ */
#[Route(path: '/{id}', name: 'camera-type_delete', methods: ['DELETE'])] #[Route(path: '/{id}', name: 'camera-type_delete', methods: ['DELETE'])]
public function deleteAction(Request $request, CameraType $cameraType) public function deleteAction(Request $request, CameraType $cameraType): RedirectResponse
{ {
return $this->itemDelete($request, $cameraType, 'camera-type_index'); return $this->itemDelete($request, $cameraType, 'camera-type_index');
} }
/** /**
* Creates a form to delete a cameraType entity. * Creates a form to delete a cameraType entity.
*
* @param CameraType $cameraType The cameraType entity
*
* @return Form The form
*/ */
private function createDeleteForm(CameraType $cameraType) private function createDeleteForm(CameraType $cameraType): FormInterface
{ {
return $this->buildForm($cameraType, 'camera-type_delete', 'DELETE'); return $this->buildForm($cameraType, 'camera-type_delete', 'DELETE');
} }

View File

@ -21,10 +21,13 @@ 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)
{ {
} }
/** /**
* Lists all film entities. * Lists all film entities.
*/ */
@ -53,6 +56,7 @@ class FilmController extends AbstractController
'films' => $notInCamera, 'films' => $notInCamera,
]); ]);
} }
/** /**
* Creates a new film entity. * Creates a new film entity.
*/ */
@ -61,6 +65,7 @@ class FilmController extends AbstractController
{ {
return $this->itemCreate($request, 'film/new.html.twig', 'film', 'film_show'); return $this->itemCreate($request, 'film/new.html.twig', 'film', 'film_show');
} }
/** /**
* Finds and displays a film entity. * Finds and displays a film entity.
*/ */
@ -69,6 +74,7 @@ class FilmController extends AbstractController
{ {
return $this->itemView($film, 'film/show.html.twig', 'film'); return $this->itemView($film, 'film/show.html.twig', 'film');
} }
/** /**
* Displays a form to edit an existing film entity. * Displays a form to edit an existing film entity.
* *
@ -79,6 +85,7 @@ class FilmController extends AbstractController
{ {
return $this->itemUpdate($request, $film, 'film/edit.html.twig', 'film', 'film_show'); return $this->itemUpdate($request, $film, 'film/edit.html.twig', 'film', 'film_show');
} }
/** /**
* Deletes a film entity. * Deletes a film entity.
* *
@ -89,6 +96,7 @@ class FilmController extends AbstractController
{ {
return $this->itemDelete($request, $film, 'film_index'); return $this->itemDelete($request, $film, 'film_index');
} }
/** /**
* Creates a form to delete a film entity. * Creates a form to delete a film entity.
* *

View File

@ -2,10 +2,13 @@
namespace App\Controller; namespace App\Controller;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormInterface;
use App\Entity\Flash; use App\Entity\Flash;
use App\Form\FlashType; use App\Form\FlashType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@ -16,56 +19,64 @@ use Symfony\Component\HttpFoundation\Request;
class FlashController extends AbstractController class FlashController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = Flash::class; protected const ENTITY = Flash::class;
protected const FORM = FlashType::class; protected const FORM = FlashType::class;
public function __construct(private readonly ManagerRegistry $managerRegistry)
{
}
/** /**
* Lists all flash entities. * Lists all flash entities.
*/ */
#[Route(path: '/', name: 'flash_index', methods: ['GET'])] #[Route(path: '/', name: 'flash_index', methods: ['GET'])]
public function indexAction() public function indexAction(): Response
{ {
return $this->itemListView('flash/index.html.twig', 'flashes'); return $this->itemListView('flash/index.html.twig', 'flashes');
} }
/** /**
* Creates a new flash entity. * Creates a new flash entity.
*/ */
#[Route(path: '/new', name: 'flash_new', methods: ['GET', 'POST'])] #[Route(path: '/new', name: 'flash_new', methods: ['GET', 'POST'])]
public function newAction(Request $request) public function newAction(Request $request): RedirectResponse|Response
{ {
return $this->itemCreate($request, 'flash/new.html.twig', 'flash', 'flash_show'); return $this->itemCreate($request, 'flash/new.html.twig', 'flash', 'flash_show');
} }
/** /**
* Finds and displays a flash entity. * Finds and displays a flash entity.
*/ */
#[Route(path: '/{id}', name: 'flash_show', methods: ['GET'])] #[Route(path: '/{id}', name: 'flash_show', methods: ['GET'])]
public function showAction(Flash $flash) public function showAction(Flash $flash): Response
{ {
return $this->itemView($flash, 'flash/show.html.twig', 'flash'); return $this->itemView($flash, 'flash/show.html.twig', 'flash');
} }
/** /**
* Displays a form to edit an existing flash entity. * Displays a form to edit an existing flash entity.
*/ */
#[Route(path: '/{id}/edit', name: 'flash_edit', methods: ['GET', 'POST'])] #[Route(path: '/{id}/edit', name: 'flash_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, Flash $flash) public function editAction(Request $request, Flash $flash): RedirectResponse|Response
{ {
return $this->itemUpdate($request, $flash, 'flash/edit.html.twig', 'flash', 'flash_show'); return $this->itemUpdate($request, $flash, 'flash/edit.html.twig', 'flash', 'flash_show');
} }
/** /**
* Deletes a flash entity. * Deletes a flash entity.
*/ */
#[Route(path: '/{id}', name: 'flash_delete', methods: ['DELETE'])] #[Route(path: '/{id}', name: 'flash_delete', methods: ['DELETE'])]
public function deleteAction(Request $request, Flash $flash) public function deleteAction(Request $request, Flash $flash): RedirectResponse
{ {
return $this->itemDelete($request, $flash, 'flash_index'); return $this->itemDelete($request, $flash, 'flash_index');
} }
/** /**
* Creates a form to delete a flash entity. * Creates a form to delete a flash entity.
*
* @param Flash $flash The flash entity
*
* @return FormInterface The form
*/ */
private function createDeleteForm(Flash $flash) private function createDeleteForm(Flash $flash): FormInterface
{ {
return $this->buildForm($flash, 'flash_delete', 'DELETE'); return $this->buildForm($flash, 'flash_delete', 'DELETE');
} }

View File

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

View File

@ -18,10 +18,13 @@ 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)
{ {
} }
/** /**
* Lists all lens entities. * Lists all lens entities.
*/ */
@ -52,6 +55,7 @@ class LensesController extends AbstractController
'lenses' => $receivedItems, 'lenses' => $receivedItems,
]); ]);
} }
/** /**
* Creates a new lens entity. * Creates a new lens entity.
*/ */
@ -60,6 +64,7 @@ class LensesController extends AbstractController
{ {
return $this->itemCreate($request, 'lenses/new.html.twig', 'lense', 'lens_show'); return $this->itemCreate($request, 'lenses/new.html.twig', 'lense', 'lens_show');
} }
/** /**
* Finds and displays a lens entity. * Finds and displays a lens entity.
*/ */
@ -68,6 +73,7 @@ class LensesController extends AbstractController
{ {
return $this->itemView($lens, 'lenses/show.html.twig', 'lense'); return $this->itemView($lens, 'lenses/show.html.twig', 'lense');
} }
/** /**
* Displays a form to edit an existing lens entity. * Displays a form to edit an existing lens entity.
*/ */
@ -76,6 +82,7 @@ class LensesController extends AbstractController
{ {
return $this->itemUpdate($request, $lens, 'lenses/edit.html.twig', 'lense', 'lens_show'); return $this->itemUpdate($request, $lens, 'lenses/edit.html.twig', 'lense', 'lens_show');
} }
/** /**
* Moves a camera to the previouslyOwned table * Moves a camera to the previouslyOwned table
* *
@ -87,6 +94,7 @@ class LensesController extends AbstractController
{ {
return $this->itemDeacquire($request, $lens, 'previously-owned-lens_index'); return $this->itemDeacquire($request, $lens, 'previously-owned-lens_index');
} }
/** /**
* Deletes a lens entity. * Deletes a lens entity.
*/ */
@ -95,6 +103,7 @@ class LensesController extends AbstractController
{ {
return $this->itemDelete($request, $lens, 'lens_index'); return $this->itemDelete($request, $lens, 'lens_index');
} }
/** /**
* Creates a form to delete a lens entity. * Creates a form to delete a lens entity.
* *
@ -106,6 +115,7 @@ class LensesController extends AbstractController
{ {
return $this->buildForm($lens, 'lens_delete', 'DELETE'); return $this->buildForm($lens, 'lens_delete', 'DELETE');
} }
/** /**
* Creates a form to move * Creates a form to move
* *

View File

@ -20,7 +20,9 @@ class PreviouslyOwnedCameraController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = PreviouslyOwnedCamera::class; protected const ENTITY = PreviouslyOwnedCamera::class;
protected const FORM = PreviouslyOwnedCameraType::class; protected const FORM = PreviouslyOwnedCameraType::class;
/** /**
* Lists all previouslyOwnedCamera entities. * Lists all previouslyOwnedCamera entities.
* *
@ -35,6 +37,7 @@ class PreviouslyOwnedCameraController extends AbstractController
'model' => 'ASC', 'model' => 'ASC',
]); ]);
} }
/** /**
* Finds and displays a previouslyOwnedCamera entity. * Finds and displays a previouslyOwnedCamera entity.
*/ */
@ -43,6 +46,7 @@ class PreviouslyOwnedCameraController extends AbstractController
{ {
return $this->itemView($previouslyOwnedCamera, 'previouslyownedcamera/show.html.twig', 'previouslyOwnedCamera'); return $this->itemView($previouslyOwnedCamera, 'previouslyownedcamera/show.html.twig', 'previouslyOwnedCamera');
} }
/** /**
* Displays a form to edit an existing previouslyOwnedCamera entity. * Displays a form to edit an existing previouslyOwnedCamera entity.
* *
@ -53,6 +57,7 @@ class PreviouslyOwnedCameraController extends AbstractController
{ {
return $this->itemUpdate($request, $previouslyOwnedCamera, 'previouslyownedcamera/edit.html.twig', 'previouslyOwnedCamera', 'previously-owned-camera_show'); return $this->itemUpdate($request, $previouslyOwnedCamera, 'previouslyownedcamera/edit.html.twig', 'previouslyOwnedCamera', 'previously-owned-camera_show');
} }
/** /**
* Moves a camera to the previouslyOwned table * Moves a camera to the previouslyOwned table
* *
@ -66,6 +71,7 @@ class PreviouslyOwnedCameraController extends AbstractController
{ {
return $this->itemReacquire($request, $camera, 'camera_index'); return $this->itemReacquire($request, $camera, 'camera_index');
} }
/** /**
* Creates a form to move * Creates a form to move
* *

View File

@ -4,7 +4,10 @@ namespace App\Controller;
use App\Entity\PreviouslyOwnedFlash; use App\Entity\PreviouslyOwnedFlash;
use App\Form\PreviouslyOwnedFlashType; use App\Form\PreviouslyOwnedFlashType;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@ -15,16 +18,24 @@ use Symfony\Component\HttpFoundation\Request;
class PreviouslyOwnedFlashController extends AbstractController class PreviouslyOwnedFlashController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = PreviouslyOwnedFlash::class; protected const ENTITY = PreviouslyOwnedFlash::class;
protected const FORM = PreviouslyOwnedFlashType::class; protected const FORM = PreviouslyOwnedFlashType::class;
public function __construct(private readonly ManagerRegistry $managerRegistry)
{
}
/** /**
* Lists all previouslyOwnedFlash entities. * Lists all previouslyOwnedFlash entities.
*/ */
#[Route(path: '/', name: 'previously-owned-flash_index', methods: ['GET'])] #[Route(path: '/', name: 'previously-owned-flash_index', methods: ['GET'])]
public function indexAction() public function indexAction(): Response
{ {
return $this->itemListView('previouslyownedflash/index.html.twig', 'previouslyOwnedFlashes'); return $this->itemListView('previouslyownedflash/index.html.twig', 'previouslyOwnedFlashes');
} }
/** /**
* Creates a new previouslyOwnedFlash entity. * Creates a new previouslyOwnedFlash entity.
*/ */
@ -33,19 +44,21 @@ class PreviouslyOwnedFlashController extends AbstractController
{ {
return $this->itemCreate($request, 'previouslyownedflash/new.html.twig', 'previouslyOwnedFlash', 'previously-owned-flash_show'); return $this->itemCreate($request, 'previouslyownedflash/new.html.twig', 'previouslyOwnedFlash', 'previously-owned-flash_show');
} }
/** /**
* Finds and displays a previouslyOwnedFlash entity. * Finds and displays a previouslyOwnedFlash entity.
*/ */
#[Route(path: '/{id}', name: 'previously-owned-flash_show', methods: ['GET'])] #[Route(path: '/{id}', name: 'previously-owned-flash_show', methods: ['GET'])]
public function showAction(PreviouslyOwnedFlash $previouslyOwnedFlash) public function showAction(PreviouslyOwnedFlash $previouslyOwnedFlash): Response
{ {
return $this->itemView($previouslyOwnedFlash, 'previouslyownedcamera/show.html.twig', 'previouslyOwnedFlash'); return $this->itemView($previouslyOwnedFlash, 'previouslyownedcamera/show.html.twig', 'previouslyOwnedFlash');
} }
/** /**
* Displays a form to edit an existing previouslyOwnedFlash entity. * Displays a form to edit an existing previouslyOwnedFlash entity.
*/ */
#[Route(path: '/{id}/edit', name: 'previously-owned-flash_edit', methods: ['GET', 'POST'])] #[Route(path: '/{id}/edit', name: 'previously-owned-flash_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, PreviouslyOwnedFlash $previouslyOwnedFlash) public function editAction(Request $request, PreviouslyOwnedFlash $previouslyOwnedFlash): RedirectResponse|Response
{ {
return $this->itemUpdate($request, $previouslyOwnedFlash, 'previouslyownedflash/edit.html.twig', 'previouslyOwnedFlash', 'previously-owned-flash_show'); return $this->itemUpdate($request, $previouslyOwnedFlash, 'previouslyownedflash/edit.html.twig', 'previouslyOwnedFlash', 'previously-owned-flash_show');
} }

View File

@ -13,7 +13,9 @@ class PreviouslyOwnedLensesController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = PreviouslyOwnedLenses::class; protected const ENTITY = PreviouslyOwnedLenses::class;
protected const FORM = PreviouslyOwnedLensesType::class; protected const FORM = PreviouslyOwnedLensesType::class;
/** /**
* Lists all previouslyOwnedLense entities. * Lists all previouslyOwnedLense entities.
*/ */
@ -28,6 +30,7 @@ class PreviouslyOwnedLensesController extends AbstractController
'maxFStop' => 'ASC', 'maxFStop' => 'ASC',
]); ]);
} }
/** /**
* Finds and displays a previouslyOwnedLense entity. * Finds and displays a previouslyOwnedLense entity.
*/ */
@ -36,6 +39,7 @@ class PreviouslyOwnedLensesController extends AbstractController
{ {
return $this->itemView($previouslyOwnedLens, 'previouslyownedlenses/show.html.twig', 'previouslyOwnedLense'); return $this->itemView($previouslyOwnedLens, 'previouslyownedlenses/show.html.twig', 'previouslyOwnedLense');
} }
/** /**
* Displays a form to edit an existing previouslyOwnedLense entity. * Displays a form to edit an existing previouslyOwnedLense entity.
*/ */

View File

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

View File

@ -17,16 +17,19 @@ class CameraType implements Stringable
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'camera.camera_type_id_seq', allocationSize: 1, initialValue: 1)] #[ORM\SequenceGenerator(sequenceName: 'camera.camera_type_id_seq', allocationSize: 1, initialValue: 1)]
private int $id; private int $id;
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'type', type: 'string', length: 255, nullable: false)] #[ORM\Column(name: 'type', type: 'string', length: 255, nullable: false)]
private string $type; private string $type;
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'description', type: 'text', nullable: true)] #[ORM\Column(name: 'description', type: 'text', nullable: true)]
private ?string $description = null; private ?string $description = null;
/** /**
* Value for serialization * Value for serialization
*/ */
@ -34,6 +37,7 @@ class CameraType implements Stringable
{ {
return $this->type; return $this->type;
} }
/** /**
* Get id * Get id
*/ */
@ -41,6 +45,7 @@ class CameraType implements Stringable
{ {
return $this->id; return $this->id;
} }
/** /**
* Set type * Set type
* *
@ -52,6 +57,7 @@ class CameraType implements Stringable
return $this; return $this;
} }
/** /**
* Set description * Set description
* *
@ -63,6 +69,7 @@ class CameraType implements Stringable
return $this; return $this;
} }
/** /**
* Get type * Get type
* *
@ -72,6 +79,7 @@ class CameraType implements Stringable
{ {
return $this->type; return $this->type;
} }
/** /**
* Get description * Get description
* *

View File

@ -15,75 +15,90 @@ class Film
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\GeneratedValue(strategy: 'IDENTITY')]
private int $id; private int $id;
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'brand', type: 'string', nullable: false)] #[ORM\Column(name: 'brand', type: 'string', nullable: false)]
private string $brand; private string $brand;
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'product_line', type: 'string', nullable: true)] #[ORM\Column(name: 'product_line', type: 'string', nullable: true)]
private ?string $productLine = null; private ?string $productLine = null;
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'film_name', type: 'string', nullable: false)] #[ORM\Column(name: 'film_name', type: 'string', nullable: false)]
private string $filmName; private string $filmName;
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'film_alias', type: 'string', nullable: true)] #[ORM\Column(name: 'film_alias', type: 'string', nullable: true)]
private ?string $filmAlias = null; private ?string $filmAlias = null;
/** /**
* @var int * @var int
*/ */
#[ORM\Column(name: 'film_speed_asa', type: 'integer', nullable: false)] #[ORM\Column(name: 'film_speed_asa', type: 'integer', nullable: false)]
private int $filmSpeedAsa; private int $filmSpeedAsa;
/** /**
* @var int * @var int
*/ */
#[ORM\Column(name: 'film_speed_din', type: 'integer', nullable: false)] #[ORM\Column(name: 'film_speed_din', type: 'integer', nullable: false)]
private int $filmSpeedDin; private int $filmSpeedDin;
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'film_format', type: 'string', nullable: false)] #[ORM\Column(name: 'film_format', type: 'string', nullable: false)]
private string $filmFormat; private string $filmFormat;
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'film_base', type: 'string', nullable: false, options: ['default' => 'Cellulose Triacetate'])] #[ORM\Column(name: 'film_base', type: 'string', nullable: false, options: ['default' => 'Cellulose Triacetate'])]
private string $filmBase = 'Cellulose Triacetate'; private string $filmBase = 'Cellulose Triacetate';
/** /**
* @var int * @var int
*/ */
#[ORM\Column(name: 'unused_rolls', type: 'integer', nullable: false, options: ['default' => 0])] #[ORM\Column(name: 'unused_rolls', type: 'integer', nullable: false, options: ['default' => 0])]
private int $unusedRolls = 0; private int $unusedRolls = 0;
/** /**
* @var int * @var int
*/ */
#[ORM\Column(name: 'rolls_in_camera', type: 'integer', nullable: false, options: ['default' => 0])] #[ORM\Column(name: 'rolls_in_camera', type: 'integer', nullable: false, options: ['default' => 0])]
private int $rollsInCamera = 0; private int $rollsInCamera = 0;
/** /**
* @var int * @var int
*/ */
#[ORM\Column(name: 'developed_rolls', type: 'integer', nullable: false, options: ['default' => 0])] #[ORM\Column(name: 'developed_rolls', type: 'integer', nullable: false, options: ['default' => 0])]
private int $developedRolls = 0; private int $developedRolls = 0;
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'chemistry', type: 'string', nullable: false, options: ['default' => 'C-41'])] #[ORM\Column(name: 'chemistry', type: 'string', nullable: false, options: ['default' => 'C-41'])]
private string $chemistry = 'C-41'; private string $chemistry = 'C-41';
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'notes', type: 'text', nullable: true)] #[ORM\Column(name: 'notes', type: 'text', nullable: true)]
private ?string $notes = null; private ?string $notes = null;
public function getId(): int public function getId(): int
{ {
return $this->id; return $this->id;
} }
/** /**
* @return string * @return string
*/ */
@ -91,11 +106,13 @@ class Film
{ {
return $this->brand; return $this->brand;
} }
public function setBrand(string $brand): self public function setBrand(string $brand): self
{ {
$this->brand = $brand; $this->brand = $brand;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
@ -103,6 +120,7 @@ class Film
{ {
return $this->productLine; return $this->productLine;
} }
/** /**
* @param string $productLine * @param string $productLine
*/ */
@ -111,6 +129,7 @@ class Film
$this->productLine = $productLine; $this->productLine = $productLine;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
@ -118,11 +137,13 @@ class Film
{ {
return $this->filmName; return $this->filmName;
} }
public function setFilmName(string $filmName): self public function setFilmName(string $filmName): self
{ {
$this->filmName = $filmName; $this->filmName = $filmName;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
@ -130,11 +151,13 @@ class Film
{ {
return $this->filmAlias; return $this->filmAlias;
} }
public function setFilmAlias(string $filmAlias): self public function setFilmAlias(string $filmAlias): self
{ {
$this->filmAlias = $filmAlias; $this->filmAlias = $filmAlias;
return $this; return $this;
} }
/** /**
* @return int * @return int
*/ */
@ -142,11 +165,13 @@ class Film
{ {
return $this->filmSpeedAsa; return $this->filmSpeedAsa;
} }
public function setFilmSpeedAsa(int $filmSpeedAsa): self public function setFilmSpeedAsa(int $filmSpeedAsa): self
{ {
$this->filmSpeedAsa = $filmSpeedAsa; $this->filmSpeedAsa = $filmSpeedAsa;
return $this; return $this;
} }
/** /**
* @return int * @return int
*/ */
@ -154,11 +179,13 @@ class Film
{ {
return $this->filmSpeedDin; return $this->filmSpeedDin;
} }
public function setFilmSpeedDin(int $filmSpeedDin): self public function setFilmSpeedDin(int $filmSpeedDin): self
{ {
$this->filmSpeedDin = $filmSpeedDin; $this->filmSpeedDin = $filmSpeedDin;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
@ -166,11 +193,13 @@ class Film
{ {
return $this->filmFormat; return $this->filmFormat;
} }
public function setFilmFormat(string $filmFormat): self public function setFilmFormat(string $filmFormat): self
{ {
$this->filmFormat = $filmFormat; $this->filmFormat = $filmFormat;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
@ -178,11 +207,13 @@ class Film
{ {
return $this->filmBase; return $this->filmBase;
} }
public function setFilmBase(string $filmBase): self public function setFilmBase(string $filmBase): self
{ {
$this->filmBase = $filmBase; $this->filmBase = $filmBase;
return $this; return $this;
} }
/** /**
* @return int * @return int
*/ */
@ -190,11 +221,13 @@ class Film
{ {
return $this->unusedRolls; return $this->unusedRolls;
} }
public function setUnusedRolls(int $unusedRolls): self public function setUnusedRolls(int $unusedRolls): self
{ {
$this->unusedRolls = $unusedRolls; $this->unusedRolls = $unusedRolls;
return $this; return $this;
} }
/** /**
* @return int * @return int
*/ */
@ -202,11 +235,13 @@ class Film
{ {
return $this->rollsInCamera; return $this->rollsInCamera;
} }
public function setRollsInCamera(int $rollsInCamera): self public function setRollsInCamera(int $rollsInCamera): self
{ {
$this->rollsInCamera = $rollsInCamera; $this->rollsInCamera = $rollsInCamera;
return $this; return $this;
} }
/** /**
* @return int * @return int
*/ */
@ -214,11 +249,13 @@ class Film
{ {
return $this->developedRolls; return $this->developedRolls;
} }
public function setDevelopedRolls(int $developedRolls): self public function setDevelopedRolls(int $developedRolls): self
{ {
$this->developedRolls = $developedRolls; $this->developedRolls = $developedRolls;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
@ -226,11 +263,13 @@ class Film
{ {
return $this->chemistry; return $this->chemistry;
} }
public function setChemistry(string $chemistry): self public function setChemistry(string $chemistry): self
{ {
$this->chemistry = $chemistry; $this->chemistry = $chemistry;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
@ -238,6 +277,7 @@ class Film
{ {
return $this->notes; return $this->notes;
} }
public function setNotes(string $notes): self public function setNotes(string $notes): self
{ {
$this->notes = $notes; $this->notes = $notes;

View File

@ -12,16 +12,19 @@ class FilmFormat
#[ORM\GeneratedValue] #[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')] #[ORM\Column(type: 'integer')]
private int $id; private int $id;
/** /**
* @var int * @var int
*/ */
#[ORM\Column(name: 'number_id', type: 'integer')] #[ORM\Column(name: 'number_id', type: 'integer')]
private int $numberId; private int $numberId;
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'name', type: 'string')] #[ORM\Column(name: 'name', type: 'string')]
private string $name; private string $name;
/** /**
* @return int * @return int
*/ */
@ -29,6 +32,7 @@ class FilmFormat
{ {
return $this->id; return $this->id;
} }
/** /**
* @return int * @return int
*/ */
@ -36,11 +40,13 @@ class FilmFormat
{ {
return $this->numberId; return $this->numberId;
} }
public function setNumberId(int $numberId): self public function setNumberId(int $numberId): self
{ {
$this->numberId = $numberId; $this->numberId = $numberId;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
@ -48,6 +54,7 @@ class FilmFormat
{ {
return $this->name; return $this->name;
} }
public function setName(string $name): self public function setName(string $name): self
{ {
$this->name = $name; $this->name = $name;

View File

@ -12,19 +12,18 @@ use Doctrine\ORM\Mapping as ORM;
class Flash class Flash
{ {
use FlashTrait; use FlashTrait;
/**
* @var integer
*/
#[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')]
#[ORM\SequenceGenerator(sequenceName: 'camera.flash_id_seq', allocationSize: 1, initialValue: 1)] #[ORM\SequenceGenerator(sequenceName: 'camera.flash_id_seq', allocationSize: 1, initialValue: 1)]
private $id; private int $id;
/** /**
* @var boolean * @var boolean
*/ */
#[ORM\Column(name: 'received', type: 'boolean', nullable: false, options: ['default' => false])] #[ORM\Column(name: 'received', type: 'boolean', nullable: false, options: ['default' => false])]
private bool $received = false; private bool $received = false;
/** /**
* @var boolean * @var boolean
*/ */

View File

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

View File

@ -62,12 +62,6 @@ trait LensTrait
#[ORM\Column(name: 'serial', type: 'string', length: 10, nullable: true)] #[ORM\Column(name: 'serial', type: 'string', length: 10, nullable: true)]
private readonly ?string $serial; private readonly ?string $serial;
/**
* @var string
*/
#[ORM\Column(name: 'purchase_price', type: 'money', nullable: true)]
private readonly ?string $purchasePrice;
/** /**
* @var string * @var string
*/ */

View File

@ -18,8 +18,10 @@ class Lenses
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'camera.lenses_id_seq', allocationSize: 1, initialValue: 1)] #[ORM\SequenceGenerator(sequenceName: 'camera.lenses_id_seq', allocationSize: 1, initialValue: 1)]
private int $id; private int $id;
#[ORM\Column(name: 'received', type: 'boolean', nullable: false)] #[ORM\Column(name: 'received', type: 'boolean', nullable: false)]
private bool $received = false; private bool $received = false;
#[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;
} }

View File

@ -12,21 +12,15 @@ use Doctrine\ORM\Mapping as ORM;
class PreviouslyOwnedFlash class PreviouslyOwnedFlash
{ {
use FlashTrait; use FlashTrait;
/**
* @var integer
*/
#[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')]
private $id; private int $id;
/**
* @var boolean
*/
#[ORM\Column(name: 'received', type: 'boolean', nullable: false, options: ['default' => true])] #[ORM\Column(name: 'received', type: 'boolean', nullable: false, options: ['default' => true])]
private bool $received = true; private bool $received = true;
/**
* @var boolean
*/
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false, options: ['default' => true])] #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false, options: ['default' => true])]
private bool $formerlyOwned = true; private bool $formerlyOwned = true;
} }

View File

@ -17,11 +17,13 @@ class PreviouslyOwnedLenses
#[ORM\Id] #[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\GeneratedValue(strategy: 'IDENTITY')]
private int $id; private int $id;
/** /**
* @var boolean * @var boolean
*/ */
#[ORM\Column(name: 'received', type: 'boolean', nullable: false)] #[ORM\Column(name: 'received', type: 'boolean', nullable: false)]
private bool $received = true; private bool $received = true;
/** /**
* @var boolean * @var boolean
*/ */

View File

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

View File

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