src/Entity/Instance.php line 16

Open in your IDE?
  1. <?php
  2. namespace MedBrief\MSR\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use MedBrief\MSR\Repository\InstanceRepository;
  7. use Ramsey\Uuid\UuidInterface;
  8. /**
  9. * @ORM\Entity(repositoryClass=InstanceRepository::class)
  10. *
  11. * @ORM\Table(name="Instance", indexes={@ORM\Index(name="orthancId_index", columns={"orthancId"})})
  12. */
  13. class Instance
  14. {
  15. /**
  16. * @var UuidInterface
  17. *
  18. * @ORM\Column(name="id", type="uuid")
  19. *
  20. * @ORM\Id
  21. *
  22. * @ORM\GeneratedValue(strategy="CUSTOM")
  23. *
  24. * @ORM\CustomIdGenerator(class="Ramsey\Uuid\Doctrine\UuidGenerator")
  25. */
  26. private $id;
  27. /**
  28. * @ORM\Column(type="string", length=255)
  29. */
  30. private string $orthancId;
  31. /**
  32. * @ORM\ManyToOne(targetEntity=Series::class, inversedBy="instances")
  33. *
  34. * @ORM\JoinColumn(nullable=false)
  35. */
  36. private Series $parentSeries;
  37. /**
  38. * @var ArrayCollection
  39. *
  40. * @ORM\ManyToMany(targetEntity=Disc::class, inversedBy="instances")
  41. */
  42. private $discs;
  43. /**
  44. * @var Project|null
  45. *
  46. * @ORM\ManyToOne(targetEntity=Project::class, inversedBy="instances")
  47. */
  48. private ?Project $project;
  49. public function __construct()
  50. {
  51. $this->discs = new ArrayCollection();
  52. }
  53. /**
  54. * @return UuidInterface|null
  55. */
  56. public function getId(): ?UuidInterface
  57. {
  58. return $this->id;
  59. }
  60. /**
  61. * @return string|null
  62. */
  63. public function getOrthancId(): ?string
  64. {
  65. return $this->orthancId;
  66. }
  67. /**
  68. * @param string $orthancId
  69. *
  70. * @return $this
  71. */
  72. public function setOrthancId(string $orthancId): self
  73. {
  74. $this->orthancId = $orthancId;
  75. return $this;
  76. }
  77. /**
  78. * @return Series|null
  79. */
  80. public function getParentSeries(): ?Series
  81. {
  82. return $this->parentSeries;
  83. }
  84. /**
  85. * @param Series|null $parentSeries
  86. *
  87. * @return $this
  88. */
  89. public function setParentSeries(?Series $parentSeries): self
  90. {
  91. $this->parentSeries = $parentSeries;
  92. return $this;
  93. }
  94. /**
  95. * @return Collection<int, Disc>
  96. */
  97. public function getDiscs(): Collection
  98. {
  99. return $this->discs;
  100. }
  101. /**
  102. * @param Disc $disc
  103. *
  104. * @return $this
  105. */
  106. public function addDisc(Disc $disc): self
  107. {
  108. if (!$this->discs->contains($disc)) {
  109. $this->discs[] = $disc;
  110. }
  111. return $this;
  112. }
  113. /**
  114. * @param Disc $disc
  115. *
  116. * @return $this
  117. */
  118. public function removeDisc(Disc $disc): self
  119. {
  120. $this->discs->removeElement($disc);
  121. return $this;
  122. }
  123. /**
  124. * @return Project|null
  125. */
  126. public function getProject(): ?Project
  127. {
  128. return $this->project;
  129. }
  130. /**
  131. * @param Project $project
  132. *
  133. * @return Instance
  134. */
  135. public function setProject(Project $project): Instance
  136. {
  137. $this->project = $project;
  138. return $this;
  139. }
  140. }