src/Entity/Departement.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DepartementRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\Entity(repositoryClass=DepartementRepository::class)
  9. */
  10. class Departement
  11. {
  12. /**
  13. * @ORM\Id()
  14. * @ORM\GeneratedValue()
  15. * @ORM\Column(type="integer")
  16. */
  17. private $id;
  18. /**
  19. * @ORM\OneToMany(targetEntity=Demande::class, mappedBy="id_departement")
  20. */
  21. private $demandes;
  22. /**
  23. * @ORM\Column(type="string", length=255)
  24. */
  25. private $Name;
  26. /**
  27. * @ORM\Column(type="string", length=255)
  28. */
  29. private $Description;
  30. /**
  31. * @ORM\OneToMany(targetEntity=Utilisateur::class, mappedBy="departement")
  32. */
  33. private $utilisateurs;
  34. public function __construct()
  35. {
  36. $this->demandes = new ArrayCollection();
  37. $this->utilisateurs = new ArrayCollection();
  38. }
  39. public function getId(): ?int
  40. {
  41. return $this->id;
  42. }
  43. /**
  44. * @return Collection|Demande[]
  45. */
  46. public function getDemandes(): Collection
  47. {
  48. return $this->demandes;
  49. }
  50. public function addDemande(Demande $demande): self
  51. {
  52. if (!$this->demandes->contains($demande)) {
  53. $this->demandes[] = $demande;
  54. $demande->setIdDepartement($this);
  55. }
  56. return $this;
  57. }
  58. public function removeDemande(Demande $demande): self
  59. {
  60. if ($this->demandes->contains($demande)) {
  61. $this->demandes->removeElement($demande);
  62. // set the owning side to null (unless already changed)
  63. if ($demande->getIdDepartement() === $this) {
  64. $demande->setIdDepartement(null);
  65. }
  66. }
  67. return $this;
  68. }
  69. public function getName(): ?string
  70. {
  71. return $this->Name;
  72. }
  73. public function setName(string $Name): self
  74. {
  75. $this->Name = $Name;
  76. return $this;
  77. }
  78. public function getDescription(): ?string
  79. {
  80. return $this->Description;
  81. }
  82. public function setDescription(string $Description): self
  83. {
  84. $this->Description = $Description;
  85. return $this;
  86. }
  87. /**
  88. * @return Collection|Utilisateur[]
  89. */
  90. public function getUtilisateurs(): Collection
  91. {
  92. return $this->utilisateurs;
  93. }
  94. public function addUtilisateur(Utilisateur $utilisateur): self
  95. {
  96. if (!$this->utilisateurs->contains($utilisateur)) {
  97. $this->utilisateurs[] = $utilisateur;
  98. $utilisateur->setDepartement($this);
  99. }
  100. return $this;
  101. }
  102. public function removeUtilisateur(Utilisateur $utilisateur): self
  103. {
  104. if ($this->utilisateurs->contains($utilisateur)) {
  105. $this->utilisateurs->removeElement($utilisateur);
  106. // set the owning side to null (unless already changed)
  107. if ($utilisateur->getDepartement() === $this) {
  108. $utilisateur->setDepartement(null);
  109. }
  110. }
  111. return $this;
  112. }
  113. }