src/Entity/Cours.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CoursRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\Entity(repositoryClass=CoursRepository::class)
  9. */
  10. class Cours
  11. {
  12. /**
  13. * @ORM\Id()
  14. * @ORM\GeneratedValue()
  15. * @ORM\Column(type="integer")
  16. */
  17. private $id;
  18. /**
  19. * @ORM\Column(type="string", length=255, nullable=true)
  20. */
  21. private $code;
  22. /**
  23. * @ORM\Column(type="string", length=255, nullable=true)
  24. */
  25. private $nom;
  26. /**
  27. * @ORM\Column(type="string", length=255, nullable=true)
  28. */
  29. private $link;
  30. /**
  31. * @ORM\Column(type="integer")
  32. */
  33. private $id_course;
  34. /**
  35. * @ORM\Column(type="string", length=255, nullable=true)
  36. */
  37. private $begin;
  38. /**
  39. * @ORM\Column(type="string", length=255, nullable=true)
  40. */
  41. private $end;
  42. /**
  43. * @ORM\Column(name="dateMaj",type="string", length=255, nullable=true)
  44. */
  45. private $dateMaj;
  46. /**
  47. * @ORM\ManyToMany(targetEntity=Projet::class, inversedBy="courses")
  48. * @ORM\JoinColumn(name="idProjet", referencedColumnName="id")
  49. */
  50. private $projets;
  51. /**
  52. * One Cours has Many campagnes.
  53. * @ORM\OneToMany(targetEntity=Compagne::class, mappedBy="cours")
  54. */
  55. private $campagnes;
  56. public function __construct()
  57. {
  58. $this->projets = new ArrayCollection();
  59. $this->campagnes = new ArrayCollection();
  60. }
  61. public function getId(): ?int
  62. {
  63. return $this->id;
  64. }
  65. public function getCode(): ?string
  66. {
  67. return $this->code;
  68. }
  69. public function setCode(?string $code): self
  70. {
  71. $this->code = $code;
  72. return $this;
  73. }
  74. public function getNom(): ?string
  75. {
  76. return $this->nom;
  77. }
  78. public function setNom(?string $nom): self
  79. {
  80. $this->nom = $nom;
  81. return $this;
  82. }
  83. public function getLink(): ?string
  84. {
  85. return $this->link;
  86. }
  87. public function setLink(?string $link): self
  88. {
  89. $this->link = $link;
  90. return $this;
  91. }
  92. public function getIdCourse(): ?int
  93. {
  94. return $this->id_course;
  95. }
  96. public function setIdCourse(int $id_course): self
  97. {
  98. $this->id_course = $id_course;
  99. return $this;
  100. }
  101. public function getBegin(): ?string
  102. {
  103. return $this->begin;
  104. }
  105. public function setBegin(?string $begin): self
  106. {
  107. $this->begin = $begin;
  108. return $this;
  109. }
  110. public function getEnd(): ?string
  111. {
  112. return $this->end;
  113. }
  114. public function setEnd(?string $end): self
  115. {
  116. $this->end = $end;
  117. return $this;
  118. }
  119. public function getDateMaj(): ?string
  120. {
  121. return $this->dateMaj;
  122. }
  123. public function setDateMaj(?string $dateMaj): self
  124. {
  125. $this->dateMaj = $dateMaj;
  126. return $this;
  127. }
  128. /**
  129. * @return Collection|Projet[]
  130. */
  131. public function getProjets(): Collection
  132. {
  133. return $this->projets;
  134. }
  135. public function addProjet(Projet $projet): self
  136. {
  137. if (!$this->projets->contains($projet)) {
  138. $this->projets[] = $projet;
  139. }
  140. return $this;
  141. }
  142. public function removeProjet(Projet $projet): self
  143. {
  144. if ($this->projets->contains($projet)) {
  145. $this->projets->removeElement($projet);
  146. }
  147. return $this;
  148. }
  149. /**
  150. * @return Collection|Compagne[]
  151. */
  152. public function getCampagnes(): Collection
  153. {
  154. return $this->campagnes;
  155. }
  156. public function addCampagne(Compagne $campagne): self
  157. {
  158. if (!$this->campagnes->contains($campagne)) {
  159. $this->campagnes[] = $campagne;
  160. $campagne->setCours($this);
  161. }
  162. return $this;
  163. }
  164. public function removeCampagne(Compagne $campagne): self
  165. {
  166. if ($this->campagnes->contains($campagne)) {
  167. $this->campagnes->removeElement($campagne);
  168. // set the owning side to null (unless already changed)
  169. if ($campagne->getCours() === $this) {
  170. $campagne->setCours(null);
  171. }
  172. }
  173. return $this;
  174. }
  175. }