From 5065bef5451c53d09066b369a7230e9271fdccb2 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Thu, 29 Sep 2022 20:09:31 -0400 Subject: [PATCH] Add Start of computer collection --- src/Controller/BrandController.php | 99 +++++ src/Controller/GpuCoreController.php | 89 +++++ src/Entity/BatteryType.php | 7 +- src/Entity/Brand.php | 43 +++ src/Entity/Camera.php | 7 +- src/Entity/CameraType.php | 3 +- src/Entity/Film.php | 3 +- src/Entity/FilmFormat.php | 2 +- src/Entity/Flash.php | 31 +- src/Entity/GPU.php | 0 src/Entity/GPUCore.php | 0 src/Entity/GetSetTrait.php | 33 ++ src/Entity/Gpu.php | 131 +++++++ src/Entity/GpuCore.php | 135 +++++++ src/Entity/LensTrait.php | 441 +--------------------- src/Entity/Lenses.php | 31 +- src/Entity/PreviouslyOwnedCamera.php | 7 +- src/Entity/PreviouslyOwnedFlash.php | 31 +- src/Entity/PreviouslyOwnedLenses.php | 31 +- src/Form/BrandType.php | 25 ++ src/Form/GPUCoreType.php | 31 ++ src/Repository/GPURepository.php | 0 src/Types/BusInterface.php | 13 + templates/brand/edit.html.twig | 30 ++ templates/brand/index.html.twig | 47 +++ templates/brand/new.html.twig | 23 ++ templates/brand/show.html.twig | 42 +++ templates/gpu_core/_delete_form.html.twig | 4 + templates/gpu_core/_form.html.twig | 4 + templates/gpu_core/edit.html.twig | 21 ++ templates/gpu_core/index.html.twig | 58 +++ templates/gpu_core/new.html.twig | 19 + templates/gpu_core/show.html.twig | 58 +++ templates/header.html.twig | 11 +- 34 files changed, 1059 insertions(+), 451 deletions(-) create mode 100644 src/Controller/BrandController.php create mode 100644 src/Controller/GpuCoreController.php delete mode 100644 src/Entity/GPU.php delete mode 100644 src/Entity/GPUCore.php create mode 100644 src/Entity/Gpu.php create mode 100644 src/Entity/GpuCore.php create mode 100644 src/Form/BrandType.php create mode 100644 src/Form/GPUCoreType.php delete mode 100644 src/Repository/GPURepository.php create mode 100644 templates/brand/edit.html.twig create mode 100644 templates/brand/index.html.twig create mode 100644 templates/brand/new.html.twig create mode 100644 templates/brand/show.html.twig create mode 100644 templates/gpu_core/_delete_form.html.twig create mode 100644 templates/gpu_core/_form.html.twig create mode 100644 templates/gpu_core/edit.html.twig create mode 100644 templates/gpu_core/index.html.twig create mode 100644 templates/gpu_core/new.html.twig create mode 100644 templates/gpu_core/show.html.twig diff --git a/src/Controller/BrandController.php b/src/Controller/BrandController.php new file mode 100644 index 0000000..126126d --- /dev/null +++ b/src/Controller/BrandController.php @@ -0,0 +1,99 @@ +getRepository(Brand::class) + ->findBy([ + + ], [ + 'name' => 'asc' + ]); + + return $this->render('brand/index.html.twig', [ + 'brands' => $brands, + ]); + } + + #[Route('/new', name: 'brand_new', methods: ['GET', 'POST'])] + public function new(Request $request, EntityManagerInterface $entityManager): Response + { + $brand = new Brand(); + $form = $this->createForm(BrandType::class, $brand); + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $entityManager->persist($brand); + $entityManager->flush(); + + return $this->redirectToRoute('brand_index', [], Response::HTTP_SEE_OTHER); + } + + return $this->renderForm('brand/new.html.twig', [ + 'brand' => $brand, + 'form' => $form, + ]); + } + + #[Route('/{id}', name: 'brand_show', methods: ['GET'])] + public function show(Brand $brand): Response + { + return $this->render('brand/show.html.twig', [ + 'brand' => $brand, + ]); + } + + #[Route('/{id}/edit', name: 'brand_edit', methods: ['GET', 'POST'])] + public function edit(Request $request, Brand $brand, EntityManagerInterface $entityManager): Response + { + $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, + ]); + } + + #[Route('/{id}', name: 'brand_delete', methods: ['POST'])] + public function delete(Request $request, Brand $brand, EntityManagerInterface $entityManager): Response + { + if ($this->isCsrfTokenValid('delete'.$brand->getId(), $request->request->get('_token'))) { + $entityManager->remove($brand); + $entityManager->flush(); + } + + return $this->redirectToRoute('brand_index', [], Response::HTTP_SEE_OTHER); + } +} diff --git a/src/Controller/GpuCoreController.php b/src/Controller/GpuCoreController.php new file mode 100644 index 0000000..526ad89 --- /dev/null +++ b/src/Controller/GpuCoreController.php @@ -0,0 +1,89 @@ +getRepository(GpuCore::class) + ->findBy([], [ + 'brand' => 'asc', + 'architecture' => 'asc', + 'name' => 'asc', + 'variant' => 'asc', + ]); + + return $this->render('gpu_core/index.html.twig', [ + 'gpu_cores' => $gPUCores, + ]); + } + + #[Route('/new', name: 'gpu-core_new', methods: ['GET', 'POST'])] + public function new(Request $request, EntityManagerInterface $entityManager): Response + { + $gPUCore = new GpuCore(); + $form = $this->createForm(GPUCoreType::class, $gPUCore); + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $entityManager->persist($gPUCore); + $entityManager->flush(); + + return $this->redirectToRoute('gpu-core_index', [], Response::HTTP_SEE_OTHER); + } + + return $this->renderForm('gpu_core/new.html.twig', [ + 'gpu_core' => $gPUCore, + 'form' => $form, + ]); + } + + #[Route('/{id}', name: 'gpu-core_show', methods: ['GET'])] + public function show(GpuCore $gPUCore): Response + { + return $this->render('gpu_core/show.html.twig', [ + 'gpu_core' => $gPUCore, + ]); + } + + #[Route('/{id}/edit', name: 'gpu-core_edit', methods: ['GET', 'POST'])] + public function edit(Request $request, GpuCore $gPUCore, EntityManagerInterface $entityManager): Response + { + $form = $this->createForm(GPUCoreType::class, $gPUCore); + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $entityManager->flush(); + + return $this->redirectToRoute('gpu-core_index', [], Response::HTTP_SEE_OTHER); + } + + return $this->renderForm('gpu_core/edit.html.twig', [ + 'gpu_core' => $gPUCore, + 'form' => $form, + ]); + } + + #[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'))) { + $entityManager->remove($gPUCore); + $entityManager->flush(); + } + + return $this->redirectToRoute('gpu-core_index', [], Response::HTTP_SEE_OTHER); + } +} diff --git a/src/Entity/BatteryType.php b/src/Entity/BatteryType.php index 7b58673..5b4fc0e 100644 --- a/src/Entity/BatteryType.php +++ b/src/Entity/BatteryType.php @@ -7,7 +7,7 @@ use Doctrine\ORM\Mapping as ORM; /** * Battery Type */ -#[ORM\Table(name: 'battery_type', schema: 'camera')] +#[ORM\Table(name: 'battery_type', schema: 'collection')] #[ORM\Entity] class BatteryType { @@ -15,4 +15,9 @@ class BatteryType #[ORM\Id] #[ORM\GeneratedValue(strategy: 'IDENTITY')] private int $id; + + public function getId(): ?int + { + return $this->id; + } } diff --git a/src/Entity/Brand.php b/src/Entity/Brand.php index e69de29..3952a53 100644 --- a/src/Entity/Brand.php +++ b/src/Entity/Brand.php @@ -0,0 +1,43 @@ +name; + } + + public function getId(): ?int + { + return $this->id; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(string $name): self + { + $this->name = $name; + + return $this; + } +} diff --git a/src/Entity/Camera.php b/src/Entity/Camera.php index aca5b23..899a2fb 100644 --- a/src/Entity/Camera.php +++ b/src/Entity/Camera.php @@ -8,7 +8,7 @@ use Doctrine\ORM\Mapping as ORM; /** * Camera */ -#[ORM\Table(name: 'camera', schema: 'camera')] +#[ORM\Table(name: 'camera', schema: 'collection')] #[ORM\Index(columns: ['type_id'], name: 'IDX_747C826FC54C8C93')] #[ORM\Entity(repositoryClass: CameraRepository::class)] class Camera @@ -20,4 +20,9 @@ class Camera #[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\SequenceGenerator(sequenceName: 'camera__id_seq', allocationSize: 1, initialValue: 1)] private int $id; + + public function getId(): ?int + { + return $this->id; + } } diff --git a/src/Entity/CameraType.php b/src/Entity/CameraType.php index 6f56b64..71d73dc 100644 --- a/src/Entity/CameraType.php +++ b/src/Entity/CameraType.php @@ -2,13 +2,14 @@ namespace App\Entity; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Stringable; /** * CameraType */ -#[ORM\Table(name: 'camera_type', schema: 'camera')] +#[ORM\Table(name: 'camera_type', schema: 'collection')] #[ORM\Entity] class CameraType implements Stringable { diff --git a/src/Entity/Film.php b/src/Entity/Film.php index 560d953..c3bb132 100644 --- a/src/Entity/Film.php +++ b/src/Entity/Film.php @@ -2,12 +2,13 @@ namespace App\Entity; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; /** * Camera */ -#[ORM\Table(name: 'film', schema: 'camera')] +#[ORM\Table(name: 'film', schema: 'collection')] #[ORM\Entity] class Film { diff --git a/src/Entity/FilmFormat.php b/src/Entity/FilmFormat.php index a1ee755..fe9fcdc 100644 --- a/src/Entity/FilmFormat.php +++ b/src/Entity/FilmFormat.php @@ -4,7 +4,7 @@ namespace App\Entity; use Doctrine\ORM\Mapping as ORM; -#[ORM\Table(name: 'film_format', schema: 'camera')] +#[ORM\Table(name: 'film_format', schema: 'collection')] #[ORM\Entity] class FilmFormat { diff --git a/src/Entity/Flash.php b/src/Entity/Flash.php index 415170f..43d038c 100644 --- a/src/Entity/Flash.php +++ b/src/Entity/Flash.php @@ -7,7 +7,7 @@ use Doctrine\ORM\Mapping as ORM; /** * Camera.flash */ -#[ORM\Table(name: 'flash', schema: 'camera')] +#[ORM\Table(name: 'flash', schema: 'collection')] #[ORM\Entity] class Flash { @@ -24,4 +24,33 @@ class Flash #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE, options: ['default' => FALSE])] private bool $formerlyOwned = FALSE; + + public function getId(): ?int + { + return $this->id; + } + + public function isReceived(): ?bool + { + return $this->received; + } + + public function setReceived(bool $received): self + { + $this->received = $received; + + return $this; + } + + public function isFormerlyOwned(): ?bool + { + return $this->formerlyOwned; + } + + public function setFormerlyOwned(bool $formerlyOwned): self + { + $this->formerlyOwned = $formerlyOwned; + + return $this; + } } diff --git a/src/Entity/GPU.php b/src/Entity/GPU.php deleted file mode 100644 index e69de29..0000000 diff --git a/src/Entity/GPUCore.php b/src/Entity/GPUCore.php deleted file mode 100644 index e69de29..0000000 diff --git a/src/Entity/GetSetTrait.php b/src/Entity/GetSetTrait.php index e69de29..2d131ac 100644 --- a/src/Entity/GetSetTrait.php +++ b/src/Entity/GetSetTrait.php @@ -0,0 +1,33 @@ +$name(...$arguments); + } + + // 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; + } + + if (str_starts_with('set', $name)) + { + $var = lcfirst(str_replace('set', '', $name)); + if (property_exists($this, $var)) + { + $this->$name = $arguments[0]; + } + + return $this; + } + + throw new \InvalidArgumentException("Undefined method: {$name}"); + } +} diff --git a/src/Entity/Gpu.php b/src/Entity/Gpu.php new file mode 100644 index 0000000..d140e9f --- /dev/null +++ b/src/Entity/Gpu.php @@ -0,0 +1,131 @@ +id; + } + + public function getModelName(): ?string + { + return $this->modelName; + } + + public function setModelName(string $modelName): self + { + $this->modelName = $modelName; + + return $this; + } + + public function getAlternateModelName(): ?string + { + return $this->alternateModelName; + } + + public function setAlternateModelName(?string $alternateModelName): self + { + $this->alternateModelName = $alternateModelName; + + return $this; + } + + public function getCount(): ?int + { + return $this->count; + } + + public function setCount(int $count): self + { + $this->count = $count; + + return $this; + } + + public function getNotes(): ?string + { + return $this->notes; + } + + public function setNotes(?string $notes): self + { + $this->notes = $notes; + + return $this; + } + + public function getBoardBrand(): ?Brand + { + return $this->boardBrand; + } + + public function setBoardBrand(?Brand $boardBrand): self + { + $this->boardBrand = $boardBrand; + + return $this; + } + + public function getGpuBrand(): ?Brand + { + return $this->gpuBrand; + } + + public function setGpuBrand(?Brand $gpuBrand): self + { + $this->gpuBrand = $gpuBrand; + + return $this; + } + + public function getGpuCore(): ?GpuCore + { + return $this->gpuCore; + } + + public function setGpuCore(?GpuCore $gpuCore): self + { + $this->gpuCore = $gpuCore; + + return $this; + } +} diff --git a/src/Entity/GpuCore.php b/src/Entity/GpuCore.php new file mode 100644 index 0000000..eb9ea4b --- /dev/null +++ b/src/Entity/GpuCore.php @@ -0,0 +1,135 @@ +brand $this->name ($this->variant/$this->generationName)"; + } + + public function getId(): ?int + { + return $this->id; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(string $name): self + { + $this->name = $name; + + return $this; + } + + public function getVariant(): ?string + { + return $this->variant; + } + + public function setVariant(string $variant): self + { + $this->variant = $variant; + + return $this; + } + + public function getGenerationName(): ?string + { + return $this->generationName; + } + + public function setGenerationName(string $generationName): self + { + $this->generationName = $generationName; + + return $this; + } + + public function getArchitecture(): ?string + { + return $this->architecture; + } + + public function setArchitecture(string $architecture): self + { + $this->architecture = $architecture; + + return $this; + } + + public function getArchitectureLink(): ?string + { + return $this->architectureLink; + } + + public function setArchitectureLink(string $architectureLink): self + { + $this->architectureLink = $architectureLink; + + return $this; + } + + public function getProcessNode(): ?int + { + return $this->processNode; + } + + public function setProcessNode(int $processNode): self + { + $this->processNode = $processNode; + + return $this; + } + + public function getBrand(): ?Brand + { + return $this->brand; + } + + public function setBrand(?Brand $brand): self + { + $this->brand = $brand; + + return $this; + } +} diff --git a/src/Entity/LensTrait.php b/src/Entity/LensTrait.php index 4d2e22b..e995867 100644 --- a/src/Entity/LensTrait.php +++ b/src/Entity/LensTrait.php @@ -7,6 +7,7 @@ use Doctrine\ORM\Mapping as ORM; trait LensTrait { use PurchasePriceTrait; + use GetSetTrait; #[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: TRUE)] private readonly ?string $brand; @@ -61,444 +62,4 @@ trait LensTrait #[ORM\Column(name: 'aperture_blades', type: 'smallint', nullable: TRUE)] private readonly ?int $apertureBlades; - - /** - * Get id - */ - public function getId(): int - { - return $this->id; - } - - /** - * Set brand - * - * @param string $brand - */ - public function setBrand($brand): self - { - $this->brand = $brand; - - return $this; - } - - /** - * Get brand - * - * @return string - */ - public function getBrand() - { - return $this->brand; - } - - /** - * Set coatings - * - * @param string $coatings - */ - public function setCoatings($coatings): self - { - $this->coatings = $coatings; - - return $this; - } - - /** - * Get coatings - * - * @return string - */ - public function getCoatings() - { - return $this->coatings; - } - - /** - * Set productLine - * - * @param string $productLine - */ - public function setProductLine($productLine): self - { - $this->productLine = $productLine; - - return $this; - } - - /** - * Get productLine - * - * @return string - */ - public function getProductLine() - { - return $this->productLine; - } - - /** - * Set model - * - * @param string $model - */ - public function setModel($model): self - { - $this->model = $model; - - return $this; - } - - /** - * Get model - * - * @return string - */ - public function getModel() - { - return $this->model; - } - - /** - * Set minFStop - * - * @param string $minFStop - */ - public function setMinFStop($minFStop): self - { - $this->minFStop = $minFStop; - - return $this; - } - - /** - * Get minFStop - * - * @return string - */ - public function getMinFStop() - { - return $this->minFStop; - } - - /** - * Set maxFStop - * - * @param float $maxFStop - */ - public function setMaxFStop($maxFStop): self - { - $this->maxFStop = $maxFStop; - - return $this; - } - - /** - * Get maxFStop - * - * @return float - */ - public function getMaxFStop() - { - return $this->maxFStop; - } - - /** - * Set minFocalLength - * - * @param int $minFocalLength - */ - public function setMinFocalLength($minFocalLength): self - { - $this->minFocalLength = $minFocalLength; - - return $this; - } - - /** - * Get minFocalLength - * - * @return int - */ - public function getMinFocalLength() - { - return $this->minFocalLength; - } - - /** - * Set maxFocalLength - * - * @param int $maxFocalLength - */ - public function setMaxFocalLength($maxFocalLength): self - { - $this->maxFocalLength = $maxFocalLength; - - return $this; - } - - /** - * Get maxFocalLength - * - * @return int - */ - public function getMaxFocalLength() - { - return $this->maxFocalLength; - } - - /** - * Set serial - * - * @param string $serial - */ - public function setSerial($serial): self - { - $this->serial = $serial; - - return $this; - } - - /** - * Get serial - */ - public function getSerial(): string - { - return $this->serial ?? ''; - } - - /** - * Set notes - * - * @param string $notes - */ - public function setNotes(?string $notes): self - { - $this->notes = $notes; - - return $this; - } - - /** - * Get notes - */ - public function getNotes(): string - { - return $this->notes ?? ''; - } - - /** - * Get image size - */ - public function getImageSize(): string - { - return $this->imageSize; - } - - /** - * Set image size - */ - public function setImageSize(string $imageSize): self - { - $this->imageSize = $imageSize; - - return $this; - } - - /** - * Set mount - * - * @param string $mount - */ - public function setMount($mount): self - { - $this->mount = $mount; - - return $this; - } - - /** - * Get mount - * - * @return string - */ - public function getMount() - { - return $this->mount; - } - - /** - * Set received - * - * @param bool $received - */ - public function setReceived($received): self - { - $this->received = $received; - - return $this; - } - - /** - * Get received - * - * @return bool - */ - public function getReceived() - { - return $this->received; - } - - /** - * Set formerlyOwned - * - * @param bool $formerlyOwned - */ - public function setFormerlyOwned($formerlyOwned): self - { - $this->formerlyOwned = $formerlyOwned; - - return $this; - } - - /** - * Get formerlyOwned - * - * @return bool - */ - public function getFormerlyOwned() - { - return $this->formerlyOwned; - } - - /** - * Set frontFilterSize - * - * @param string $frontFilterSize - */ - public function setFrontFilterSize($frontFilterSize): self - { - $this->frontFilterSize = $frontFilterSize; - - return $this; - } - - /** - * Get frontFilterSize - * - * @return string - */ - public function getFrontFilterSize() - { - return $this->frontFilterSize; - } - - /** - * Set rearFilterSize - * - * @param string $rearFilterSize - */ - public function setRearFilterSize($rearFilterSize): self - { - $this->rearFilterSize = $rearFilterSize; - - return $this; - } - - /** - * Get rearFilterSize - * - * @return string - */ - public function getRearFilterSize() - { - return $this->rearFilterSize; - } - - /** - * Set isTeleconverter - * - * @param bool $isTeleconverter - */ - public function setIsTeleconverter($isTeleconverter): self - { - $this->isTeleconverter = $isTeleconverter; - - return $this; - } - - /** - * Get isTeleconverter - * - * @return bool - */ - public function getIsTeleconverter() - { - return $this->isTeleconverter; - } - - /** - * Set designElements - * - * @param int $designElements - */ - public function setDesignElements($designElements): self - { - $this->designElements = $designElements; - - return $this; - } - - /** - * Get designElements - * - * @return int - */ - public function getDesignElements() - { - return $this->designElements; - } - - /** - * Set designGroups - * - * @param int $designGroups - */ - public function setDesignGroups($designGroups): self - { - $this->designGroups = $designGroups; - - return $this; - } - - /** - * Get designGroups - * - * @return int - */ - public function getDesignGroups() - { - return $this->designGroups; - } - - /** - * Set apertureBlades - * - * @param int $apertureBlades - */ - public function setApertureBlades($apertureBlades): self - { - $this->apertureBlades = $apertureBlades; - - return $this; - } - - /** - * Get apertureBlades - * - * @return int - */ - public function getApertureBlades(): ?int - { - return $this->apertureBlades; - } } diff --git a/src/Entity/Lenses.php b/src/Entity/Lenses.php index 3d4ef9a..f6a9486 100644 --- a/src/Entity/Lenses.php +++ b/src/Entity/Lenses.php @@ -8,7 +8,7 @@ use Doctrine\ORM\Mapping as ORM; /** * Camera.lenses */ -#[ORM\Table(name: 'lenses', schema: 'camera')] +#[ORM\Table(name: 'lenses', schema: 'collection')] #[ORM\Entity(repositoryClass: LensesRepository::class)] class Lenses { @@ -25,4 +25,33 @@ class Lenses #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE)] private bool $formerlyOwned = FALSE; + + public function getId(): ?int + { + return $this->id; + } + + public function isReceived(): ?bool + { + return $this->received; + } + + public function setReceived(bool $received): self + { + $this->received = $received; + + return $this; + } + + public function isFormerlyOwned(): ?bool + { + return $this->formerlyOwned; + } + + public function setFormerlyOwned(bool $formerlyOwned): self + { + $this->formerlyOwned = $formerlyOwned; + + return $this; + } } diff --git a/src/Entity/PreviouslyOwnedCamera.php b/src/Entity/PreviouslyOwnedCamera.php index c7d41b0..4980ea2 100644 --- a/src/Entity/PreviouslyOwnedCamera.php +++ b/src/Entity/PreviouslyOwnedCamera.php @@ -8,7 +8,7 @@ use Doctrine\ORM\Mapping as ORM; /** * Camera.previouslyOwnedCamera */ -#[ORM\Table(name: 'previously_owned_camera', schema: 'camera')] +#[ORM\Table(name: 'previously_owned_camera', schema: 'collection')] #[ORM\Index(name: 'IDX_6EF94C6BC54C8C93', columns: ['type_id'])] #[ORM\Entity(repositoryClass: CameraRepository::class)] class PreviouslyOwnedCamera @@ -20,4 +20,9 @@ class PreviouslyOwnedCamera #[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\SequenceGenerator(sequenceName: 'prevously_owned_camera_id_seq', allocationSize: 1, initialValue: 1)] private int $id; + + public function getId(): ?int + { + return $this->id; + } } diff --git a/src/Entity/PreviouslyOwnedFlash.php b/src/Entity/PreviouslyOwnedFlash.php index d3ae406..33742cc 100644 --- a/src/Entity/PreviouslyOwnedFlash.php +++ b/src/Entity/PreviouslyOwnedFlash.php @@ -7,7 +7,7 @@ use Doctrine\ORM\Mapping as ORM; /** * Camera.flash */ -#[ORM\Table(name: 'previously_owned_flash', schema: 'camera')] +#[ORM\Table(name: 'previously_owned_flash', schema: 'collection')] #[ORM\Entity] class PreviouslyOwnedFlash { @@ -23,4 +23,33 @@ class PreviouslyOwnedFlash #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE, options: ['default' => TRUE])] private bool $formerlyOwned = TRUE; + + public function getId(): ?int + { + return $this->id; + } + + public function isReceived(): ?bool + { + return $this->received; + } + + public function setReceived(bool $received): self + { + $this->received = $received; + + return $this; + } + + public function isFormerlyOwned(): ?bool + { + return $this->formerlyOwned; + } + + public function setFormerlyOwned(bool $formerlyOwned): self + { + $this->formerlyOwned = $formerlyOwned; + + return $this; + } } diff --git a/src/Entity/PreviouslyOwnedLenses.php b/src/Entity/PreviouslyOwnedLenses.php index 233a40b..1a44348 100644 --- a/src/Entity/PreviouslyOwnedLenses.php +++ b/src/Entity/PreviouslyOwnedLenses.php @@ -8,7 +8,7 @@ use Doctrine\ORM\Mapping as ORM; /** * Camera.previouslyOwnedLenses */ -#[ORM\Table(name: 'previously_owned_lenses', schema: 'camera')] +#[ORM\Table(name: 'previously_owned_lenses', schema: 'collection')] #[ORM\Entity(repositoryClass: LensesRepository::class)] class PreviouslyOwnedLenses { @@ -24,4 +24,33 @@ class PreviouslyOwnedLenses #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE)] private bool $formerlyOwned = TRUE; + + public function getId(): ?int + { + return $this->id; + } + + public function isReceived(): ?bool + { + return $this->received; + } + + public function setReceived(bool $received): self + { + $this->received = $received; + + return $this; + } + + public function isFormerlyOwned(): ?bool + { + return $this->formerlyOwned; + } + + public function setFormerlyOwned(bool $formerlyOwned): self + { + $this->formerlyOwned = $formerlyOwned; + + return $this; + } } diff --git a/src/Form/BrandType.php b/src/Form/BrandType.php new file mode 100644 index 0000000..4ee7760 --- /dev/null +++ b/src/Form/BrandType.php @@ -0,0 +1,25 @@ +add('name') + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Brand::class, + ]); + } +} diff --git a/src/Form/GPUCoreType.php b/src/Form/GPUCoreType.php new file mode 100644 index 0000000..40a8d3f --- /dev/null +++ b/src/Form/GPUCoreType.php @@ -0,0 +1,31 @@ +add('brand') + ->add('name') + ->add('variant') + ->add('architecture') + ->add('architectureLink') + ->add('generationName') + ->add('processNode') + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => GpuCore::class, + ]); + } +} diff --git a/src/Repository/GPURepository.php b/src/Repository/GPURepository.php deleted file mode 100644 index e69de29..0000000 diff --git a/src/Types/BusInterface.php b/src/Types/BusInterface.php index e69de29..280aab9 100644 --- a/src/Types/BusInterface.php +++ b/src/Types/BusInterface.php @@ -0,0 +1,13 @@ +Edit Brand + +
+ +
+ +
+ {{ form_start(form) }} + {{ form_widget(form) }} + + {{ form_end(form) }} + +
+ + +
+
+{% endblock %} diff --git a/templates/brand/index.html.twig b/templates/brand/index.html.twig new file mode 100644 index 0000000..88a0a1a --- /dev/null +++ b/templates/brand/index.html.twig @@ -0,0 +1,47 @@ +{% extends 'form.html.twig' %} + +{% block title %}Brands{% endblock %} + +{% block form %} +

