src\Entity\Contient.php line 12

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