src/Entity/ProjectDeletionReport.php line 22

Open in your IDE?
  1. <?php
  2. namespace MedBrief\MSR\Entity;
  3. use DH\Auditor\Provider\Doctrine\Auditing\Annotation as Audit;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. /**
  9. * ProjectDeletionReport
  10. *
  11. * @ORM\Table(name="ProjectDeletionReport")
  12. *
  13. * @ORM\Entity
  14. *
  15. * @Audit\Auditable
  16. *
  17. * @Audit\Security(view={"ROLE_ALLOWED_TO_AUDIT"})
  18. */
  19. class ProjectDeletionReport
  20. {
  21. /**
  22. * @var int
  23. *
  24. * @ORM\Column(name="id", type="integer")
  25. *
  26. * @ORM\Id
  27. *
  28. * @ORM\GeneratedValue(strategy="IDENTITY")
  29. */
  30. protected $id;
  31. /**
  32. * @var string|null
  33. *
  34. * @ORM\Column(name="patientDateOfBirth", type="text", nullable=true)
  35. */
  36. protected $patientDateOfBirth;
  37. /**
  38. * @var \DateTime
  39. *
  40. * @ORM\Column(name="created", type="datetime")
  41. *
  42. * @Gedmo\Timestampable(on="create")
  43. */
  44. protected $created;
  45. /**
  46. * @var \DateTime
  47. *
  48. * @ORM\Column(name="updated", type="datetime")
  49. *
  50. * @Gedmo\Timestampable(on="update")
  51. */
  52. protected $updated;
  53. /**
  54. * @var Project
  55. *
  56. * @ORM\OneToOne(targetEntity="MedBrief\MSR\Entity\Project", mappedBy="projectDeletionReport")
  57. */
  58. protected $project;
  59. /**
  60. * The Documents associated to this Report.
  61. *
  62. * @var Collection
  63. *
  64. * @ORM\OneToMany(targetEntity="MedBrief\MSR\Entity\ProjectDeletionDocument", mappedBy="projectDeletionReport")
  65. */
  66. protected $documents;
  67. public function __construct()
  68. {
  69. $this->documents = new ArrayCollection();
  70. }
  71. public function __toString()
  72. {
  73. return $this->project->getName() . ' Deletion report ' . $this->created;
  74. }
  75. /**
  76. * Get id
  77. *
  78. * @return int
  79. */
  80. public function getId()
  81. {
  82. return $this->id;
  83. }
  84. /**
  85. * Get the value of created
  86. *
  87. * @return \DateTime
  88. */
  89. public function getCreated()
  90. {
  91. return $this->created;
  92. }
  93. /**
  94. * Set the value of created
  95. *
  96. * @param \DateTime $created
  97. *
  98. * @return self
  99. */
  100. public function setCreated(\DateTime $created)
  101. {
  102. $this->created = $created;
  103. return $this;
  104. }
  105. /**
  106. * Get the value of updated
  107. *
  108. * @return \DateTime
  109. */
  110. public function getUpdated()
  111. {
  112. return $this->updated;
  113. }
  114. /**
  115. * Set the value of updated
  116. *
  117. * @param \DateTime $updated
  118. *
  119. * @return self
  120. */
  121. public function setUpdated(\DateTime $updated)
  122. {
  123. $this->updated = $updated;
  124. return $this;
  125. }
  126. /**
  127. * Get the value of project
  128. *
  129. * @return Project
  130. */
  131. public function getProject()
  132. {
  133. return $this->project;
  134. }
  135. /**
  136. * Set the value of project
  137. *
  138. * @param Project $project
  139. *
  140. * @return self
  141. */
  142. public function setProject(?Project $project)
  143. {
  144. $this->project = $project;
  145. return $this;
  146. }
  147. /**
  148. * Get the value of patientDateOfBirth
  149. *
  150. * @return string|null
  151. */
  152. public function getPatientDateOfBirth(): ?string
  153. {
  154. return $this->patientDateOfBirth;
  155. }
  156. /**
  157. * Set the value of patientDateOfBirth
  158. *
  159. * @param string|null $patientDateOfBirth
  160. *
  161. * @return self
  162. */
  163. public function setPatientDateOfBirth(?string $patientDateOfBirth)
  164. {
  165. $this->patientDateOfBirth = $patientDateOfBirth;
  166. return $this;
  167. }
  168. /**
  169. * Get the Documents associated to this Report.
  170. *
  171. * @return Collection
  172. */
  173. public function getDocuments()
  174. {
  175. return $this->documents;
  176. }
  177. /**
  178. * Add a Document
  179. *
  180. * @param ProjectDeletionDocument $document
  181. *
  182. * @return self
  183. */
  184. public function addDocument(ProjectDeletionDocument $document): self
  185. {
  186. if (!$this->documents->contains($document)) {
  187. $this->documents[] = $document;
  188. $document->setProjectDeletionReport($this);
  189. }
  190. return $this;
  191. }
  192. /**
  193. * Remove a Document
  194. *
  195. * @param ProjectDeletionDocument $document
  196. *
  197. * @return self
  198. */
  199. public function removeDocument(ProjectDeletionDocument $document): self
  200. {
  201. if ($this->documents->removeElement($document)) {
  202. // set the owning side to null (unless already changed)
  203. if ($document->getProjectDeletionReport() === $this) {
  204. $document->setProjectDeletionReport(null);
  205. }
  206. }
  207. return $this;
  208. }
  209. }