src\Entity\Plat.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use App\Repository\PlatRepository;
  7. #[ORM\Entity(repositoryClass: PlatRepository::class)]
  8. #[ORM\Table(name: '`plat`')]
  9. class Plat {
  10. #[ORM\Id]
  11. #[ORM\GeneratedValue]
  12. #[ORM\Column]
  13. private ?int $plat_id = null;
  14. #[ORM\Column(type:"string",length: 50)]
  15. private ?string $titre_plat = null;
  16. #[ORM\Column(type:"blob")]
  17. private $photo = null;
  18. private ?string $file= null;
  19. #[ORM\OneToMany(targetEntity: ProposePlat::class, mappedBy: 'plat_id', orphanRemoval: true, cascade: ['persist'])]
  20. private Collection $proposeplat;
  21. #[ORM\OneToMany(targetEntity: Contient::class, mappedBy: 'plat_id', orphanRemoval: true, cascade: ['persist'])]
  22. private Collection $contient;
  23. public function __construct()
  24. {
  25. $this->proposeplat = new ArrayCollection();
  26. $this->contient = new ArrayCollection();
  27. }
  28. public function getPlatId(): ?int
  29. {
  30. return $this->plat_id;
  31. }
  32. public function setPlatId(int $plat_id): static
  33. {
  34. $this->plat_id = $plat_id;
  35. return $this;
  36. }
  37. public function getTitrePlat(): ?string
  38. {
  39. return $this->titre_plat;
  40. }
  41. public function setTitrePlat(string $titre_plat): static
  42. {
  43. $this->titre_plat = $titre_plat;
  44. return $this;
  45. }
  46. public function getPhoto()
  47. {
  48. return $this->photo;
  49. }
  50. public function setPhoto($photo): static
  51. {
  52. $this->photo = $photo;
  53. return $this;
  54. }
  55. public function getFile(): ?string
  56. {
  57. return $this->file;
  58. }
  59. public function setFile($file): static
  60. {
  61. $this->file = $file;
  62. return $this;
  63. }
  64. public function getProposeplats(): Collection
  65. {
  66. return $this->proposeplat;
  67. }
  68. public function addProposeplat(ProposePlat $proposeplat): static
  69. {
  70. if (!$this->proposeplat->contains($proposeplat)) {
  71. $this->proposeplat->add($proposeplat);
  72. $proposeplat->setPlatId($this);
  73. }
  74. return $this;
  75. }
  76. public function removeProposeplat(ProposePlat $proposeplat): static
  77. {
  78. if ($this->proposeplat->removeElement($proposeplat)) {
  79. // set the owning side to null (unless already changed)
  80. if ($proposeplat->getPlatId() === $this) {
  81. $proposeplat->setPlatId(null);
  82. }
  83. }
  84. return $this;
  85. }
  86. /**
  87. * @return Collection<int, Contient>
  88. */
  89. public function getContients(): Collection
  90. {
  91. return $this->contient;
  92. }
  93. public function addContient(Contient $contient): static
  94. {
  95. if (!$this->contient->contains($contient)) {
  96. $this->contient->add($contient);
  97. $contient->setPlatId($this);
  98. }
  99. return $this;
  100. }
  101. public function removeContient(Contient $contient): static
  102. {
  103. if ($this->contient->removeElement($contient)) {
  104. // set the owning side to null (unless already changed)
  105. if ($contient->getPlatId() === $this) {
  106. $contient->setPlatId(null);
  107. }
  108. }
  109. return $this;
  110. }
  111. }