src/Entity/GuardianContract.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\GuardianRegister\GuardianRegister;
  4. use App\Entity\Guardian\GuardianContractPrice;
  5. use App\Repository\GuardianContractRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. /**
  11. * @ORM\Entity(repositoryClass=GuardianContractRepository::class)
  12. */
  13. class GuardianContract
  14. {
  15. /**
  16. * @ORM\Id
  17. * @ORM\GeneratedValue
  18. * @ORM\Column(type="integer")
  19. * @Groups({"GuardianContractPriceList"})
  20. */
  21. private $id;
  22. /**
  23. * @ORM\Column(type="string", length=255, nullable=true)
  24. */
  25. private $filePath;
  26. /**
  27. * @ORM\Column(type="datetime", nullable=true)
  28. */
  29. private $dateUpdated;
  30. /**
  31. * @ORM\Column(type="text", nullable=true)
  32. */
  33. private $comment;
  34. /**
  35. * @ORM\OneToMany(targetEntity=Guardian::class, mappedBy="guardianContract")
  36. */
  37. private $guardians;
  38. /**
  39. * @ORM\Column(type="datetime", nullable=true)
  40. */
  41. private $createdAt;
  42. /**
  43. * @ORM\OneToMany(targetEntity=GuardianRegister::class, mappedBy="guardianContract")
  44. */
  45. private $guardianRegisters;
  46. /**
  47. * @ORM\Column(type="boolean", nullable=true)
  48. */
  49. private $flagTrial;
  50. /**
  51. * @ORM\OneToOne(targetEntity=GuardianContractPrice::class, mappedBy="guardianContract", cascade={"persist", "remove"})
  52. */
  53. private $guardianContractPrice;
  54. public function __construct()
  55. {
  56. $this->guardians = new ArrayCollection();
  57. $this->guardianRegisters = new ArrayCollection();
  58. }
  59. public function getId(): ?int
  60. {
  61. return $this->id;
  62. }
  63. public function getFilePath(): ?string
  64. {
  65. return $this->filePath;
  66. }
  67. public function setFilePath(?string $filePath): self
  68. {
  69. $this->filePath = $filePath;
  70. return $this;
  71. }
  72. public function getDateUpdated(): ?\DateTimeInterface
  73. {
  74. return $this->dateUpdated;
  75. }
  76. public function setDateUpdated(?\DateTimeInterface $dateUpdated): self
  77. {
  78. $this->dateUpdated = $dateUpdated;
  79. return $this;
  80. }
  81. public function getComment(): ?string
  82. {
  83. return $this->comment;
  84. }
  85. public function setComment(?string $comment): self
  86. {
  87. $this->comment = $comment;
  88. return $this;
  89. }
  90. /**
  91. * @return Collection|Guardian[]
  92. */
  93. public function getGuardians(): Collection
  94. {
  95. return $this->guardians;
  96. }
  97. public function addGuardian(Guardian $guardian): self
  98. {
  99. if (!$this->guardians->contains($guardian)) {
  100. $this->guardians[] = $guardian;
  101. $guardian->setGuardianContract($this);
  102. }
  103. return $this;
  104. }
  105. public function removeGuardian(Guardian $guardian): self
  106. {
  107. if ($this->guardians->removeElement($guardian)) {
  108. // set the owning side to null (unless already changed)
  109. if ($guardian->getGuardianContract() === $this) {
  110. $guardian->setGuardianContract(null);
  111. }
  112. }
  113. return $this;
  114. }
  115. public function __toString()
  116. {
  117. return "{$this->id} {$this->filePath}";
  118. }
  119. public function getCreatedAt(): ?\DateTimeInterface
  120. {
  121. return $this->createdAt;
  122. }
  123. public function setCreatedAt(?\DateTimeInterface $createdAt): self
  124. {
  125. $this->createdAt = $createdAt;
  126. return $this;
  127. }
  128. /**
  129. * @return Collection<int, GuardianRegister>
  130. */
  131. public function getGuardianRegisters(): Collection
  132. {
  133. return $this->guardianRegisters;
  134. }
  135. public function addGuardianRegister(GuardianRegister $guardianRegister): self
  136. {
  137. if (!$this->guardianRegisters->contains($guardianRegister)) {
  138. $this->guardianRegisters[] = $guardianRegister;
  139. $guardianRegister->setGuardianContract($this);
  140. }
  141. return $this;
  142. }
  143. public function removeGuardianRegister(GuardianRegister $guardianRegister): self
  144. {
  145. if ($this->guardianRegisters->removeElement($guardianRegister)) {
  146. // set the owning side to null (unless already changed)
  147. if ($guardianRegister->getGuardianContract() === $this) {
  148. $guardianRegister->setGuardianContract(null);
  149. }
  150. }
  151. return $this;
  152. }
  153. public function getFlagTrial(): ?bool
  154. {
  155. return $this->flagTrial;
  156. }
  157. public function setFlagTrial(?bool $flagTrial): self
  158. {
  159. $this->flagTrial = $flagTrial;
  160. return $this;
  161. }
  162. public function getGuardianContractPrice(): ?GuardianContractPrice
  163. {
  164. return $this->guardianContractPrice;
  165. }
  166. public function setGuardianContractPrice(?GuardianContractPrice $guardianContractPrice): self
  167. {
  168. // unset the owning side of the relation if necessary
  169. if ($guardianContractPrice === null && $this->guardianContractPrice !== null) {
  170. $this->guardianContractPrice->setGuardianContract(null);
  171. }
  172. // set the owning side of the relation if necessary
  173. if ($guardianContractPrice !== null && $guardianContractPrice->getGuardianContract() !== $this) {
  174. $guardianContractPrice->setGuardianContract($this);
  175. }
  176. $this->guardianContractPrice = $guardianContractPrice;
  177. return $this;
  178. }
  179. }