src/Entity/Prestation.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PrestationRepository;
  4. use App\Util\Status;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9. * @ORM\Entity(repositoryClass=PrestationRepository::class)
  10. */
  11. class Prestation
  12. {
  13. /**
  14. * @ORM\Id
  15. * @ORM\GeneratedValue
  16. * @ORM\Column(type="integer")
  17. */
  18. private $id;
  19. /**
  20. * @ORM\Column(type="text")
  21. */
  22. private $nom;
  23. /**
  24. * @ORM\Column(type="text", nullable=true)
  25. */
  26. private $description;
  27. /**
  28. * @ORM\Column(type="decimal", precision=12, scale=2)
  29. */
  30. private $prix;
  31. /**
  32. * @ORM\Column(type="integer")
  33. */
  34. private $dureeEnMinutes;
  35. /**
  36. * @ORM\Column(type="integer")
  37. */
  38. private $statut;
  39. /**
  40. * @ORM\Column(type="string", length=255, nullable=true)
  41. */
  42. private $calendlyEventId;
  43. /**
  44. * @ORM\ManyToOne(targetEntity=Categorie::class, inversedBy="prestations")
  45. * @ORM\JoinColumn(nullable=false)
  46. */
  47. private $categorie;
  48. /**
  49. * @ORM\OneToMany(targetEntity=OptionPrestation::class, mappedBy="prestation")
  50. */
  51. private $options;
  52. /**
  53. * @ORM\OneToMany(targetEntity=PrestationTypeConsultation::class, mappedBy="prestation")
  54. */
  55. private $types;
  56. /**
  57. * @ORM\Column(type="integer", nullable=true)
  58. */
  59. private $ordre;
  60. /**
  61. * @ORM\Column(type="integer", nullable=true)
  62. */
  63. private $nbMax = 0;
  64. public function __construct()
  65. {
  66. $this->options = new ArrayCollection();
  67. $this->types = new ArrayCollection();
  68. }
  69. public function getId(): ?int
  70. {
  71. return $this->id;
  72. }
  73. public function getNom(): ?string
  74. {
  75. return $this->nom;
  76. }
  77. public function setNom(string $nom): self
  78. {
  79. $this->nom = $nom;
  80. return $this;
  81. }
  82. public function getDescription(): ?string
  83. {
  84. return $this->description;
  85. }
  86. public function setDescription(?string $description): self
  87. {
  88. $this->description = $description;
  89. return $this;
  90. }
  91. public function getPrix(): ?string
  92. {
  93. return $this->prix;
  94. }
  95. public function setPrix(string $prix): self
  96. {
  97. $this->prix = $prix;
  98. return $this;
  99. }
  100. public function getDureeEnMinutes(): ?int
  101. {
  102. return $this->dureeEnMinutes;
  103. }
  104. public function setDureeEnMinutes(int $dureeEnMinutes): self
  105. {
  106. $this->dureeEnMinutes = $dureeEnMinutes;
  107. return $this;
  108. }
  109. public function getStatut(): ?int
  110. {
  111. return $this->statut;
  112. }
  113. public function setStatut(int $statut): self
  114. {
  115. $this->statut = $statut;
  116. return $this;
  117. }
  118. public function getCalendlyEventId(): ?string
  119. {
  120. return $this->calendlyEventId;
  121. }
  122. public function setCalendlyEventId(?string $calendlyEventId): self
  123. {
  124. $this->calendlyEventId = $calendlyEventId;
  125. return $this;
  126. }
  127. public function getCategorie(): ?Categorie
  128. {
  129. return $this->categorie;
  130. }
  131. public function setCategorie(?Categorie $categorie): self
  132. {
  133. $this->categorie = $categorie;
  134. return $this;
  135. }
  136. /**
  137. * @return Collection<int, OptionPrestation>
  138. */
  139. public function getOptions(): Collection
  140. {
  141. return $this->options;
  142. }
  143. public function addOption(OptionPrestation $option): self
  144. {
  145. if (!$this->options->contains($option)) {
  146. $this->options[] = $option;
  147. $option->setPrestation($this);
  148. }
  149. return $this;
  150. }
  151. public function removeOption(OptionPrestation $option): self
  152. {
  153. if ($this->options->removeElement($option)) {
  154. // set the owning side to null (unless already changed)
  155. if ($option->getPrestation() === $this) {
  156. $option->setPrestation(null);
  157. }
  158. }
  159. return $this;
  160. }
  161. /**
  162. * @return Collection<int, PrestationTypeConsultation>
  163. */
  164. public function getTypes(): Collection
  165. {
  166. return $this->types;
  167. }
  168. public function addType(PrestationTypeConsultation $type): self
  169. {
  170. if (!$this->types->contains($type)) {
  171. $this->types[] = $type;
  172. $type->setPrestation($this);
  173. }
  174. return $this;
  175. }
  176. public function removeType(PrestationTypeConsultation $type): self
  177. {
  178. if ($this->types->removeElement($type)) {
  179. // set the owning side to null (unless already changed)
  180. if ($type->getPrestation() === $this) {
  181. $type->setPrestation(null);
  182. }
  183. }
  184. return $this;
  185. }
  186. public function isValid(): bool{
  187. return $this->getStatut() == Status::VALID;
  188. }
  189. public function getOrdre(): ?int
  190. {
  191. return $this->ordre;
  192. }
  193. public function setOrdre(?int $ordre): self
  194. {
  195. $this->ordre = $ordre;
  196. return $this;
  197. }
  198. public function getNbMax(): ?int
  199. {
  200. return $this->nbMax;
  201. }
  202. public function setNbMax(?int $nbMax): self
  203. {
  204. $this->nbMax = $nbMax;
  205. return $this;
  206. }
  207. }