Brands

+ +
+ +
+ + + + + + + + + + + {% for brand in brands %} + + + + + + {% else %} + + + + {% endfor %} + +
ActionsIdName
+ + {{ brand.id }}{{ brand.name }}
no records found
+{% endblock %} diff --git a/templates/brand/new.html.twig b/templates/brand/new.html.twig new file mode 100644 index 0000000..7e32d3d --- /dev/null +++ b/templates/brand/new.html.twig @@ -0,0 +1,23 @@ +{% extends 'form.html.twig' %} + +{% block title %}Brands - New{% endblock %} + +{% block form %} +

Create new Brand

+ +
+ +
+ +
+ {{ form_start(form) }} + {{ form_widget(form) }} + + {{ form_end(form) }} +
+ +{% endblock %} diff --git a/templates/brand/show.html.twig b/templates/brand/show.html.twig new file mode 100644 index 0000000..eb65b97 --- /dev/null +++ b/templates/brand/show.html.twig @@ -0,0 +1,42 @@ +{% extends 'form.html.twig' %} + +{% block title %}Brand{% endblock %} + +{% block form %} +

Brand

+ +
+ + + +
+ + +
+ + +
+
+ +
+ + + + + + + + + + + +
Id{{ brand.id }}
Name{{ brand.name }}
+
+{% endblock %} diff --git a/templates/gpu_core/_delete_form.html.twig b/templates/gpu_core/_delete_form.html.twig new file mode 100644 index 0000000..e1fb5d1 --- /dev/null +++ b/templates/gpu_core/_delete_form.html.twig @@ -0,0 +1,4 @@ +
+ + +
diff --git a/templates/gpu_core/_form.html.twig b/templates/gpu_core/_form.html.twig new file mode 100644 index 0000000..6e72c1c --- /dev/null +++ b/templates/gpu_core/_form.html.twig @@ -0,0 +1,4 @@ +{{ form_start(form) }} + {{ form_widget(form) }} + +{{ form_end(form) }} diff --git a/templates/gpu_core/edit.html.twig b/templates/gpu_core/edit.html.twig new file mode 100644 index 0000000..19c4c9a --- /dev/null +++ b/templates/gpu_core/edit.html.twig @@ -0,0 +1,21 @@ +{% extends 'form.html.twig' %} + +{% block title %}GPU Core - Edit{% endblock %} + +{% block form %} +

