Reformat files
This commit is contained in:
parent
c73feb6264
commit
825b84db8a
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
return [
|
||||
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
|
||||
@ -6,7 +6,6 @@ return [
|
||||
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
|
||||
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
|
||||
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
|
||||
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
|
||||
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
|
||||
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
|
||||
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
|
||||
|
@ -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)%"
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
if (file_exists(dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php')) {
|
||||
require 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';
|
||||
}
|
||||
|
@ -1,13 +1,15 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Kernel;
|
||||
use Symfony\Component\Dotenv\Dotenv;
|
||||
use Symfony\Component\ErrorHandler\Debug;
|
||||
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']) {
|
||||
umask(0000);
|
||||
|
@ -2,17 +2,17 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use LogicException;
|
||||
use App\Entity\Camera;
|
||||
use App\Form\CameraType;
|
||||
use Doctrine\ORM\ORMInvalidArgumentException;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use LogicException;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
/**
|
||||
* Camera controller.
|
||||
@ -21,8 +21,8 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
class CameraController extends AbstractController
|
||||
{
|
||||
use FormControllerTrait;
|
||||
protected const ENTITY = Camera::class;
|
||||
|
||||
protected const ENTITY = Camera::class;
|
||||
protected const FORM = CameraType::class;
|
||||
|
||||
public function __construct(private readonly ManagerRegistry $managerRegistry)
|
||||
@ -33,11 +33,11 @@ class CameraController extends AbstractController
|
||||
* Lists all camera entities.
|
||||
*/
|
||||
#[Route(path: '/', name: 'camera_index', methods: ['GET'])]
|
||||
public function indexAction() : Response
|
||||
public function indexAction(): Response
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
$receivedItems = $em->getRepository(self::ENTITY)->findBy([
|
||||
'received' => true
|
||||
'received' => true,
|
||||
], [
|
||||
'isWorking' => 'ASC',
|
||||
'brand' => 'ASC',
|
||||
@ -45,7 +45,7 @@ class CameraController extends AbstractController
|
||||
'model' => 'ASC',
|
||||
]);
|
||||
$newItems = $em->getRepository(self::ENTITY)->findBy([
|
||||
'received' => false
|
||||
'received' => false,
|
||||
], [
|
||||
'brand' => 'ASC',
|
||||
'mount' => 'ASC',
|
||||
@ -53,6 +53,7 @@ class CameraController extends AbstractController
|
||||
]);
|
||||
$working = array_filter($receivedItems, [$this, 'isWorking']);
|
||||
$notWorking = array_filter($receivedItems, [$this, 'isNotWorking']);
|
||||
|
||||
return $this->render('camera/index.html.twig', [
|
||||
'not_received' => $newItems,
|
||||
'not_working' => $notWorking,
|
||||
@ -64,7 +65,7 @@ class CameraController extends AbstractController
|
||||
* Creates a new camera entity.
|
||||
*/
|
||||
#[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');
|
||||
}
|
||||
@ -73,7 +74,7 @@ class CameraController extends AbstractController
|
||||
* Finds and displays a camera entity.
|
||||
*/
|
||||
#[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');
|
||||
}
|
||||
@ -84,7 +85,7 @@ class CameraController extends AbstractController
|
||||
* @throws LogicException
|
||||
*/
|
||||
#[Route(path: '/{id}/edit', name: 'camera_edit', methods: ['GET', 'POST'])]
|
||||
public function editAction(Request $request, Camera $camera)
|
||||
public function editAction(Request $request, Camera $camera): RedirectResponse|Response
|
||||
{
|
||||
return $this->itemUpdate($request, $camera, 'camera/edit.html.twig', 'camera', 'camera_show');
|
||||
}
|
||||
@ -95,7 +96,7 @@ class CameraController extends AbstractController
|
||||
* @throws LogicException
|
||||
*/
|
||||
#[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');
|
||||
}
|
||||
@ -107,7 +108,7 @@ class CameraController extends AbstractController
|
||||
* @throws ORMInvalidArgumentException
|
||||
*/
|
||||
#[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');
|
||||
}
|
||||
@ -141,6 +142,6 @@ class CameraController extends AbstractController
|
||||
|
||||
private function isNotWorking(Camera $camera): bool
|
||||
{
|
||||
return !$this->isWorking($camera);
|
||||
return ! $this->isWorking($camera);
|
||||
}
|
||||
}
|
||||
|
@ -8,9 +8,9 @@ use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
#[Route(path: 'camera-type')]
|
||||
class CameraTypeController extends AbstractController
|
||||
@ -18,7 +18,6 @@ class CameraTypeController extends AbstractController
|
||||
use FormControllerTrait;
|
||||
|
||||
protected const ENTITY = CameraType::class;
|
||||
|
||||
protected const FORM = CameraTypeType::class;
|
||||
|
||||
public function __construct(private readonly ManagerRegistry $managerRegistry)
|
||||
|
@ -3,14 +3,14 @@
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class DefaultController extends AbstractController
|
||||
{
|
||||
#[Route(path: '/', name: 'homepage')]
|
||||
public function indexAction(Request $request) : Response
|
||||
public function indexAction(Request $request): Response
|
||||
{
|
||||
// replace this example code with whatever you need
|
||||
return $this->render('default/index.html.twig', [
|
||||
|
@ -2,16 +2,17 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use LogicException;
|
||||
use App\Entity\Film;
|
||||
use App\Form\FilmType;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use LogicException;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Film controller.
|
||||
@ -20,8 +21,8 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
class FilmController extends AbstractController
|
||||
{
|
||||
use FormControllerTrait;
|
||||
protected const ENTITY = Film::class;
|
||||
|
||||
protected const ENTITY = Film::class;
|
||||
protected const FORM = FilmType::class;
|
||||
|
||||
public function __construct(private readonly ManagerRegistry $managerRegistry)
|
||||
@ -32,7 +33,7 @@ class FilmController extends AbstractController
|
||||
* Lists all film entities.
|
||||
*/
|
||||
#[Route(path: '/', name: 'film_index', methods: ['GET'])]
|
||||
public function indexAction() : Response
|
||||
public function indexAction(): Response
|
||||
{
|
||||
$repo = $this->managerRegistry->getManager()->getRepository(self::ENTITY);
|
||||
$criteria = Criteria::create()
|
||||
@ -51,6 +52,7 @@ class FilmController extends AbstractController
|
||||
'productLine' => 'ASC',
|
||||
'filmFormat' => 'ASC',
|
||||
]);
|
||||
|
||||
return $this->render('film/index.html.twig', [
|
||||
'in_camera' => $inCamera,
|
||||
'films' => $notInCamera,
|
||||
@ -61,7 +63,7 @@ class FilmController extends AbstractController
|
||||
* Creates a new film entity.
|
||||
*/
|
||||
#[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');
|
||||
}
|
||||
@ -70,7 +72,7 @@ class FilmController extends AbstractController
|
||||
* Finds and displays a film entity.
|
||||
*/
|
||||
#[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');
|
||||
}
|
||||
@ -81,7 +83,7 @@ class FilmController extends AbstractController
|
||||
* @throws LogicException
|
||||
*/
|
||||
#[Route(path: '/{id}/edit', name: 'film_edit', methods: ['GET', 'POST'])]
|
||||
public function editAction(Request $request, Film $film)
|
||||
public function editAction(Request $request, Film $film): RedirectResponse|Response
|
||||
{
|
||||
return $this->itemUpdate($request, $film, 'film/edit.html.twig', 'film', 'film_show');
|
||||
}
|
||||
@ -92,7 +94,7 @@ class FilmController extends AbstractController
|
||||
* @throws LogicException
|
||||
*/
|
||||
#[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');
|
||||
}
|
||||
|
@ -2,15 +2,15 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use App\Entity\Flash;
|
||||
use App\Form\FlashType;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Flash controller.
|
||||
@ -21,7 +21,6 @@ class FlashController extends AbstractController
|
||||
use FormControllerTrait;
|
||||
|
||||
protected const ENTITY = Flash::class;
|
||||
|
||||
protected const FORM = FlashType::class;
|
||||
|
||||
public function __construct(private readonly ManagerRegistry $managerRegistry)
|
||||
|
@ -4,13 +4,18 @@ namespace App\Controller;
|
||||
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\{Request, Response, RedirectResponse};
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
trait FormControllerTrait {
|
||||
trait FormControllerTrait
|
||||
{
|
||||
private readonly ManagerRegistry $managerRegistry;
|
||||
|
||||
/**
|
||||
* Create a form generator
|
||||
*
|
||||
* @param mixed $item
|
||||
*/
|
||||
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)
|
||||
{
|
||||
$Entity = self::ENTITY;
|
||||
$item = new $Entity;
|
||||
$item = new $Entity();
|
||||
$form = $this->createForm(self::FORM, $item);
|
||||
$form->handleRequest($request);
|
||||
|
||||
// If creating the item
|
||||
if ($form->isSubmitted() && $form->isValid())
|
||||
{
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->persist($item);
|
||||
$em->flush();
|
||||
@ -63,6 +67,8 @@ trait FormControllerTrait {
|
||||
|
||||
/**
|
||||
* View details for a specific item
|
||||
*
|
||||
* @param mixed $item
|
||||
*/
|
||||
protected function itemView($item, string $template, string $templateKey): Response
|
||||
{
|
||||
@ -80,6 +86,8 @@ trait FormControllerTrait {
|
||||
|
||||
/**
|
||||
* Show edit form / update an item
|
||||
*
|
||||
* @param mixed $item
|
||||
*/
|
||||
protected function itemUpdate(Request $request, $item, string $template, string $templateKey, string $redirectRoute)
|
||||
{
|
||||
@ -87,8 +95,7 @@ trait FormControllerTrait {
|
||||
$editForm->handleRequest($request);
|
||||
|
||||
// If updating the item
|
||||
if ($editForm->isSubmitted() && $editForm->isValid())
|
||||
{
|
||||
if ($editForm->isSubmitted() && $editForm->isValid()) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->persist($item);
|
||||
$em->flush();
|
||||
@ -102,20 +109,17 @@ trait FormControllerTrait {
|
||||
'edit_form' => $editForm->createView(),
|
||||
];
|
||||
|
||||
if (method_exists($this, 'createDeleteForm'))
|
||||
{
|
||||
if (method_exists($this, 'createDeleteForm')) {
|
||||
$deleteForm = $this->createDeleteForm($item);
|
||||
$templateData['delete_form'] = $deleteForm->createView();
|
||||
}
|
||||
|
||||
if (method_exists($this, 'createDeacquireForm'))
|
||||
{
|
||||
if (method_exists($this, 'createDeacquireForm')) {
|
||||
$deacquireForm = $this->createDeacquireForm($item);
|
||||
$templateData['deacquire_form'] = $deacquireForm->createView();
|
||||
}
|
||||
|
||||
if (method_exists($this, 'createReacquireForm'))
|
||||
{
|
||||
if (method_exists($this, 'createReacquireForm')) {
|
||||
$reacquireForm = $this->createReacquireForm($item);
|
||||
$templateData['reacquire_form'] = $reacquireForm->createView();
|
||||
}
|
||||
@ -125,6 +129,8 @@ trait FormControllerTrait {
|
||||
|
||||
/**
|
||||
* Move an item to a previously_owned table
|
||||
*
|
||||
* @param mixed $item
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @param mixed $item
|
||||
*/
|
||||
protected function itemReacquire(Request $request, $item, string $redirectRoute): RedirectResponse
|
||||
{
|
||||
@ -153,6 +161,8 @@ trait FormControllerTrait {
|
||||
|
||||
/**
|
||||
* Actually delete an item
|
||||
*
|
||||
* @param mixed $item
|
||||
*/
|
||||
protected function itemDelete(Request $request, $item, string $redirectRoute): RedirectResponse
|
||||
{
|
||||
@ -160,11 +170,10 @@ trait FormControllerTrait {
|
||||
$form->handleRequest($request);
|
||||
|
||||
// if ($form->isSubmitted() && $form->isValid())
|
||||
{
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->remove($item);
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute($redirectRoute);
|
||||
}
|
||||
|
@ -2,13 +2,15 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use App\Entity\Lenses;
|
||||
use App\Form\LensesType;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\{Request, RedirectResponse};
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
/**
|
||||
* Lens controller.
|
||||
@ -17,8 +19,8 @@ use Symfony\Component\HttpFoundation\{Request, RedirectResponse};
|
||||
class LensesController extends AbstractController
|
||||
{
|
||||
use FormControllerTrait;
|
||||
protected const ENTITY = Lenses::class;
|
||||
|
||||
protected const ENTITY = Lenses::class;
|
||||
protected const FORM = LensesType::class;
|
||||
|
||||
public function __construct(private readonly ManagerRegistry $managerRegistry)
|
||||
@ -29,11 +31,11 @@ class LensesController extends AbstractController
|
||||
* Lists all lens entities.
|
||||
*/
|
||||
#[Route(path: '/', name: 'lens_index', methods: ['GET'])]
|
||||
public function indexAction()
|
||||
public function indexAction(): Response
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
$receivedItems = $em->getRepository(self::ENTITY)->findBy([
|
||||
'received' => true
|
||||
'received' => true,
|
||||
], [
|
||||
'brand' => 'ASC',
|
||||
'productLine' => 'ASC',
|
||||
@ -42,7 +44,7 @@ class LensesController extends AbstractController
|
||||
'maxFStop' => 'ASC',
|
||||
]);
|
||||
$newItems = $em->getRepository(self::ENTITY)->findBy([
|
||||
'received' => false
|
||||
'received' => false,
|
||||
], [
|
||||
'brand' => 'ASC',
|
||||
'productLine' => 'ASC',
|
||||
@ -50,6 +52,7 @@ class LensesController extends AbstractController
|
||||
'minFocalLength' => 'ASC',
|
||||
'maxFStop' => 'ASC',
|
||||
]);
|
||||
|
||||
return $this->render('lenses/index.html.twig', [
|
||||
'not_received' => $newItems,
|
||||
'lenses' => $receivedItems,
|
||||
@ -60,7 +63,7 @@ class LensesController extends AbstractController
|
||||
* Creates a new lens entity.
|
||||
*/
|
||||
#[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');
|
||||
}
|
||||
@ -69,7 +72,7 @@ class LensesController extends AbstractController
|
||||
* Finds and displays a lens entity.
|
||||
*/
|
||||
#[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');
|
||||
}
|
||||
@ -78,7 +81,7 @@ class LensesController extends AbstractController
|
||||
* Displays a form to edit an existing lens entity.
|
||||
*/
|
||||
#[Route(path: '/{id}/edit', name: 'lens_edit', methods: ['GET', 'POST'])]
|
||||
public function editAction(Request $request, Lenses $lens)
|
||||
public function editAction(Request $request, Lenses $lens): RedirectResponse|Response
|
||||
{
|
||||
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
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
#[Route(path: '/{id}/deacquire', name: 'lens_deacquire', methods: ['POST'])]
|
||||
public function deacquireAction(Request $request, Lenses $lens)
|
||||
public function deacquireAction(Request $request, Lenses $lens): RedirectResponse
|
||||
{
|
||||
return $this->itemDeacquire($request, $lens, 'previously-owned-lens_index');
|
||||
}
|
||||
@ -99,7 +103,7 @@ class LensesController extends AbstractController
|
||||
* Deletes a lens entity.
|
||||
*/
|
||||
#[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');
|
||||
}
|
||||
|
@ -2,15 +2,18 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use UnexpectedValueException;
|
||||
use LogicException;
|
||||
use Doctrine\ORM\ORMInvalidArgumentException;
|
||||
use App\Entity\PreviouslyOwnedCamera;
|
||||
use App\Form\PreviouslyOwnedCameraType;
|
||||
use Doctrine\ORM\ORMInvalidArgumentException;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use LogicException;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\{RedirectResponse, Request};
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use UnexpectedValueException;
|
||||
|
||||
/**
|
||||
* Previouslyownedcamera controller.
|
||||
@ -19,17 +22,21 @@ use Symfony\Component\HttpFoundation\{RedirectResponse, Request};
|
||||
class PreviouslyOwnedCameraController extends AbstractController
|
||||
{
|
||||
use FormControllerTrait;
|
||||
protected const ENTITY = PreviouslyOwnedCamera::class;
|
||||
|
||||
protected const ENTITY = PreviouslyOwnedCamera::class;
|
||||
protected const FORM = PreviouslyOwnedCameraType::class;
|
||||
|
||||
public function __construct(private readonly ManagerRegistry $managerRegistry)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all previouslyOwnedCamera entities.
|
||||
*
|
||||
* @throws UnexpectedValueException
|
||||
*/
|
||||
#[Route(path: '/', name: 'previously-owned-camera_index', methods: ['GET'])]
|
||||
public function indexAction()
|
||||
public function indexAction(): Response
|
||||
{
|
||||
return $this->itemListView('previouslyownedcamera/index.html.twig', 'previouslyOwnedCameras', [
|
||||
'brand' => 'ASC',
|
||||
@ -42,7 +49,7 @@ class PreviouslyOwnedCameraController extends AbstractController
|
||||
* Finds and displays a previouslyOwnedCamera entity.
|
||||
*/
|
||||
#[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');
|
||||
}
|
||||
@ -53,7 +60,7 @@ class PreviouslyOwnedCameraController extends AbstractController
|
||||
* @throws LogicException
|
||||
*/
|
||||
#[Route(path: '/{id}/edit', name: 'previously-owned-camera_edit', methods: ['GET', 'POST'])]
|
||||
public function editAction(Request $request, PreviouslyOwnedCamera $previouslyOwnedCamera)
|
||||
public function editAction(Request $request, PreviouslyOwnedCamera $previouslyOwnedCamera): RedirectResponse|Response
|
||||
{
|
||||
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
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @throws LogicException
|
||||
* @throws ORMInvalidArgumentException
|
||||
*
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
#[Route(path: '/{id}/reacquire', name: 'previously-owned-camera_reacquire', methods: ['POST'])]
|
||||
public function reacquireAction(Request $request, PreviouslyOwnedCamera $camera) : RedirectResponse
|
||||
public function reacquireAction(Request $request, PreviouslyOwnedCamera $camera): RedirectResponse
|
||||
{
|
||||
return $this->itemReacquire($request, $camera, 'camera_index');
|
||||
}
|
||||
|
@ -7,9 +7,9 @@ use App\Form\PreviouslyOwnedFlashType;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Previouslyownedflash controller.
|
||||
@ -20,7 +20,6 @@ class PreviouslyOwnedFlashController extends AbstractController
|
||||
use FormControllerTrait;
|
||||
|
||||
protected const ENTITY = PreviouslyOwnedFlash::class;
|
||||
|
||||
protected const FORM = PreviouslyOwnedFlashType::class;
|
||||
|
||||
public function __construct(private readonly ManagerRegistry $managerRegistry)
|
||||
@ -40,7 +39,7 @@ class PreviouslyOwnedFlashController extends AbstractController
|
||||
* Creates a new previouslyOwnedFlash entity.
|
||||
*/
|
||||
#[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');
|
||||
}
|
||||
|
@ -4,23 +4,30 @@ namespace App\Controller;
|
||||
|
||||
use App\Entity\PreviouslyOwnedLenses;
|
||||
use App\Form\PreviouslyOwnedLensesType;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[Route(path: 'previously-owned-lens')]
|
||||
class PreviouslyOwnedLensesController extends AbstractController
|
||||
{
|
||||
use FormControllerTrait;
|
||||
protected const ENTITY = PreviouslyOwnedLenses::class;
|
||||
|
||||
protected const ENTITY = PreviouslyOwnedLenses::class;
|
||||
protected const FORM = PreviouslyOwnedLensesType::class;
|
||||
|
||||
public function __construct(private readonly ManagerRegistry $managerRegistry)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all previouslyOwnedLense entities.
|
||||
*/
|
||||
#[Route(path: '/', name: 'previously-owned-lens_index', methods: ['GET'])]
|
||||
public function indexAction()
|
||||
public function indexAction(): Response
|
||||
{
|
||||
return $this->itemListView('previouslyownedlenses/index.html.twig', 'previouslyOwnedLenses', [
|
||||
'brand' => 'ASC',
|
||||
@ -35,7 +42,7 @@ class PreviouslyOwnedLensesController extends AbstractController
|
||||
* Finds and displays a previouslyOwnedLense entity.
|
||||
*/
|
||||
#[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');
|
||||
}
|
||||
@ -44,7 +51,7 @@ class PreviouslyOwnedLensesController extends AbstractController
|
||||
* Displays a form to edit an existing previouslyOwnedLense entity.
|
||||
*/
|
||||
#[Route(path: '/{id}/edit', name: 'previously-owned-lens_edit', methods: ['GET', 'POST'])]
|
||||
public function editAction(Request $request, PreviouslyOwnedLenses $previouslyOwnedLens)
|
||||
public function editAction(Request $request, PreviouslyOwnedLenses $previouslyOwnedLens): RedirectResponse|Response
|
||||
{
|
||||
return $this->itemUpdate($request, $previouslyOwnedLens, 'previouslyownedlenses/edit.html.twig', 'previouslyOwnedLense', 'previously-owned-lens_show');
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
class Camera
|
||||
{
|
||||
use CameraTrait;
|
||||
|
||||
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
|
||||
|
@ -8,8 +8,6 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
* Trait CameraTrait
|
||||
*
|
||||
* Shared columns for camera, and previously_owned_camera tables
|
||||
*
|
||||
* @package App\Entity
|
||||
*/
|
||||
trait CameraTrait
|
||||
{
|
||||
@ -44,7 +42,7 @@ trait CameraTrait
|
||||
private readonly string $serial;
|
||||
|
||||
#[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)]
|
||||
private readonly ?string $batteryType;
|
||||
@ -53,14 +51,14 @@ trait CameraTrait
|
||||
private ?string $filmFormat = '135';
|
||||
|
||||
#[ORM\Column(name: 'received', type: 'boolean', nullable: true)]
|
||||
private ?bool $received = FALSE;
|
||||
private ?bool $received = false;
|
||||
|
||||
public function getId(): int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setType(CameraType $type = null): self
|
||||
public function setType(?CameraType $type = null): self
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Stringable;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Stringable;
|
||||
|
||||
/**
|
||||
* CameraType
|
||||
@ -42,8 +42,6 @@ class CameraType implements Stringable
|
||||
|
||||
/**
|
||||
* Set type
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function setType(string $type): self
|
||||
{
|
||||
@ -54,8 +52,6 @@ class CameraType implements Stringable
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function setDescription(string $description): self
|
||||
{
|
||||
|
@ -71,6 +71,7 @@ class Film
|
||||
public function setBrand(string $brand): self
|
||||
{
|
||||
$this->brand = $brand;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -88,6 +89,7 @@ class Film
|
||||
public function setProductLine(?string $productLine): self
|
||||
{
|
||||
$this->productLine = $productLine;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -102,6 +104,7 @@ class Film
|
||||
public function setFilmName(string $filmName): self
|
||||
{
|
||||
$this->filmName = $filmName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -116,6 +119,7 @@ class Film
|
||||
public function setFilmAlias(string $filmAlias): self
|
||||
{
|
||||
$this->filmAlias = $filmAlias;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -130,6 +134,7 @@ class Film
|
||||
public function setFilmSpeedAsa(int $filmSpeedAsa): self
|
||||
{
|
||||
$this->filmSpeedAsa = $filmSpeedAsa;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -144,6 +149,7 @@ class Film
|
||||
public function setFilmSpeedDin(int $filmSpeedDin): self
|
||||
{
|
||||
$this->filmSpeedDin = $filmSpeedDin;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -158,6 +164,7 @@ class Film
|
||||
public function setFilmFormat(string $filmFormat): self
|
||||
{
|
||||
$this->filmFormat = $filmFormat;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -172,6 +179,7 @@ class Film
|
||||
public function setFilmBase(string $filmBase): self
|
||||
{
|
||||
$this->filmBase = $filmBase;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -186,6 +194,7 @@ class Film
|
||||
public function setUnusedRolls(int $unusedRolls): self
|
||||
{
|
||||
$this->unusedRolls = $unusedRolls;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -200,6 +209,7 @@ class Film
|
||||
public function setRollsInCamera(int $rollsInCamera): self
|
||||
{
|
||||
$this->rollsInCamera = $rollsInCamera;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -214,6 +224,7 @@ class Film
|
||||
public function setDevelopedRolls(int $developedRolls): self
|
||||
{
|
||||
$this->developedRolls = $developedRolls;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -228,6 +239,7 @@ class Film
|
||||
public function setChemistry(string $chemistry): self
|
||||
{
|
||||
$this->chemistry = $chemistry;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -242,6 +254,7 @@ class Film
|
||||
public function setNotes(string $notes): self
|
||||
{
|
||||
$this->notes = $notes;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ class FilmFormat
|
||||
public function setNumberId(int $numberId): self
|
||||
{
|
||||
$this->numberId = $numberId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -52,6 +53,7 @@ class FilmFormat
|
||||
public function setName(string $name): self
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
class Flash
|
||||
{
|
||||
use FlashTrait;
|
||||
|
||||
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
|
||||
|
@ -48,8 +48,6 @@ trait FlashTrait
|
||||
|
||||
/**
|
||||
* Set brand
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function setBrand(string $brand): self
|
||||
{
|
||||
@ -95,7 +93,7 @@ trait FlashTrait
|
||||
/**
|
||||
* Set isAutoFlash
|
||||
*
|
||||
* @param boolean $isAutoFlash
|
||||
* @param bool $isAutoFlash
|
||||
*
|
||||
* @return Flash
|
||||
*/
|
||||
@ -109,7 +107,7 @@ trait FlashTrait
|
||||
/**
|
||||
* Get isAutoFlash
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function getIsAutoFlash()
|
||||
{
|
||||
@ -119,7 +117,7 @@ trait FlashTrait
|
||||
/**
|
||||
* Set isTtl
|
||||
*
|
||||
* @param boolean $isTtl
|
||||
* @param bool $isTtl
|
||||
*
|
||||
* @return Flash
|
||||
*/
|
||||
@ -133,7 +131,7 @@ trait FlashTrait
|
||||
/**
|
||||
* Get isTtl
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function getIsTtl()
|
||||
{
|
||||
@ -167,7 +165,7 @@ trait FlashTrait
|
||||
/**
|
||||
* Set isPTtl
|
||||
*
|
||||
* @param boolean $isPTtl
|
||||
* @param bool $isPTtl
|
||||
*
|
||||
* @return Flash
|
||||
*/
|
||||
@ -181,7 +179,7 @@ trait FlashTrait
|
||||
/**
|
||||
* Get isPTtl
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function getIsPTtl()
|
||||
{
|
||||
@ -309,7 +307,7 @@ trait FlashTrait
|
||||
/**
|
||||
* Set formerlyOwned
|
||||
*
|
||||
* @param boolean $formerlyOwned
|
||||
* @param bool $formerlyOwned
|
||||
*
|
||||
* @return Flash
|
||||
*/
|
||||
@ -323,7 +321,7 @@ trait FlashTrait
|
||||
/**
|
||||
* Get formerlyOwned
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function getFormerlyOwned()
|
||||
{
|
||||
@ -333,7 +331,7 @@ trait FlashTrait
|
||||
/**
|
||||
* Set received
|
||||
*
|
||||
* @param boolean $received
|
||||
* @param bool $received
|
||||
*
|
||||
* @return Flash
|
||||
*/
|
||||
@ -347,7 +345,7 @@ trait FlashTrait
|
||||
/**
|
||||
* Get received
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function getReceived()
|
||||
{
|
||||
|
@ -48,7 +48,7 @@ trait LensTrait
|
||||
private readonly ?string $frontFilterSize;
|
||||
|
||||
#[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)]
|
||||
private bool $isTeleconverter = false;
|
||||
@ -62,7 +62,6 @@ trait LensTrait
|
||||
#[ORM\Column(name: 'aperture_blades', type: 'smallint', nullable: true)]
|
||||
private readonly ?int $apertureBlades;
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*/
|
||||
@ -206,7 +205,7 @@ trait LensTrait
|
||||
/**
|
||||
* Set minFocalLength
|
||||
*
|
||||
* @param integer $minFocalLength
|
||||
* @param int $minFocalLength
|
||||
*/
|
||||
public function setMinFocalLength($minFocalLength): self
|
||||
{
|
||||
@ -218,7 +217,7 @@ trait LensTrait
|
||||
/**
|
||||
* Get minFocalLength
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
*/
|
||||
public function getMinFocalLength()
|
||||
{
|
||||
@ -228,7 +227,7 @@ trait LensTrait
|
||||
/**
|
||||
* Set maxFocalLength
|
||||
*
|
||||
* @param integer $maxFocalLength
|
||||
* @param int $maxFocalLength
|
||||
*/
|
||||
public function setMaxFocalLength($maxFocalLength): self
|
||||
{
|
||||
@ -240,7 +239,7 @@ trait LensTrait
|
||||
/**
|
||||
* Get maxFocalLength
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
*/
|
||||
public function getMaxFocalLength()
|
||||
{
|
||||
@ -301,6 +300,7 @@ trait LensTrait
|
||||
public function setImageSize(string $imageSize): self
|
||||
{
|
||||
$this->imageSize = $imageSize;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -329,7 +329,7 @@ trait LensTrait
|
||||
/**
|
||||
* Set received
|
||||
*
|
||||
* @param boolean $received
|
||||
* @param bool $received
|
||||
*/
|
||||
public function setReceived($received): self
|
||||
{
|
||||
@ -341,7 +341,7 @@ trait LensTrait
|
||||
/**
|
||||
* Get received
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function getReceived()
|
||||
{
|
||||
@ -351,7 +351,7 @@ trait LensTrait
|
||||
/**
|
||||
* Set formerlyOwned
|
||||
*
|
||||
* @param boolean $formerlyOwned
|
||||
* @param bool $formerlyOwned
|
||||
*/
|
||||
public function setFormerlyOwned($formerlyOwned): self
|
||||
{
|
||||
@ -363,7 +363,7 @@ trait LensTrait
|
||||
/**
|
||||
* Get formerlyOwned
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function getFormerlyOwned()
|
||||
{
|
||||
@ -417,7 +417,7 @@ trait LensTrait
|
||||
/**
|
||||
* Set isTeleconverter
|
||||
*
|
||||
* @param boolean $isTeleconverter
|
||||
* @param bool $isTeleconverter
|
||||
*/
|
||||
public function setIsTeleconverter($isTeleconverter): self
|
||||
{
|
||||
@ -429,7 +429,7 @@ trait LensTrait
|
||||
/**
|
||||
* Get isTeleconverter
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function getIsTeleconverter()
|
||||
{
|
||||
@ -439,7 +439,7 @@ trait LensTrait
|
||||
/**
|
||||
* Set designElements
|
||||
*
|
||||
* @param integer $designElements
|
||||
* @param int $designElements
|
||||
*/
|
||||
public function setDesignElements($designElements): self
|
||||
{
|
||||
@ -451,7 +451,7 @@ trait LensTrait
|
||||
/**
|
||||
* Get designElements
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
*/
|
||||
public function getDesignElements()
|
||||
{
|
||||
@ -461,7 +461,7 @@ trait LensTrait
|
||||
/**
|
||||
* Set designGroups
|
||||
*
|
||||
* @param integer $designGroups
|
||||
* @param int $designGroups
|
||||
*/
|
||||
public function setDesignGroups($designGroups): self
|
||||
{
|
||||
@ -473,7 +473,7 @@ trait LensTrait
|
||||
/**
|
||||
* Get designGroups
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
*/
|
||||
public function getDesignGroups()
|
||||
{
|
||||
@ -483,7 +483,7 @@ trait LensTrait
|
||||
/**
|
||||
* Set apertureBlades
|
||||
*
|
||||
* @param integer $apertureBlades
|
||||
* @param int $apertureBlades
|
||||
*/
|
||||
public function setApertureBlades($apertureBlades): self
|
||||
{
|
||||
@ -495,7 +495,7 @@ trait LensTrait
|
||||
/**
|
||||
* Get apertureBlades
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
*/
|
||||
public function getApertureBlades(): ?int
|
||||
{
|
||||
|
@ -13,6 +13,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
class Lenses
|
||||
{
|
||||
use LensTrait;
|
||||
|
||||
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
|
||||
|
@ -14,6 +14,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
class PreviouslyOwnedCamera
|
||||
{
|
||||
use CameraTrait;
|
||||
|
||||
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
|
||||
|
@ -13,6 +13,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
class PreviouslyOwnedLenses
|
||||
{
|
||||
use LensTrait;
|
||||
|
||||
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
|
||||
|
@ -2,19 +2,19 @@
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use Symfony\Component\Form\{
|
||||
AbstractType, FormBuilderInterface
|
||||
};
|
||||
use Symfony\Component\Form\Extension\Core\Type\{ChoiceType, MoneyType};
|
||||
use Symfony\Component\OptionsResolver\Exception\AccessException;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use App\Entity\Camera;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\Exception\AccessException;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class CameraType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
@ -34,7 +34,7 @@ class CameraType extends AbstractType
|
||||
'127' => '127',
|
||||
'620' => '620',
|
||||
],
|
||||
]
|
||||
],
|
||||
])
|
||||
->add('cropFactor')
|
||||
->add('serial')
|
||||
@ -49,18 +49,19 @@ class CameraType extends AbstractType
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws AccessException
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => Camera::class
|
||||
));
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Camera::class,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
|
@ -2,18 +2,17 @@
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use Symfony\Component\Form\{
|
||||
AbstractType, FormBuilderInterface
|
||||
};
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use App\Entity\CameraType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\Exception\AccessException;
|
||||
|
||||
use App\Entity\CameraType;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class CameraTypeType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
@ -22,18 +21,19 @@ class CameraTypeType extends AbstractType
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws AccessException
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => CameraType::class
|
||||
));
|
||||
$resolver->setDefaults([
|
||||
'data_class' => CameraType::class,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
class FilmType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
@ -32,14 +32,14 @@ class FilmType extends AbstractType
|
||||
'127' => '127',
|
||||
'620' => '620',
|
||||
],
|
||||
]
|
||||
],
|
||||
])
|
||||
->add('filmBase',ChoiceType::class, [
|
||||
->add('filmBase', ChoiceType::class, [
|
||||
'choices' => [
|
||||
'Cellulose Triacetate' => 'Cellulose Triacetate',
|
||||
'Polyester' => 'Polyester',
|
||||
'Polyethylene Naphtalate' => 'Polyethylene Naphtalate',
|
||||
]
|
||||
],
|
||||
])
|
||||
->add('unusedRolls')
|
||||
->add('rollsInCamera')
|
||||
@ -50,23 +50,23 @@ class FilmType extends AbstractType
|
||||
'C-41' => 'C-41',
|
||||
'E-6' => 'E-6',
|
||||
'Other' => 'Other',
|
||||
]
|
||||
],
|
||||
])
|
||||
->add('notes');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => Film::class
|
||||
));
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Film::class,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
|
@ -2,18 +2,17 @@
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use Symfony\Component\Form\{
|
||||
AbstractType, FormBuilderInterface
|
||||
};
|
||||
use Symfony\Component\OptionsResolver\Exception\AccessException;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use App\Entity\Flash;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\Exception\AccessException;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class FlashType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
@ -34,18 +33,19 @@ class FlashType extends AbstractType
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws AccessException
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => Flash::class
|
||||
));
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Flash::class,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
|
@ -2,18 +2,18 @@
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use Symfony\Component\Form\{
|
||||
AbstractType, Extension\Core\Type\ChoiceType, FormBuilderInterface
|
||||
};
|
||||
use Symfony\Component\OptionsResolver\Exception\AccessException;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use App\Entity\Lenses;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\Exception\AccessException;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class LensesType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
@ -33,8 +33,8 @@ class LensesType extends AbstractType
|
||||
'6x6' => '6x6cm',
|
||||
'6x4.5' => '6x4.5cm',
|
||||
'4x4' => '4x4cm',
|
||||
]
|
||||
]
|
||||
],
|
||||
],
|
||||
])
|
||||
->add('minFStop')
|
||||
->add('maxFStop')
|
||||
@ -54,18 +54,19 @@ class LensesType extends AbstractType
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws AccessException
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => Lenses::class
|
||||
));
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Lenses::class,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
|
@ -2,16 +2,17 @@
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
|
||||
use Symfony\Component\OptionsResolver\Exception\AccessException;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use App\Entity\PreviouslyOwnedCamera;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\Exception\AccessException;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class PreviouslyOwnedCameraType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
@ -32,18 +33,19 @@ class PreviouslyOwnedCameraType extends AbstractType
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws AccessException
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => PreviouslyOwnedCamera::class
|
||||
));
|
||||
$resolver->setDefaults([
|
||||
'data_class' => PreviouslyOwnedCamera::class,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
|
@ -2,16 +2,17 @@
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
|
||||
use Symfony\Component\OptionsResolver\Exception\AccessException;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use App\Entity\PreviouslyOwnedFlash;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\Exception\AccessException;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class PreviouslyOwnedFlashType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
@ -33,18 +34,19 @@ class PreviouslyOwnedFlashType extends AbstractType
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws AccessException
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => PreviouslyOwnedFlash::class
|
||||
));
|
||||
$resolver->setDefaults([
|
||||
'data_class' => PreviouslyOwnedFlash::class,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
|
@ -2,16 +2,17 @@
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
|
||||
use Symfony\Component\OptionsResolver\Exception\AccessException;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use App\Entity\PreviouslyOwnedLenses;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\Exception\AccessException;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class PreviouslyOwnedLensesType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
@ -39,18 +40,19 @@ class PreviouslyOwnedLensesType extends AbstractType
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws AccessException
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => PreviouslyOwnedLenses::class
|
||||
));
|
||||
$resolver->setDefaults([
|
||||
'data_class' => PreviouslyOwnedLenses::class,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
|
@ -23,14 +23,14 @@ class Kernel extends BaseKernel
|
||||
protected function configureContainer(ContainerConfigurator $container): void
|
||||
{
|
||||
$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}_'.$this->environment.'.yaml');
|
||||
$container->import('../config/{services}_' . $this->environment . '.yaml');
|
||||
}
|
||||
|
||||
protected function configureRoutes(RoutingConfigurator $routes): void
|
||||
{
|
||||
$routes->import('../config/{routes}/'.$this->environment.'/*.yaml');
|
||||
$routes->import('../config/{routes}/' . $this->environment . '/*.yaml');
|
||||
$routes->import('../config/{routes}/*.yaml');
|
||||
$routes->import('../config/{routes}.yaml');
|
||||
}
|
||||
|
@ -4,8 +4,9 @@ namespace App\Repository;
|
||||
|
||||
use ReflectionObject;
|
||||
use Throwable;
|
||||
trait AcquireTrait {
|
||||
|
||||
trait AcquireTrait
|
||||
{
|
||||
/**
|
||||
* Move a record from the table represented by $currentRecord
|
||||
* into the table represented by $newRecord
|
||||
@ -30,14 +31,11 @@ trait AcquireTrait {
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
$em->persist($newRecord);
|
||||
$em->remove($currentRecord);
|
||||
$em->flush();
|
||||
}
|
||||
catch (Throwable)
|
||||
{
|
||||
} catch (Throwable) {
|
||||
dump($newRecord);
|
||||
}
|
||||
}
|
||||
|
@ -2,17 +2,16 @@
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\{Camera, PreviouslyOwnedCamera};
|
||||
use Doctrine\ORM\{
|
||||
EntityRepository, ORMInvalidArgumentException
|
||||
};
|
||||
|
||||
class CameraRepository extends EntityRepository {
|
||||
use App\Entity\Camera;
|
||||
use App\Entity\PreviouslyOwnedCamera;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\ORMInvalidArgumentException;
|
||||
|
||||
class CameraRepository extends EntityRepository
|
||||
{
|
||||
use AcquireTrait;
|
||||
|
||||
/**
|
||||
* @param Camera $currentRecord
|
||||
* @throws ORMInvalidArgumentException
|
||||
*/
|
||||
public function deacquire(Camera $currentRecord): void
|
||||
@ -24,7 +23,6 @@ class CameraRepository extends EntityRepository {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PreviouslyOwnedCamera $currentRecord
|
||||
* @throws ORMInvalidArgumentException
|
||||
*/
|
||||
public function reacquire(PreviouslyOwnedCamera $currentRecord): void
|
||||
|
@ -2,17 +2,16 @@
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\{Flash, PreviouslyOwnedFlash};
|
||||
use Doctrine\ORM\{
|
||||
EntityRepository, ORMInvalidArgumentException
|
||||
};
|
||||
|
||||
class FlashRepository extends EntityRepository {
|
||||
use App\Entity\Flash;
|
||||
use App\Entity\PreviouslyOwnedFlash;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\ORMInvalidArgumentException;
|
||||
|
||||
class FlashRepository extends EntityRepository
|
||||
{
|
||||
use AcquireTrait;
|
||||
|
||||
/**
|
||||
* @param Flash $currentRecord
|
||||
* @throws ORMInvalidArgumentException
|
||||
*/
|
||||
public function deacquire(Flash $currentRecord): void
|
||||
@ -24,7 +23,6 @@ class FlashRepository extends EntityRepository {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PreviouslyOwnedFlash $currentRecord
|
||||
* @throws ORMInvalidArgumentException
|
||||
*/
|
||||
public function reacquire(PreviouslyOwnedFlash $currentRecord): void
|
||||
|
@ -2,16 +2,14 @@
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\{Lenses, PreviouslyOwnedLenses};
|
||||
use App\Entity\Lenses;
|
||||
use App\Entity\PreviouslyOwnedLenses;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
class LensesRepository extends EntityRepository
|
||||
{
|
||||
use AcquireTrait;
|
||||
|
||||
/**
|
||||
* @param Lenses $currentRecord
|
||||
*/
|
||||
public function deacquire(Lenses $currentRecord): void
|
||||
{
|
||||
$currentRecord->setFormerlyOwned(true)
|
||||
@ -20,9 +18,6 @@ class LensesRepository extends EntityRepository
|
||||
$this->moveRecord($currentRecord, new PreviouslyOwnedLenses());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PreviouslyOwnedLenses $currentRecord
|
||||
*/
|
||||
public function reacquire(PreviouslyOwnedLenses $currentRecord): void
|
||||
{
|
||||
$currentRecord->setFormerlyOwned(false);
|
||||
|
@ -2,13 +2,13 @@
|
||||
|
||||
namespace App\Types;
|
||||
|
||||
use Doctrine\DBAL\Types\Type;
|
||||
use App\ValueObject\Money;
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
|
||||
use App\ValueObject\Money;
|
||||
|
||||
class MoneyType extends Type {
|
||||
use Doctrine\DBAL\Types\Type;
|
||||
|
||||
class MoneyType extends Type
|
||||
{
|
||||
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
|
||||
{
|
||||
return 'MONEY';
|
||||
@ -16,7 +16,7 @@ class MoneyType extends Type {
|
||||
|
||||
public function convertToPHPValue($value, AbstractPlatform $platform): float
|
||||
{
|
||||
return (float) (string)new Money($value);
|
||||
return (float) (string) new Money($value);
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
@ -26,6 +26,6 @@ class MoneyType extends Type {
|
||||
|
||||
public function requiresSQLCommentHint(AbstractPlatform $platform): bool
|
||||
{
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,23 +1,25 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\ValueObject;
|
||||
|
||||
use Stringable;
|
||||
class Money implements Stringable {
|
||||
|
||||
class Money implements Stringable
|
||||
{
|
||||
private readonly float $value;
|
||||
|
||||
public function __construct($value)
|
||||
{
|
||||
$this->value = (float)str_replace(['$',','], '', $value);
|
||||
$this->value = (float) str_replace(['$', ','], '', $value);
|
||||
}
|
||||
|
||||
public function getValue(): float
|
||||
{
|
||||
return (float)str_replace(['$',','], '', $this->value);
|
||||
return (float) str_replace(['$', ','], '', $this->value);
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return (string)$this->getValue();
|
||||
return (string) $this->getValue();
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
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')) {
|
||||
require dirname(__DIR__).'/config/bootstrap.php';
|
||||
if (file_exists(dirname(__DIR__) . '/config/bootstrap.php')) {
|
||||
require dirname(__DIR__) . '/config/bootstrap.php';
|
||||
} elseif (method_exists(Dotenv::class, 'bootEnv')) {
|
||||
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
|
||||
(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
return [
|
||||
'' => '',
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
return [
|
||||
'This value should be false.' => 'This value should be false.',
|
||||
|
Loading…
Reference in New Issue
Block a user