src/Entity/DiscImportSession.php line 17

Open in your IDE?
  1. <?php
  2. namespace MedBrief\MSR\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Gedmo\Mapping\Annotation as Gedmo;
  5. /**
  6. * DiscImportSession
  7. *
  8. * @ORM\Table(name="DiscImportSession")
  9. *
  10. * @ORM\Entity
  11. *
  12. * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false)
  13. */
  14. class DiscImportSession
  15. {
  16. public const STATUS_SUCCESS = 1;
  17. public const STATUS_FAIL = 2;
  18. /**
  19. * @var int
  20. *
  21. * @ORM\Column(name="id", type="integer")
  22. *
  23. * @ORM\Id
  24. *
  25. * @ORM\GeneratedValue(strategy="IDENTITY")
  26. */
  27. private $id;
  28. /**
  29. * @var \DateTime|null
  30. *
  31. * @ORM\Column(name="deletedAt", type="datetime", nullable=true)
  32. */
  33. private $deletedAt;
  34. /**
  35. * @var \DateTime
  36. *
  37. * @ORM\Column(name="created", type="datetime")
  38. *
  39. * @Gedmo\Timestampable(on="create")
  40. */
  41. private $created;
  42. /**
  43. * @var \DateTime
  44. *
  45. * @ORM\Column(name="updated", type="datetime")
  46. *
  47. * @Gedmo\Timestampable(on="update")
  48. */
  49. private $updated;
  50. /**
  51. * @var int
  52. *
  53. * @ORM\Column(name="status", type="integer", nullable=false)
  54. */
  55. private $status;
  56. /**
  57. * @var DocumentImportSession
  58. *
  59. * @ORM\OneToOne(targetEntity="MedBrief\MSR\Entity\DocumentImportSession", cascade={"all"})
  60. *
  61. * @ORM\JoinColumns({
  62. *
  63. * @ORM\JoinColumn(name="document_import_session_id", referencedColumnName="id", unique=true)
  64. * })
  65. */
  66. private $documentImportSession;
  67. /**
  68. * @var \Doctrine\Common\Collections\Collection
  69. *
  70. * @ORM\OneToMany(targetEntity="MedBrief\MSR\Entity\DiscImportSessionItem", mappedBy="discImportSession", cascade={"persist","remove"})
  71. */
  72. private $discImportSessionItems;
  73. /**
  74. * @var Project
  75. *
  76. * @ORM\ManyToOne(targetEntity="MedBrief\MSR\Entity\Project", inversedBy="discImportSessions")
  77. *
  78. * @ORM\JoinColumns({
  79. *
  80. * @ORM\JoinColumn(name="project_id", referencedColumnName="id", nullable=false)
  81. * })
  82. */
  83. private $project;
  84. /**
  85. * @var User
  86. *
  87. * @ORM\ManyToOne(targetEntity="MedBrief\MSR\Entity\User", inversedBy="discImportSessions")
  88. *
  89. * @ORM\JoinColumns({
  90. *
  91. * @ORM\JoinColumn(name="creator_id", referencedColumnName="id", nullable=false)
  92. * })
  93. */
  94. private $creator;
  95. /**
  96. * @var Disc
  97. *
  98. * @ORM\ManyToOne(targetEntity="MedBrief\MSR\Entity\Disc", inversedBy="discImportSessions")
  99. *
  100. * @ORM\JoinColumns({
  101. *
  102. * @ORM\JoinColumn(name="disc_id", referencedColumnName="id", nullable=false)
  103. * })
  104. */
  105. private $disc;
  106. /**
  107. * Constructor
  108. */
  109. public function __construct()
  110. {
  111. // default fail status until we update it to SUCCESS right at the end
  112. $this->setStatus(self::STATUS_FAIL);
  113. $this->discImportSessionItems = new \Doctrine\Common\Collections\ArrayCollection();
  114. }
  115. public function __toString()
  116. {
  117. return (string) $this->getId();
  118. }
  119. /**
  120. * Get id
  121. *
  122. * @return int
  123. */
  124. public function getId()
  125. {
  126. return $this->id;
  127. }
  128. /**
  129. * Set deletedAt
  130. *
  131. * @param \DateTime $deletedAt
  132. *
  133. * @return DiscImportSession
  134. */
  135. public function setDeletedAt($deletedAt)
  136. {
  137. $this->deletedAt = $deletedAt;
  138. return $this;
  139. }
  140. /**
  141. * Get deletedAt
  142. *
  143. * @return \DateTime
  144. */
  145. public function getDeletedAt()
  146. {
  147. return $this->deletedAt;
  148. }
  149. /**
  150. * Set created
  151. *
  152. * @param \DateTime $created
  153. *
  154. * @return DiscImportSession
  155. */
  156. public function setCreated($created)
  157. {
  158. $this->created = $created;
  159. return $this;
  160. }
  161. /**
  162. * Get created
  163. *
  164. * @return \DateTime
  165. */
  166. public function getCreated()
  167. {
  168. return $this->created;
  169. }
  170. /**
  171. * Set updated
  172. *
  173. * @param \DateTime $updated
  174. *
  175. * @return DiscImportSession
  176. */
  177. public function setUpdated($updated)
  178. {
  179. $this->updated = $updated;
  180. return $this;
  181. }
  182. /**
  183. * Get updated
  184. *
  185. * @return \DateTime
  186. */
  187. public function getUpdated()
  188. {
  189. return $this->updated;
  190. }
  191. /**
  192. * Set status
  193. *
  194. * @param int $status
  195. *
  196. * @return DiscImportSession
  197. */
  198. public function setStatus($status)
  199. {
  200. $this->status = $status;
  201. return $this;
  202. }
  203. /**
  204. * Get status
  205. *
  206. * @return int
  207. */
  208. public function getStatus()
  209. {
  210. return $this->status;
  211. }
  212. /**
  213. * Set project
  214. *
  215. * @param Project $project
  216. *
  217. * @return DiscImportSession
  218. */
  219. public function setProject(Project $project)
  220. {
  221. $this->project = $project;
  222. return $this;
  223. }
  224. /**
  225. * Get project
  226. *
  227. * @return Project
  228. */
  229. public function getProject()
  230. {
  231. return $this->project;
  232. }
  233. /**
  234. * Set creator
  235. *
  236. * @param User $creator
  237. *
  238. * @return DiscImportSession
  239. */
  240. public function setCreator(User $creator)
  241. {
  242. $this->creator = $creator;
  243. return $this;
  244. }
  245. /**
  246. * Get creator
  247. *
  248. * @return User
  249. */
  250. public function getCreator()
  251. {
  252. return $this->creator;
  253. }
  254. /**
  255. * Set disc
  256. *
  257. * @param Disc $disc
  258. *
  259. * @return DiscImportSession
  260. */
  261. public function setDisc(Disc $disc)
  262. {
  263. $this->disc = $disc;
  264. return $this;
  265. }
  266. /**
  267. * Get disc
  268. *
  269. * @return Disc
  270. */
  271. public function getDisc()
  272. {
  273. return $this->disc;
  274. }
  275. /**
  276. * Add discImportSessionItem
  277. *
  278. * @param DiscImportSessionItem $discImportSessionItem
  279. *
  280. * @return DiscImportSession
  281. */
  282. public function addDiscImportSessionItem(DiscImportSessionItem $discImportSessionItem)
  283. {
  284. $this->discImportSessionItems[] = $discImportSessionItem;
  285. return $this;
  286. }
  287. /**
  288. * Remove discImportSessionItem
  289. *
  290. * @param DiscImportSessionItem $discImportSessionItem
  291. */
  292. public function removeDiscImportSessionItem(DiscImportSessionItem $discImportSessionItem)
  293. {
  294. $this->discImportSessionItems->removeElement($discImportSessionItem);
  295. }
  296. /**
  297. * Get discImportSessionItems
  298. *
  299. * @return \Doctrine\Common\Collections\Collection
  300. */
  301. public function getDiscImportSessionItems()
  302. {
  303. return $this->discImportSessionItems;
  304. }
  305. /**
  306. * Set documentImportSession
  307. *
  308. * @param DocumentImportSession $documentImportSession
  309. *
  310. * @return DiscImportSession
  311. */
  312. public function setDocumentImportSession(?DocumentImportSession $documentImportSession = null)
  313. {
  314. $this->documentImportSession = $documentImportSession;
  315. return $this;
  316. }
  317. /**
  318. * Get documentImportSession
  319. *
  320. * @return DocumentImportSession
  321. */
  322. public function getDocumentImportSession()
  323. {
  324. return $this->documentImportSession;
  325. }
  326. }