Edit GPU Core

+ +
+ +
+ +
+ {{ include('gpu_core/_form.html.twig', {'button_label': 'Update'}) }} + + {{ include('gpu_core/_delete_form.html.twig') }} +
+{% endblock %} diff --git a/templates/gpu_core/index.html.twig b/templates/gpu_core/index.html.twig new file mode 100644 index 0000000..af8842d --- /dev/null +++ b/templates/gpu_core/index.html.twig @@ -0,0 +1,58 @@ +{% extends 'base.html.twig' %} + +{% block title %}GPU Cores{% endblock %} + +{% block body %} +

GPU Cores

+ +
+ +
+ + + + + + + + + + + + + + + + {% for gpu_core in gpu_cores %} + + + + + + + + + + + + {% else %} + + + + {% endfor %} + +
ActionsIdBrandNameVariantGenerationNameArchitectureProcessNode
+ + {{ gpu_core.id }}{{ gpu_core.brand.name }}{{ gpu_core.name }}{{ gpu_core.variant }}{{ gpu_core.generationName }}{{ gpu_core.architecture }}{{ gpu_core.processNode }}nm
no records found
+{% endblock %} diff --git a/templates/gpu_core/new.html.twig b/templates/gpu_core/new.html.twig new file mode 100644 index 0000000..d886b52 --- /dev/null +++ b/templates/gpu_core/new.html.twig @@ -0,0 +1,19 @@ +{% extends 'form.html.twig' %} + +{% block title %}GPU Core - {% endblock %} + +{% block form %} +

Create new GPU Core

+ +
+ +
+ +
+ {{ include('gpu_core/_form.html.twig') }} +
+{% endblock %} diff --git a/templates/gpu_core/show.html.twig b/templates/gpu_core/show.html.twig new file mode 100644 index 0000000..8a7fcd8 --- /dev/null +++ b/templates/gpu_core/show.html.twig @@ -0,0 +1,58 @@ +{% extends 'form.html.twig' %} + +{% block title %}GPU Core{% endblock %} + +{% block form %} +

GPU Core

+ +
+ + + +
+ + +
+ + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Id{{ gpu_core.id }}
Name{{ gpu_core.name }}
Variant{{ gpu_core.variant }}
GenerationName{{ gpu_core.generationName }}
Architecture{{ gpu_core.architecture }}
ProcessNode{{ gpu_core.processNode }}nm
+
+{% endblock %} diff --git a/templates/header.html.twig b/templates/header.html.twig index 3ad30eb..73d0af4 100644 --- a/templates/header.html.twig +++ b/templates/header.html.twig @@ -1,4 +1,4 @@ -

Camera Collection CRUD

+

Collection CRUD

+