src\Entity\Avis.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\AvisRepository;
  7. #[ORM\Entity(repositoryClass: AvisRepository::class)]
  8. #[ORM\Table(name: '`avis`')]
  9. class Avis {
  10. #[ORM\Id]
  11. #[ORM\Column(type:"integer")]
  12. private ?int $avis_id = null;
  13. #[ORM\Column(type:"string",length: 50)]
  14. private ?string $note = null;
  15. #[ORM\Column(type:"string",length: 50)]
  16. private ?string $description = null;
  17. #[ORM\Column(type:"string",length: 50,nullable: true)]
  18. private ?string $statut = null;
  19. #[ORM\OneToMany(targetEntity: Publie::class, mappedBy: 'avis_id', orphanRemoval: true, cascade: ['persist'])]
  20. private Collection $publie;
  21. public function __construct() {
  22. $this->publie = new ArrayCollection();
  23. }
  24. public function getAvisId(): ?int
  25. {
  26. return $this->avis_id;
  27. }
  28. public function setAvisId(int $avis_id): static
  29. {
  30. $this->avis_id = $avis_id;
  31. return $this;
  32. }
  33. public function getNote(): ?string
  34. {
  35. return $this->note;
  36. }
  37. public function setNote(string $note): static
  38. {
  39. $this->note = $note;
  40. return $this;
  41. }
  42. public function getDescription(): ?string
  43. {
  44. return $this->description;
  45. }
  46. public function setDescription(string $description): static
  47. {
  48. $this->description = $description;
  49. return $this;
  50. }
  51. public function getStatut(): ?string
  52. {
  53. return $this->statut;
  54. }
  55. public function setStatut(?string $statut): static
  56. {
  57. $this->statut = $statut;
  58. return $this;
  59. }
  60. /**
  61. * @return Collection<int, Publie>
  62. */
  63. public function getPublies(): Collection
  64. {
  65. return $this->publie;
  66. }
  67. public function addPublie(Publie $publie): static
  68. {
  69. if (!$this->publie->contains($publie)) {
  70. $this->publie->add($publie);
  71. $publie->setAvisId($this);
  72. }
  73. return $this;
  74. }
  75. public function removePublie(Publie $publie): static
  76. {
  77. if ($this->publie->removeElement($publie)) {
  78. // set the owning side to null (unless already changed)
  79. if ($publie->getAvisId() === $this) {
  80. $publie->setAvisId(null);
  81. }
  82. }
  83. return $this;
  84. }
  85. }