src/Entity/SurfaceReboisement.php line 187

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SurfaceReboisementRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use JsonSerializable;
  8. #[ORM\Entity(repositoryClass: SurfaceReboisementRepository::class)]
  9. class SurfaceReboisement implements JsonSerializable
  10. {
  11. #[ORM\Id]
  12. #[ORM\GeneratedValue]
  13. #[ORM\Column(type: 'integer')]
  14. private $id;
  15. #[ORM\Column(type: 'string', length: 255)]
  16. private $nom;
  17. #[ORM\Column(type: 'float')]
  18. private $longitude;
  19. #[ORM\Column(type: 'float')]
  20. private $latitude;
  21. #[ORM\Column(type: 'decimal', precision: 12, scale: 2)]
  22. private $rayon;
  23. #[ORM\Column(type: 'integer')]
  24. private $nbrArbres;
  25. #[ORM\Column(type: 'integer')]
  26. private $statut;
  27. #[ORM\Column(type: 'datetime')]
  28. private $dateCreation;
  29. #[ORM\OneToMany(targetEntity: OrderProductSurface::class, mappedBy: 'surface')]
  30. private $orderProductSurfaces;
  31. #[ORM\OneToOne(targetEntity: ViewSurfaceQteArbres::class, mappedBy: 'surfaceReboisement', cascade: ['persist', 'remove'])]
  32. private $surfaceQteArbres;
  33. public function __construct()
  34. {
  35. $this->orderProductSurfaces = new ArrayCollection();
  36. }
  37. public function getId(): ?int
  38. {
  39. return $this->id;
  40. }
  41. public function getNom(): ?string
  42. {
  43. return $this->nom;
  44. }
  45. public function setNom(string $nom): self
  46. {
  47. $this->nom = $nom;
  48. return $this;
  49. }
  50. public function getLongitude(): ?float
  51. {
  52. return $this->longitude;
  53. }
  54. public function setLongitude(float $longitude): self
  55. {
  56. $this->longitude = $longitude;
  57. return $this;
  58. }
  59. public function getLatitude(): ?float
  60. {
  61. return $this->latitude;
  62. }
  63. public function setLatitude(float $latitude): self
  64. {
  65. $this->latitude = $latitude;
  66. return $this;
  67. }
  68. public function getRayon(): ?string
  69. {
  70. return $this->rayon;
  71. }
  72. public function setRayon(string $rayon): self
  73. {
  74. $this->rayon = $rayon;
  75. return $this;
  76. }
  77. public function getNbrArbres(): ?int
  78. {
  79. return $this->nbrArbres;
  80. }
  81. public function setNbrArbres(int $nbrArbres): self
  82. {
  83. $this->nbrArbres = $nbrArbres;
  84. return $this;
  85. }
  86. public function getStatut(): ?int
  87. {
  88. return $this->statut;
  89. }
  90. public function setStatut(int $statut): self
  91. {
  92. $this->statut = $statut;
  93. return $this;
  94. }
  95. public function getDateCreation(): ?\DateTimeInterface
  96. {
  97. return $this->dateCreation;
  98. }
  99. public function setDateCreation(\DateTimeInterface $dateCreation): self
  100. {
  101. $this->dateCreation = $dateCreation;
  102. return $this;
  103. }
  104. /**
  105. * @return Collection<int, OrderProductSurface>
  106. */
  107. public function getOrderProductSurfaces(): Collection
  108. {
  109. return $this->orderProductSurfaces;
  110. }
  111. public function addOrderProductSurface(OrderProductSurface $orderProductSurface): self
  112. {
  113. if (!$this->orderProductSurfaces->contains($orderProductSurface)) {
  114. $this->orderProductSurfaces[] = $orderProductSurface;
  115. $orderProductSurface->setSurface($this);
  116. }
  117. return $this;
  118. }
  119. public function removeOrderProductSurface(OrderProductSurface $orderProductSurface): self
  120. {
  121. if ($this->orderProductSurfaces->removeElement($orderProductSurface)) {
  122. // set the owning side to null (unless already changed)
  123. if ($orderProductSurface->getSurface() === $this) {
  124. $orderProductSurface->setSurface(null);
  125. }
  126. }
  127. return $this;
  128. }
  129. public function getSurfaceQteArbres(): ?ViewSurfaceQteArbres
  130. {
  131. return $this->surfaceQteArbres;
  132. }
  133. public function setSurfaceQteArbres(ViewSurfaceQteArbres $surfaceQteArbres): self
  134. {
  135. // set the owning side of the relation if necessary
  136. if ($surfaceQteArbres->getSurfaceReboisement() !== $this) {
  137. $surfaceQteArbres->setSurfaceReboisement($this);
  138. }
  139. $this->surfaceQteArbres = $surfaceQteArbres;
  140. return $this;
  141. }
  142. public function jsonSerialize()
  143. {
  144. $vars = get_object_vars($this);
  145. unset($vars["orderProductSurfaces"]);
  146. unset($vars["surfaceQteArbres"]);
  147. return $vars;
  148. }
  149. }