src\Entity\ProposePlat.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProposePlatRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  6. #[ORM\Entity(repositoryClass: ProposePlatRepository::class)]
  7. #[ORM\Table(name: '`proposeplat`')]
  8. #[UniqueEntity(fields: ['menu_id', 'plat_id'], message: 'Cette combinaison de menu et de plat existe déjà')]
  9. class ProposePlat {
  10. #[ORM\Id]
  11. #[ORM\ManyToOne(targetEntity: Menu::class, inversedBy: "proposePlat")]
  12. #[ORM\JoinColumn(name: "menu_id", referencedColumnName: "menu_id", onDelete: "CASCADE")]
  13. private ?Menu $menu_id = null;
  14. #[ORM\Id]
  15. #[ORM\ManyToOne(targetEntity: Plat::class)]
  16. #[ORM\JoinColumn(name: "plat_id", referencedColumnName: "plat_id", onDelete: "CASCADE")]
  17. private ?Plat $plat_id = null;
  18. public function getMenuId(): ?Menu
  19. {
  20. return $this->menu_id;
  21. }
  22. public function setMenuId(?Menu $menu_id): static
  23. {
  24. $this->menu_id = $menu_id;
  25. return $this;
  26. }
  27. public function getPlatId(): ?Plat
  28. {
  29. return $this->plat_id;
  30. }
  31. public function setPlatId(?Plat $plat_id): static
  32. {
  33. $this->plat_id = $plat_id;
  34. return $this;
  35. }
  36. }