diff --git a/src/Controller/Admin/DashboardController.php b/src/Controller/Admin/DashboardController.php index c835e08..657df3e 100644 --- a/src/Controller/Admin/DashboardController.php +++ b/src/Controller/Admin/DashboardController.php @@ -2,6 +2,8 @@ namespace App\Controller\Admin; +use App\Entity\Fridge; +use App\Entity\FridgeProductLine; use App\Entity\Product; use App\Entity\QuantityUnit; use App\Entity\Recipe; @@ -44,6 +46,8 @@ class DashboardController extends AbstractDashboardController yield MenuItem::section('Product lists', 'fas fa-folder-open'); yield MenuItem::linkToCrud('Recipes', 'fas fa-list', Recipe::class); yield MenuItem::linkToCrud('Recipe product lines', 'fas fa-list', RecipeProductLine::class); + yield MenuItem::linkToCrud('Fridges', 'fas fa-list', Fridge::class); + yield MenuItem::linkToCrud('Fridge product lines', 'fas fa-list', FridgeProductLine::class); yield MenuItem::section('Administration', 'fas fa-folder-open'); yield MenuItem::linkToCrud('User', 'fas fa-list', User::class); diff --git a/src/Controller/Admin/FridgeCrudController.php b/src/Controller/Admin/FridgeCrudController.php new file mode 100644 index 0000000..9ac18a2 --- /dev/null +++ b/src/Controller/Admin/FridgeCrudController.php @@ -0,0 +1,36 @@ +productLines = new ArrayCollection(); + } + + 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 getDescription(): ?string + { + return $this->description; + } + + public function setDescription(?string $description): self + { + $this->description = $description; + + return $this; + } + + /** + * @return Collection|FridgeProductLine[] + */ + public function getProductLines(): Collection + { + return $this->productLines; + } + + public function addProductLine(FridgeProductLine $productLine): self + { + if (!$this->productLines->contains($productLine)) { + $this->productLines[] = $productLine; + $productLine->setFridge($this); + } + + return $this; + } + + public function removeProductLine(FridgeProductLine $productLine): self + { + if ($this->productLines->removeElement($productLine)) { + // set the owning side to null (unless already changed) + if ($productLine->getFridge() === $this) { + $productLine->setFridge(null); + } + } + + return $this; + } +} diff --git a/src/Entity/FridgeProductLine.php b/src/Entity/FridgeProductLine.php new file mode 100644 index 0000000..4bd33a3 --- /dev/null +++ b/src/Entity/FridgeProductLine.php @@ -0,0 +1,24 @@ +fridge; + } + + public function setFridge(?Fridge $fridge): self + { + $this->fridge = $fridge; + + return $this; + } +} \ No newline at end of file diff --git a/src/Repository/FridgeRepository.php b/src/Repository/FridgeRepository.php new file mode 100644 index 0000000..641ccc6 --- /dev/null +++ b/src/Repository/FridgeRepository.php @@ -0,0 +1,50 @@ +createQueryBuilder('f') + ->andWhere('f.exampleField = :val') + ->setParameter('val', $value) + ->orderBy('f.id', 'ASC') + ->setMaxResults(10) + ->getQuery() + ->getResult() + ; + } + */ + + /* + public function findOneBySomeField($value): ?Fridge + { + return $this->createQueryBuilder('f') + ->andWhere('f.exampleField = :val') + ->setParameter('val', $value) + ->getQuery() + ->getOneOrNullResult() + ; + } + */ +}