Fix code formatting
This commit is contained in:
parent
41d19ad84b
commit
fb296c1034
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
@ -7,67 +7,52 @@ use App\Form\BrandType;
|
||||
use App\Traits\FormControllerTrait;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\{Request, Response};
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[Route('/brand')]
|
||||
class BrandController extends AbstractController
|
||||
{
|
||||
use FormControllerTrait;
|
||||
use FormControllerTrait;
|
||||
|
||||
protected const ENTITY = Brand::class;
|
||||
protected const TEMPLATE_PATH = 'brand/';
|
||||
protected const ROUTE_PREFIX = 'brand_';
|
||||
protected const FORM = BrandType::class;
|
||||
protected const ENTITY = Brand::class;
|
||||
protected const TEMPLATE_PATH = 'brand/';
|
||||
protected const ROUTE_PREFIX = 'brand_';
|
||||
protected const FORM = BrandType::class;
|
||||
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager)
|
||||
{
|
||||
}
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager)
|
||||
{
|
||||
}
|
||||
|
||||
#[Route('/', name: 'brand_index', methods: ['GET'])]
|
||||
public function index(): Response
|
||||
{
|
||||
return $this->itemListView('brands', [
|
||||
'name' => 'asc'
|
||||
]);
|
||||
return $this->itemListView('brands', [
|
||||
'name' => 'asc',
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: 'brand_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request): Response
|
||||
{
|
||||
return $this->itemCreate($request, 'brand');
|
||||
return $this->itemCreate($request, 'brand');
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'brand_show', methods: ['GET'])]
|
||||
public function show(Brand $brand): Response
|
||||
{
|
||||
return $this->itemView($brand, 'brand');
|
||||
return $this->itemView($brand, 'brand');
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: 'brand_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, Brand $brand): Response
|
||||
{
|
||||
return $this->itemUpdate($request, $brand, 'brand');
|
||||
//
|
||||
// $form = $this->createForm(BrandType::class, $brand);
|
||||
// $form->handleRequest($request);
|
||||
//
|
||||
// if ($form->isSubmitted() && $form->isValid()) {
|
||||
// $entityManager->flush();
|
||||
//
|
||||
// return $this->redirectToRoute('brand_index', [], Response::HTTP_SEE_OTHER);
|
||||
// }
|
||||
//
|
||||
// return $this->renderForm('brand/edit.html.twig', [
|
||||
// 'brand' => $brand,
|
||||
// 'form' => $form,
|
||||
// ]);
|
||||
return $this->itemUpdate($request, $brand, 'brand');
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'brand_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, Brand $brand): Response
|
||||
{
|
||||
return $this->deleteCSRF($request, $brand);
|
||||
return $this->deleteCSRF($request, $brand);
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,8 @@ namespace App\Controller;
|
||||
|
||||
use App\Entity\Camera;
|
||||
use App\Form\CameraType;
|
||||
use App\Traits\DeleteFormTrait;
|
||||
use App\Traits\FormControllerTrait;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\ORMInvalidArgumentException;
|
||||
use App\Traits\{DeleteFormTrait, FormControllerTrait};
|
||||
use Doctrine\ORM\{EntityManagerInterface, ORMInvalidArgumentException};
|
||||
use LogicException;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
@ -21,12 +19,12 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
class CameraController extends AbstractController
|
||||
{
|
||||
use FormControllerTrait;
|
||||
use DeleteFormTrait;
|
||||
use DeleteFormTrait;
|
||||
|
||||
protected const ENTITY = Camera::class;
|
||||
protected const TEMPLATE_PATH = 'camera/';
|
||||
protected const ROUTE_PREFIX = 'camera_';
|
||||
protected const FORM = CameraType::class;
|
||||
protected const ENTITY = Camera::class;
|
||||
protected const TEMPLATE_PATH = 'camera/';
|
||||
protected const ROUTE_PREFIX = 'camera_';
|
||||
protected const FORM = CameraType::class;
|
||||
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager)
|
||||
{
|
||||
@ -69,7 +67,7 @@ class CameraController extends AbstractController
|
||||
#[Route(path: '/new', name: 'camera_new', methods: ['GET', 'POST'])]
|
||||
public function newAction(Request $request): RedirectResponse|Response
|
||||
{
|
||||
return $this->itemCreate($request,'camera');
|
||||
return $this->itemCreate($request, 'camera');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,7 +76,7 @@ class CameraController extends AbstractController
|
||||
#[Route(path: '/{id}', name: 'camera_show', methods: ['GET'])]
|
||||
public function showAction(Camera $camera): Response
|
||||
{
|
||||
return $this->itemView($camera,'camera');
|
||||
return $this->itemView($camera, 'camera');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,7 +87,7 @@ class CameraController extends AbstractController
|
||||
#[Route(path: '/{id}/edit', name: 'camera_edit', methods: ['GET', 'POST'])]
|
||||
public function editAction(Request $request, Camera $camera): RedirectResponse|Response
|
||||
{
|
||||
return $this->itemUpdate($request, $camera,'camera');
|
||||
return $this->itemUpdate($request, $camera, 'camera');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -97,7 +95,7 @@ class CameraController extends AbstractController
|
||||
*
|
||||
* @throws LogicException
|
||||
*/
|
||||
#[Route(path: '/{id}', name: 'camera_delete', methods: ['POST','DELETE'])]
|
||||
#[Route(path: '/{id}', name: 'camera_delete', methods: ['POST', 'DELETE'])]
|
||||
public function deleteAction(Request $request, Camera $camera): RedirectResponse
|
||||
{
|
||||
return $this->itemDelete($request, $camera);
|
||||
|
@ -4,8 +4,7 @@ namespace App\Controller;
|
||||
|
||||
use App\Entity\CameraType;
|
||||
use App\Form\CameraTypeType;
|
||||
use App\Traits\DeleteFormTrait;
|
||||
use App\Traits\FormControllerTrait;
|
||||
use App\Traits\{DeleteFormTrait, FormControllerTrait};
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
|
||||
@ -15,12 +14,12 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
class CameraTypeController extends AbstractController
|
||||
{
|
||||
use FormControllerTrait;
|
||||
use DeleteFormTrait;
|
||||
use DeleteFormTrait;
|
||||
|
||||
protected const ENTITY = CameraType::class;
|
||||
protected const TEMPLATE_PATH = 'cameratype/';
|
||||
protected const ROUTE_PREFIX = 'camera-type_';
|
||||
protected const FORM = CameraTypeType::class;
|
||||
protected const ENTITY = CameraType::class;
|
||||
protected const TEMPLATE_PATH = 'cameratype/';
|
||||
protected const ROUTE_PREFIX = 'camera-type_';
|
||||
protected const FORM = CameraTypeType::class;
|
||||
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager)
|
||||
{
|
||||
@ -43,7 +42,7 @@ class CameraTypeController extends AbstractController
|
||||
#[Route(path: '/new', name: 'camera-type_new', methods: ['GET', 'POST'])]
|
||||
public function newAction(Request $request): Response
|
||||
{
|
||||
return $this->itemCreate($request, 'cameraType');
|
||||
return $this->itemCreate($request, 'cameraType');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -52,7 +51,7 @@ class CameraTypeController extends AbstractController
|
||||
#[Route(path: '/{id}', name: 'camera-type_show', methods: ['GET'])]
|
||||
public function showAction(CameraType $cameraType): Response
|
||||
{
|
||||
return $this->itemView($cameraType, 'cameraType');
|
||||
return $this->itemView($cameraType, 'cameraType');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,8 +4,7 @@ namespace App\Controller;
|
||||
|
||||
use App\Entity\Film;
|
||||
use App\Form\FilmType;
|
||||
use App\Traits\DeleteFormTrait;
|
||||
use App\Traits\FormControllerTrait;
|
||||
use App\Traits\{DeleteFormTrait, FormControllerTrait};
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use LogicException;
|
||||
@ -20,12 +19,12 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
class FilmController extends AbstractController
|
||||
{
|
||||
use FormControllerTrait;
|
||||
use DeleteFormTrait;
|
||||
use DeleteFormTrait;
|
||||
|
||||
protected const ENTITY = Film::class;
|
||||
protected const TEMPLATE_PATH = 'film/';
|
||||
protected const ROUTE_PREFIX = 'film_';
|
||||
protected const FORM = FilmType::class;
|
||||
protected const ENTITY = Film::class;
|
||||
protected const TEMPLATE_PATH = 'film/';
|
||||
protected const ROUTE_PREFIX = 'film_';
|
||||
protected const FORM = FilmType::class;
|
||||
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager)
|
||||
{
|
||||
@ -95,7 +94,7 @@ class FilmController extends AbstractController
|
||||
*
|
||||
* @throws LogicException
|
||||
*/
|
||||
#[Route(path: '/{id}', name: 'film_delete', methods: ['POST','DELETE'])]
|
||||
#[Route(path: '/{id}', name: 'film_delete', methods: ['POST', 'DELETE'])]
|
||||
public function deleteAction(Request $request, Film $film): RedirectResponse
|
||||
{
|
||||
return $this->itemDelete($request, $film);
|
||||
|
@ -4,11 +4,9 @@ namespace App\Controller;
|
||||
|
||||
use App\Entity\Flash;
|
||||
use App\Form\FlashType;
|
||||
use App\Traits\DeleteFormTrait;
|
||||
use App\Traits\FormControllerTrait;
|
||||
use App\Traits\{DeleteFormTrait, FormControllerTrait};
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
@ -19,12 +17,12 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
class FlashController extends AbstractController
|
||||
{
|
||||
use FormControllerTrait;
|
||||
use DeleteFormTrait;
|
||||
use DeleteFormTrait;
|
||||
|
||||
protected const ENTITY = Flash::class;
|
||||
protected const TEMPLATE_PATH = 'flash/';
|
||||
protected const ROUTE_PREFIX = 'flash_';
|
||||
protected const FORM = FlashType::class;
|
||||
protected const ENTITY = Flash::class;
|
||||
protected const TEMPLATE_PATH = 'flash/';
|
||||
protected const ROUTE_PREFIX = 'flash_';
|
||||
protected const FORM = FlashType::class;
|
||||
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager)
|
||||
{
|
||||
@ -45,7 +43,7 @@ class FlashController extends AbstractController
|
||||
#[Route(path: '/new', name: 'flash_new', methods: ['GET', 'POST'])]
|
||||
public function newAction(Request $request): RedirectResponse|Response
|
||||
{
|
||||
return $this->itemCreate($request,'flash');
|
||||
return $this->itemCreate($request, 'flash');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -54,7 +52,7 @@ class FlashController extends AbstractController
|
||||
#[Route(path: '/{id}', name: 'flash_show', methods: ['GET'])]
|
||||
public function showAction(Flash $flash): Response
|
||||
{
|
||||
return $this->itemView($flash,'flash');
|
||||
return $this->itemView($flash, 'flash');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
@ -7,57 +7,56 @@ use App\Form\GPUCoreType;
|
||||
use App\Traits\FormControllerTrait;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\{Request, Response};
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[Route('/gpu-core')]
|
||||
class GpuCoreController extends AbstractController
|
||||
{
|
||||
use FormControllerTrait;
|
||||
use FormControllerTrait;
|
||||
|
||||
protected const ENTITY = GpuCore::class;
|
||||
protected const TEMPLATE_PATH = 'gpu_core/';
|
||||
protected const ROUTE_PREFIX = 'gpu-core_';
|
||||
protected const FORM = GPUCoreType::class;
|
||||
protected const ENTITY = GpuCore::class;
|
||||
protected const TEMPLATE_PATH = 'gpu_core/';
|
||||
protected const ROUTE_PREFIX = 'gpu-core_';
|
||||
protected const FORM = GPUCoreType::class;
|
||||
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager)
|
||||
{
|
||||
}
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager)
|
||||
{
|
||||
}
|
||||
|
||||
#[Route('/', name: 'gpu-core_index', methods: ['GET'])]
|
||||
public function index(): Response
|
||||
{
|
||||
return $this->indexView('gpu_cores', [
|
||||
'brand' => 'asc',
|
||||
'architecture' => 'asc',
|
||||
'name' => 'asc',
|
||||
'variant' => 'asc',
|
||||
]);
|
||||
return $this->indexView('gpu_cores', [
|
||||
'brand' => 'asc',
|
||||
'architecture' => 'asc',
|
||||
'name' => 'asc',
|
||||
'variant' => 'asc',
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: 'gpu-core_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request): Response
|
||||
{
|
||||
return $this->itemCreate($request, 'gpu_core');
|
||||
return $this->itemCreate($request, 'gpu_core');
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'gpu-core_show', methods: ['GET'])]
|
||||
public function show(GpuCore $gPUCore): Response
|
||||
{
|
||||
return $this->itemView($gPUCore, 'gpu_core');
|
||||
return $this->itemView($gPUCore, 'gpu_core');
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: 'gpu-core_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, GpuCore $gPUCore): Response
|
||||
{
|
||||
return $this->itemUpdate($request, $gPUCore, 'gpu_core');
|
||||
return $this->itemUpdate($request, $gPUCore, 'gpu_core');
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'gpu-core_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, GpuCore $gPUCore, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$gPUCore->getId(), $request->request->get('_token'))) {
|
||||
if ($this->isCsrfTokenValid('delete' . $gPUCore->getId(), $request->request->get('_token'))) {
|
||||
$entityManager->remove($gPUCore);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
@ -4,8 +4,7 @@ namespace App\Controller;
|
||||
|
||||
use App\Entity\Lenses;
|
||||
use App\Form\LensesType;
|
||||
use App\Traits\DeleteFormTrait;
|
||||
use App\Traits\FormControllerTrait;
|
||||
use App\Traits\{DeleteFormTrait, FormControllerTrait};
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
@ -19,12 +18,12 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
class LensesController extends AbstractController
|
||||
{
|
||||
use FormControllerTrait;
|
||||
use DeleteFormTrait;
|
||||
use DeleteFormTrait;
|
||||
|
||||
protected const ENTITY = Lenses::class;
|
||||
protected const TEMPLATE_PATH = 'lenses/';
|
||||
protected const ROUTE_PREFIX = 'lens_';
|
||||
protected const FORM = LensesType::class;
|
||||
protected const ENTITY = Lenses::class;
|
||||
protected const TEMPLATE_PATH = 'lenses/';
|
||||
protected const ROUTE_PREFIX = 'lens_';
|
||||
protected const FORM = LensesType::class;
|
||||
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager)
|
||||
{
|
||||
@ -67,7 +66,7 @@ class LensesController extends AbstractController
|
||||
#[Route(path: '/new', name: 'lens_new', methods: ['GET', 'POST'])]
|
||||
public function newAction(Request $request): RedirectResponse|Response
|
||||
{
|
||||
return $this->itemCreate($request,'lense');
|
||||
return $this->itemCreate($request, 'lense');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -104,7 +103,7 @@ class LensesController extends AbstractController
|
||||
/**
|
||||
* Deletes a lens entity.
|
||||
*/
|
||||
#[Route(path: '/{id}', name: 'lens_delete', methods: ['POST','DELETE'])]
|
||||
#[Route(path: '/{id}', name: 'lens_delete', methods: ['POST', 'DELETE'])]
|
||||
public function deleteAction(Request $request, Lenses $lens): RedirectResponse
|
||||
{
|
||||
return $this->itemDelete($request, $lens);
|
||||
|
@ -5,8 +5,7 @@ namespace App\Controller;
|
||||
use App\Entity\PreviouslyOwnedCamera;
|
||||
use App\Form\PreviouslyOwnedCameraType;
|
||||
use App\Traits\FormControllerTrait;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\ORMInvalidArgumentException;
|
||||
use Doctrine\ORM\{EntityManagerInterface, ORMInvalidArgumentException};
|
||||
use LogicException;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
@ -22,10 +21,10 @@ class PreviouslyOwnedCameraController extends AbstractController
|
||||
{
|
||||
use FormControllerTrait;
|
||||
|
||||
protected const ENTITY = PreviouslyOwnedCamera::class;
|
||||
protected const TEMPLATE_PATH = 'previouslyownedcamera/';
|
||||
protected const ROUTE_PREFIX = 'previously-owned-camera_';
|
||||
protected const FORM = PreviouslyOwnedCameraType::class;
|
||||
protected const ENTITY = PreviouslyOwnedCamera::class;
|
||||
protected const TEMPLATE_PATH = 'previouslyownedcamera/';
|
||||
protected const ROUTE_PREFIX = 'previously-owned-camera_';
|
||||
protected const FORM = PreviouslyOwnedCameraType::class;
|
||||
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager)
|
||||
{
|
||||
@ -39,7 +38,7 @@ class PreviouslyOwnedCameraController extends AbstractController
|
||||
#[Route(path: '/', name: 'previously-owned-camera_index', methods: ['GET'])]
|
||||
public function indexAction(): Response
|
||||
{
|
||||
return $this->itemListView( 'previouslyOwnedCameras', [
|
||||
return $this->itemListView('previouslyOwnedCameras', [
|
||||
'brand' => 'ASC',
|
||||
'mount' => 'ASC',
|
||||
'model' => 'ASC',
|
||||
|
@ -18,10 +18,10 @@ class PreviouslyOwnedFlashController extends AbstractController
|
||||
{
|
||||
use FormControllerTrait;
|
||||
|
||||
protected const ENTITY = PreviouslyOwnedFlash::class;
|
||||
protected const ROUTE_PREFIX = 'previously-owned-flash_';
|
||||
protected const TEMPLATE_PATH = 'previouslyownedflash/';
|
||||
protected const FORM = PreviouslyOwnedFlashType::class;
|
||||
protected const ENTITY = PreviouslyOwnedFlash::class;
|
||||
protected const ROUTE_PREFIX = 'previously-owned-flash_';
|
||||
protected const TEMPLATE_PATH = 'previouslyownedflash/';
|
||||
protected const FORM = PreviouslyOwnedFlashType::class;
|
||||
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager)
|
||||
{
|
||||
@ -33,7 +33,7 @@ class PreviouslyOwnedFlashController extends AbstractController
|
||||
#[Route(path: '/', name: 'previously-owned-flash_index', methods: ['GET'])]
|
||||
public function indexAction(): Response
|
||||
{
|
||||
return $this->itemListView( 'previouslyOwnedFlashes');
|
||||
return $this->itemListView('previouslyOwnedFlashes');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -15,10 +15,10 @@ class PreviouslyOwnedLensesController extends AbstractController
|
||||
{
|
||||
use FormControllerTrait;
|
||||
|
||||
protected const ENTITY = PreviouslyOwnedLenses::class;
|
||||
protected const TEMPLATE_PATH = 'previouslyownedlenses/';
|
||||
protected const ROUTE_PREFIX = 'previously-owned-lens_';
|
||||
protected const FORM = PreviouslyOwnedLensesType::class;
|
||||
protected const ENTITY = PreviouslyOwnedLenses::class;
|
||||
protected const TEMPLATE_PATH = 'previouslyownedlenses/';
|
||||
protected const ROUTE_PREFIX = 'previously-owned-lens_';
|
||||
protected const FORM = PreviouslyOwnedLensesType::class;
|
||||
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
@ -8,21 +8,21 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
#[ORM\Entity]
|
||||
class Brand
|
||||
{
|
||||
use GetSetTrait;
|
||||
use GetSetTrait;
|
||||
|
||||
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
|
||||
#[ORM\SequenceGenerator(sequenceName: 'brand_id_seq', allocationSize: 1, initialValue: 1)]
|
||||
private int $id;
|
||||
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
|
||||
#[ORM\SequenceGenerator(sequenceName: 'brand_id_seq', allocationSize: 1, initialValue: 1)]
|
||||
private int $id;
|
||||
|
||||
#[ORM\Column(name: 'name', unique: true, nullable: FALSE)]
|
||||
private string $name;
|
||||
#[ORM\Column(name: 'name', unique: TRUE, nullable: FALSE)]
|
||||
private string $name;
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Stringable;
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
|
@ -2,32 +2,31 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
trait GetSetTrait {
|
||||
public function __call(string $name, array $arguments): mixed
|
||||
{
|
||||
if (method_exists($this, $name))
|
||||
{
|
||||
return $this->$name(...$arguments);
|
||||
}
|
||||
use InvalidArgumentException;
|
||||
|
||||
// Apparently Doctrine first tries the method with the same
|
||||
// name as the property, instead of with the get prefix
|
||||
if (property_exists($this, $name) && empty($arguments))
|
||||
{
|
||||
return $this->$name;
|
||||
}
|
||||
trait GetSetTrait
|
||||
{
|
||||
public function __call(string $name, array $arguments): mixed
|
||||
{
|
||||
if (method_exists($this, $name)) {
|
||||
return $this->{$name}(...$arguments);
|
||||
}
|
||||
|
||||
if (str_starts_with('set', $name))
|
||||
{
|
||||
$var = lcfirst(str_replace('set', '', $name));
|
||||
if (property_exists($this, $var))
|
||||
{
|
||||
$this->$name = $arguments[0];
|
||||
}
|
||||
// Apparently Doctrine first tries the method with the same
|
||||
// name as the property, instead of with the get prefix
|
||||
if (property_exists($this, $name) && empty($arguments)) {
|
||||
return $this->{$name};
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
if (str_starts_with('set', $name)) {
|
||||
$var = lcfirst(str_replace('set', '', $name));
|
||||
if (property_exists($this, $var)) {
|
||||
$this->{$name} = $arguments[0];
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException("Undefined method: {$name}");
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException("Undefined method: {$name}");
|
||||
}
|
||||
}
|
||||
|
@ -2,43 +2,42 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Table(name: 'gpu', schema: 'collection')]
|
||||
#[ORM\Entity]
|
||||
class Gpu
|
||||
{
|
||||
use GetSetTrait;
|
||||
use GetSetTrait;
|
||||
|
||||
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
|
||||
private int $id;
|
||||
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
|
||||
private int $id;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: 'Brand')]
|
||||
#[ORM\JoinColumn(name: 'board_brand_id', referencedColumnName: 'id', nullable: TRUE)]
|
||||
private readonly Brand $boardBrand;
|
||||
#[ORM\ManyToOne(targetEntity: 'Brand')]
|
||||
#[ORM\JoinColumn(name: 'board_brand_id', referencedColumnName: 'id', nullable: TRUE)]
|
||||
private readonly Brand $boardBrand;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: 'Brand')]
|
||||
#[ORM\JoinColumn(name: 'gpu_brand_id', referencedColumnName: 'id', nullable: FALSE)]
|
||||
private readonly Brand $gpuBrand;
|
||||
#[ORM\ManyToOne(targetEntity: 'Brand')]
|
||||
#[ORM\JoinColumn(name: 'gpu_brand_id', referencedColumnName: 'id', nullable: FALSE)]
|
||||
private readonly Brand $gpuBrand;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: 'GpuCore')]
|
||||
#[ORM\JoinColumn(name: 'gpu_core_id', referencedColumnName: 'id', nullable: TRUE)]
|
||||
private readonly GpuCore $gpuCore;
|
||||
#[ORM\ManyToOne(targetEntity: 'GpuCore')]
|
||||
#[ORM\JoinColumn(name: 'gpu_core_id', referencedColumnName: 'id', nullable: TRUE)]
|
||||
private readonly GpuCore $gpuCore;
|
||||
|
||||
#[ORM\Column(name: 'reference_model_name', nullable: FALSE)]
|
||||
private readonly string $modelName;
|
||||
#[ORM\Column(name: 'reference_model_name', nullable: FALSE)]
|
||||
private readonly string $modelName;
|
||||
|
||||
#[ORM\Column(name: 'alternate_model_name', nullable: TRUE)]
|
||||
private readonly string $alternateModelName;
|
||||
#[ORM\Column(name: 'alternate_model_name', nullable: TRUE)]
|
||||
private readonly string $alternateModelName;
|
||||
|
||||
#[ORM\Column(name: 'count', nullable: FALSE)]
|
||||
private readonly int $count;
|
||||
#[ORM\Column(name: 'count', nullable: FALSE)]
|
||||
private readonly int $count;
|
||||
|
||||
#[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)]
|
||||
private readonly string $notes;
|
||||
#[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)]
|
||||
private readonly string $notes;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
|
@ -2,134 +2,132 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\GPURepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Table(name: 'gpu_core', schema: 'collection')]
|
||||
#[ORM\Entity]
|
||||
class GpuCore
|
||||
{
|
||||
use GetSetTrait;
|
||||
use GetSetTrait;
|
||||
|
||||
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
|
||||
private int $id;
|
||||
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
|
||||
private int $id;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: 'Brand')]
|
||||
#[ORM\JoinColumn(name: 'brand_id', referencedColumnName: 'id')]
|
||||
private Brand $brand;
|
||||
#[ORM\ManyToOne(targetEntity: 'Brand')]
|
||||
#[ORM\JoinColumn(name: 'brand_id', referencedColumnName: 'id')]
|
||||
private Brand $brand;
|
||||
|
||||
#[ORM\Column(name: 'name')]
|
||||
private readonly string $name;
|
||||
#[ORM\Column(name: 'name')]
|
||||
private readonly string $name;
|
||||
|
||||
#[ORM\Column(name: 'variant', nullable: TRUE)]
|
||||
private readonly ?string $variant;
|
||||
#[ORM\Column(name: 'variant', nullable: TRUE)]
|
||||
private readonly ?string $variant;
|
||||
|
||||
#[ORM\Column(name: 'generation_name')]
|
||||
private readonly string $generationName;
|
||||
#[ORM\Column(name: 'generation_name')]
|
||||
private readonly string $generationName;
|
||||
|
||||
#[ORM\Column(name: 'architecture')]
|
||||
private readonly string $architecture;
|
||||
#[ORM\Column(name: 'architecture')]
|
||||
private readonly string $architecture;
|
||||
|
||||
#[ORM\Column(name: 'architecture_link')]
|
||||
private readonly string $architectureLink;
|
||||
#[ORM\Column(name: 'architecture_link')]
|
||||
private readonly string $architectureLink;
|
||||
|
||||
#[ORM\Column(name: 'process_node', nullable: TRUE)]
|
||||
private readonly ?int $processNode;
|
||||
#[ORM\Column(name: 'process_node', nullable: TRUE)]
|
||||
private readonly ?int $processNode;
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return "$this->brand $this->name ($this->variant/$this->generationName)";
|
||||
}
|
||||
public function __toString(): string
|
||||
{
|
||||
return "{$this->brand} {$this->name} ({$this->variant}/{$this->generationName})";
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setName(string $name): self
|
||||
{
|
||||
$this->name = $name;
|
||||
public function setName(string $name): self
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getVariant(): ?string
|
||||
{
|
||||
return $this->variant;
|
||||
}
|
||||
public function getVariant(): ?string
|
||||
{
|
||||
return $this->variant;
|
||||
}
|
||||
|
||||
public function setVariant(string $variant): self
|
||||
{
|
||||
$this->variant = $variant;
|
||||
public function setVariant(string $variant): self
|
||||
{
|
||||
$this->variant = $variant;
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getGenerationName(): ?string
|
||||
{
|
||||
return $this->generationName;
|
||||
}
|
||||
public function getGenerationName(): ?string
|
||||
{
|
||||
return $this->generationName;
|
||||
}
|
||||
|
||||
public function setGenerationName(string $generationName): self
|
||||
{
|
||||
$this->generationName = $generationName;
|
||||
public function setGenerationName(string $generationName): self
|
||||
{
|
||||
$this->generationName = $generationName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getArchitecture(): ?string
|
||||
{
|
||||
return $this->architecture;
|
||||
}
|
||||
public function getArchitecture(): ?string
|
||||
{
|
||||
return $this->architecture;
|
||||
}
|
||||
|
||||
public function setArchitecture(string $architecture): self
|
||||
{
|
||||
$this->architecture = $architecture;
|
||||
public function setArchitecture(string $architecture): self
|
||||
{
|
||||
$this->architecture = $architecture;
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getArchitectureLink(): ?string
|
||||
{
|
||||
return $this->architectureLink;
|
||||
}
|
||||
public function getArchitectureLink(): ?string
|
||||
{
|
||||
return $this->architectureLink;
|
||||
}
|
||||
|
||||
public function setArchitectureLink(string $architectureLink): self
|
||||
{
|
||||
$this->architectureLink = $architectureLink;
|
||||
public function setArchitectureLink(string $architectureLink): self
|
||||
{
|
||||
$this->architectureLink = $architectureLink;
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getProcessNode(): ?int
|
||||
{
|
||||
return $this->processNode;
|
||||
}
|
||||
public function getProcessNode(): ?int
|
||||
{
|
||||
return $this->processNode;
|
||||
}
|
||||
|
||||
public function setProcessNode(int $processNode): self
|
||||
{
|
||||
$this->processNode = $processNode;
|
||||
public function setProcessNode(int $processNode): self
|
||||
{
|
||||
$this->processNode = $processNode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBrand(): ?Brand
|
||||
{
|
||||
return $this->brand;
|
||||
}
|
||||
public function getBrand(): ?Brand
|
||||
{
|
||||
return $this->brand;
|
||||
}
|
||||
|
||||
public function setBrand(?Brand $brand): self
|
||||
{
|
||||
$this->brand = $brand;
|
||||
public function setBrand(?Brand $brand): self
|
||||
{
|
||||
$this->brand = $brand;
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
trait LensTrait
|
||||
{
|
||||
use PurchasePriceTrait;
|
||||
use GetSetTrait;
|
||||
use GetSetTrait;
|
||||
|
||||
#[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: TRUE)]
|
||||
private readonly ?string $brand;
|
||||
@ -63,13 +63,12 @@ trait LensTrait
|
||||
#[ORM\Column(name: 'aperture_blades', type: 'smallint', nullable: TRUE)]
|
||||
private readonly ?int $apertureBlades;
|
||||
|
||||
public function __get(string $name): mixed
|
||||
{
|
||||
if (property_exists($this, $name))
|
||||
{
|
||||
return $this->$name;
|
||||
}
|
||||
public function __get(string $name): mixed
|
||||
{
|
||||
if (property_exists($this, $name)) {
|
||||
return $this->{$name};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Brand;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class BrandType extends AbstractType
|
||||
@ -12,8 +11,7 @@ class BrandType extends AbstractType
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('name')
|
||||
;
|
||||
->add('name');
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
|
@ -1,10 +1,9 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\GpuCore;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class GPUCoreType extends AbstractType
|
||||
@ -12,14 +11,13 @@ class GPUCoreType extends AbstractType
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('brand')
|
||||
->add('brand')
|
||||
->add('name')
|
||||
->add('variant')
|
||||
->add('architecture')
|
||||
->add('architectureLink')
|
||||
->add('generationName')
|
||||
->add('processNode')
|
||||
;
|
||||
->add('generationName')
|
||||
->add('processNode');
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
|
@ -7,42 +7,39 @@ use Doctrine\ORM\{EntityRepository};
|
||||
use ReflectionObject;
|
||||
use Throwable;
|
||||
|
||||
|
||||
abstract class AcquireRepository extends EntityRepository
|
||||
{
|
||||
abstract public function reacquire(mixed $currentRecord): void;
|
||||
abstract public function deacquire(mixed $currentRecord): void;
|
||||
abstract public function reacquire(mixed $currentRecord): void;
|
||||
|
||||
/**
|
||||
* Move a record from the table represented by $currentRecord
|
||||
* into the table represented by $newRecord
|
||||
*
|
||||
* @param mixed $currentRecord
|
||||
* @param mixed $newRecord
|
||||
*/
|
||||
protected function moveRecord(mixed $currentRecord, mixed $newRecord): void
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
abstract public function deacquire(mixed $currentRecord): void;
|
||||
|
||||
$old = new ReflectionObject($currentRecord);
|
||||
$new = new ReflectionObject($newRecord);
|
||||
/**
|
||||
* Move a record from the table represented by $currentRecord
|
||||
* into the table represented by $newRecord
|
||||
*/
|
||||
protected function moveRecord(mixed $currentRecord, mixed $newRecord): void
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
foreach ($old->getProperties() as $property) {
|
||||
$propertyName = $property->getName();
|
||||
if ($new->hasProperty($propertyName)) {
|
||||
$newProperty = $new->getProperty($propertyName);
|
||||
$newProperty->setAccessible(TRUE);
|
||||
$property->setAccessible(TRUE);
|
||||
$newProperty->setValue($newRecord, $property->getValue($currentRecord));
|
||||
}
|
||||
}
|
||||
$old = new ReflectionObject($currentRecord);
|
||||
$new = new ReflectionObject($newRecord);
|
||||
|
||||
try {
|
||||
$em->persist($newRecord);
|
||||
$em->remove($currentRecord);
|
||||
$em->flush();
|
||||
} catch (Throwable) {
|
||||
dump($newRecord);
|
||||
}
|
||||
}
|
||||
foreach ($old->getProperties() as $property) {
|
||||
$propertyName = $property->getName();
|
||||
if ($new->hasProperty($propertyName)) {
|
||||
$newProperty = $new->getProperty($propertyName);
|
||||
$newProperty->setAccessible(TRUE);
|
||||
$property->setAccessible(TRUE);
|
||||
$newProperty->setValue($newRecord, $property->getValue($currentRecord));
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$em->persist($newRecord);
|
||||
$em->remove($currentRecord);
|
||||
$em->flush();
|
||||
} catch (Throwable) {
|
||||
dump($newRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,11 +6,11 @@ use Symfony\Component\Form\FormInterface;
|
||||
|
||||
trait DeleteFormTrait
|
||||
{
|
||||
/**
|
||||
* Creates a form to delete an entity.
|
||||
*/
|
||||
private function createDeleteForm(mixed $item): FormInterface
|
||||
{
|
||||
return $this->buildForm($item, self::ROUTE_PREFIX . 'delete', 'DELETE');
|
||||
}
|
||||
/**
|
||||
* Creates a form to delete an entity.
|
||||
*/
|
||||
private function createDeleteForm(mixed $item): FormInterface
|
||||
{
|
||||
return $this->buildForm($item, self::ROUTE_PREFIX . 'delete', 'DELETE');
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
|
||||
|
||||
trait FormControllerTrait
|
||||
{
|
||||
private readonly EntityManagerInterface $entityManager;
|
||||
private readonly EntityManagerInterface $entityManager;
|
||||
|
||||
/**
|
||||
* Create a form generator
|
||||
@ -25,9 +25,9 @@ trait FormControllerTrait
|
||||
* Show create form / create an item
|
||||
*/
|
||||
protected function itemCreate(Request $request, string $templateKey): RedirectResponse|Response
|
||||
{
|
||||
$template = self::TEMPLATE_PATH . 'new.html.twig';
|
||||
$redirectRoute = self::ROUTE_PREFIX . 'show';
|
||||
{
|
||||
$template = self::TEMPLATE_PATH . 'new.html.twig';
|
||||
$redirectRoute = self::ROUTE_PREFIX . 'show';
|
||||
|
||||
$Entity = self::ENTITY;
|
||||
$item = new $Entity();
|
||||
@ -49,17 +49,17 @@ trait FormControllerTrait
|
||||
]);
|
||||
}
|
||||
|
||||
protected function indexView(string $templateKey, array $sort = []): Response
|
||||
{
|
||||
return $this->itemListView($templateKey, $sort);
|
||||
}
|
||||
protected function indexView(string $templateKey, array $sort = []): Response
|
||||
{
|
||||
return $this->itemListView($templateKey, $sort);
|
||||
}
|
||||
|
||||
/**
|
||||
* List view for the data type
|
||||
*/
|
||||
protected function itemListView(string $templateKey, array $sort = []): Response
|
||||
{
|
||||
$template = self::TEMPLATE_PATH . 'index.html.twig';
|
||||
$template = self::TEMPLATE_PATH . 'index.html.twig';
|
||||
|
||||
$items = $this->entityManager->getRepository(self::ENTITY)->findBy([], $sort);
|
||||
|
||||
@ -73,7 +73,7 @@ trait FormControllerTrait
|
||||
*/
|
||||
protected function itemView(mixed $item, string $templateKey): Response
|
||||
{
|
||||
$template = self::TEMPLATE_PATH . 'show.html.twig';
|
||||
$template = self::TEMPLATE_PATH . 'show.html.twig';
|
||||
|
||||
$templateData = [
|
||||
$templateKey => $item,
|
||||
@ -91,9 +91,9 @@ trait FormControllerTrait
|
||||
* Show edit form / update an item
|
||||
*/
|
||||
protected function itemUpdate(Request $request, mixed $item, string $templateKey): RedirectResponse|Response
|
||||
{
|
||||
$template = self::TEMPLATE_PATH . 'edit.html.twig';
|
||||
$redirectRoute = self::ROUTE_PREFIX . 'show';
|
||||
{
|
||||
$template = self::TEMPLATE_PATH . 'edit.html.twig';
|
||||
$redirectRoute = self::ROUTE_PREFIX . 'show';
|
||||
|
||||
$editForm = $this->createForm(self::FORM, $item);
|
||||
$editForm->handleRequest($request);
|
||||
@ -158,31 +158,31 @@ trait FormControllerTrait
|
||||
return $this->redirectToRoute($redirectRoute);
|
||||
}
|
||||
|
||||
/**
|
||||
* Actually delete an item
|
||||
*/
|
||||
/**
|
||||
* Actually delete an item
|
||||
*/
|
||||
protected function itemDelete(Request $request, mixed $item): RedirectResponse
|
||||
{
|
||||
$redirectRoute = self::ROUTE_PREFIX . 'index';
|
||||
$redirectRoute = self::ROUTE_PREFIX . 'index';
|
||||
|
||||
$form = $this->createDeleteForm($item);
|
||||
$form->handleRequest($request);
|
||||
|
||||
// if ($this->isCsrfTokenValid((string)$item->getId(), $request->request->get('_token'))) {
|
||||
$this->entityManager->remove($item);
|
||||
$this->entityManager->flush();
|
||||
//}
|
||||
// if ($this->isCsrfTokenValid((string)$item->getId(), $request->request->get('_token'))) {
|
||||
$this->entityManager->remove($item);
|
||||
$this->entityManager->flush();
|
||||
//}
|
||||
|
||||
return $this->redirectToRoute($redirectRoute, [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
protected function deleteCSRF(Request $request, mixed $item): RedirectResponse
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$item->getId(), $request->request->get('_token'))) {
|
||||
$this->entityManager->remove($item);
|
||||
$this->entityManager->flush();
|
||||
}
|
||||
protected function deleteCSRF(Request $request, mixed $item): RedirectResponse
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete' . $item->getId(), $request->request->get('_token'))) {
|
||||
$this->entityManager->remove($item);
|
||||
$this->entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute(self::ROUTE_PREFIX . 'index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
return $this->redirectToRoute(self::ROUTE_PREFIX . 'index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,17 @@
|
||||
namespace App\Types;
|
||||
|
||||
enum BusInterface: string {
|
||||
case PCI = 'PCI';
|
||||
case ISA = 'ISA';
|
||||
case VLB = 'VLB (Vesa Local Bus)';
|
||||
case AGP = 'AGP';
|
||||
case AGPX2 = 'AGP 2x';
|
||||
case AGPX4 = 'AGP 4x';
|
||||
case AGPX8 = 'AGP 8x';
|
||||
case PCI = 'PCI';
|
||||
|
||||
case ISA = 'ISA';
|
||||
|
||||
case VLB = 'VLB (Vesa Local Bus)';
|
||||
|
||||
case AGP = 'AGP';
|
||||
|
||||
case AGPX2 = 'AGP 2x';
|
||||
|
||||
case AGPX4 = 'AGP 4x';
|
||||
|
||||
case AGPX8 = 'AGP 8x';
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ class Money implements Stringable
|
||||
|
||||
public function getValue(): float
|
||||
{
|
||||
return (float) str_replace(['$', ','], '', (string)$this->value);
|
||||
return (float) str_replace(['$', ','], '', (string) $this->value);
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
|
Loading…
Reference in New Issue
Block a user