src\Entity\ProposeTheme.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProposeThemeRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  6. #[ORM\Entity(repositoryClass: ProposeThemeRepository::class)]
  7. #[ORM\Table(name: '`proposetheme`')]
  8. #[UniqueEntity(fields: ['menu_id'], message: 'Ce menu est déjà associé à un thème.')]
  9. class ProposeTheme {
  10. #[ORM\Id]
  11. #[ORM\OneToOne(targetEntity: Menu::class)]
  12. #[ORM\JoinColumn(name: "menu_id", referencedColumnName: "menu_id", onDelete: "CASCADE")]
  13. private ?Menu $menu_id = null;
  14. #[ORM\ManyToOne(targetEntity: Theme::class)]
  15. #[ORM\JoinColumn(name: "theme_id", referencedColumnName: "theme_id", onDelete: "CASCADE")]
  16. private ?Theme $theme_id = null;
  17. public function getMenuId(): ?Menu
  18. {
  19. return $this->menu_id;
  20. }
  21. public function setMenuId(?Menu $menu_id): static
  22. {
  23. $this->menu_id = $menu_id;
  24. return $this;
  25. }
  26. public function getThemeId(): ?Theme
  27. {
  28. return $this->theme_id;
  29. }
  30. public function setThemeId(?Theme $theme_id): static
  31. {
  32. $this->theme_id = $theme_id;
  33. return $this;
  34. }
  35. }