src/Entity/SubsidiaryCompany.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SubsidiaryCompanyRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use JMS\Serializer\Annotation as Serializer;
  8. /**
  9. * @ORM\Table(indexes={ @ORM\Index(name="idx_subsidiarycompany_module_id", columns={"module_id"}), @ORM\Index(name="idx_subsidiarycompany_program_id", columns={"program_id"}) })
  10. * @ORM\Entity(repositoryClass=SubsidiaryCompanyRepository::class)
  11. * @Serializer\ExclusionPolicy("ALL")
  12. */
  13. class SubsidiaryCompany extends BaseEntity
  14. {
  15. /**
  16. * @ORM\Id
  17. * @ORM\GeneratedValue
  18. * @ORM\Column(type="integer")
  19. * @Serializer\Expose
  20. * @Serializer\Groups({"subsidiary_company", "user_profile"})
  21. */
  22. private $id;
  23. /**
  24. * @ORM\Column(type="string", length=255)
  25. * @Serializer\Expose
  26. * @Serializer\Groups({"subsidiary_company", "user_profile"})
  27. */
  28. private $name;
  29. /**
  30. * @ORM\ManyToMany(targetEntity=Office::class, inversedBy="subsidiaryCompanies")
  31. */
  32. private $offices;
  33. /**
  34. * @ORM\ManyToOne(targetEntity=Module::class, inversedBy="subsidiaryCompanies")
  35. * @ORM\JoinColumn(name="module_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
  36. */
  37. private $module;
  38. /**
  39. * @ORM\ManyToOne(targetEntity=Program::class, inversedBy="subsidiaryCompanies")
  40. * @ORM\JoinColumn(name="program_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
  41. */
  42. private $program;
  43. /**
  44. * @ORM\ManyToOne(targetEntity=Quote::class, inversedBy="subsidiaryCompanies")
  45. */
  46. private $quote;
  47. /**
  48. * @ORM\ManyToOne(targetEntity=Director::class, inversedBy="subsidiaryCompanies")
  49. */
  50. private $director;
  51. /**
  52. * @ORM\ManyToOne(targetEntity=Live::class, inversedBy="subsidiaryCompanies")
  53. */
  54. private $live;
  55. /**
  56. * @ORM\Column(type="string", length=255, nullable=true)
  57. * @Serializer\Expose
  58. */
  59. private $type;
  60. /**
  61. * @ORM\Column(type="string", length=255, nullable=true)
  62. * @Serializer\Expose
  63. * @Serializer\Groups({"subsidiary_company"})
  64. */
  65. private $mailingListAllStaff;
  66. /**
  67. * @ORM\ManyToOne(targetEntity=Country::class, inversedBy="subsidiaryCompanies")
  68. */
  69. private $country;
  70. /**
  71. * @ORM\OneToMany(targetEntity=User::class, mappedBy="subsidiaryCompany", fetch="EXTRA_LAZY")
  72. */
  73. private $users;
  74. /**
  75. * @ORM\OneToMany(targetEntity=Target::class, mappedBy="subsidiaryCompany", fetch="EXTRA_LAZY")
  76. */
  77. private Collection $targets;
  78. public function __construct()
  79. {
  80. $this->offices = new ArrayCollection();
  81. $this->users = new ArrayCollection();
  82. }
  83. public function getId(): ?int
  84. {
  85. return $this->id;
  86. }
  87. public function getName(): ?string
  88. {
  89. return $this->name;
  90. }
  91. public function setName(string $name): self
  92. {
  93. $this->name = $name;
  94. return $this;
  95. }
  96. /**
  97. * @return Collection<int, Office>
  98. */
  99. public function getOffices(): Collection
  100. {
  101. return $this->offices;
  102. }
  103. public function addOffice(Office $office): self
  104. {
  105. if (!$this->offices->contains($office)) {
  106. $this->offices[] = $office;
  107. }
  108. return $this;
  109. }
  110. public function removeOffice(Office $office): self
  111. {
  112. $this->offices->removeElement($office);
  113. return $this;
  114. }
  115. public function getModule(): ?Module
  116. {
  117. return $this->module;
  118. }
  119. public function setModule(?Module $module): self
  120. {
  121. $this->module = $module;
  122. return $this;
  123. }
  124. public function getProgram(): ?Program
  125. {
  126. return $this->program;
  127. }
  128. public function setProgram(?Program $program): self
  129. {
  130. $this->program = $program;
  131. return $this;
  132. }
  133. public function getQuote(): ?Quote
  134. {
  135. return $this->quote;
  136. }
  137. public function setQuote(?Quote $quote): self
  138. {
  139. $this->quote = $quote;
  140. return $this;
  141. }
  142. public function getDirector(): ?Director
  143. {
  144. return $this->director;
  145. }
  146. public function setDirector(?Director $director): self
  147. {
  148. $this->director = $director;
  149. return $this;
  150. }
  151. public function getLive(): ?Live
  152. {
  153. return $this->live;
  154. }
  155. public function setLive(?Live $live): self
  156. {
  157. $this->live = $live;
  158. return $this;
  159. }
  160. public function getType(): ?string
  161. {
  162. return $this->type;
  163. }
  164. public function setType(?string $type): self
  165. {
  166. $this->type = $type;
  167. return $this;
  168. }
  169. public function getMailingListAllStaff(): ?string
  170. {
  171. return $this->mailingListAllStaff;
  172. }
  173. public function setMailingListAllStaff(?string $mailingListAllStaff): self
  174. {
  175. $this->mailingListAllStaff = $mailingListAllStaff;
  176. return $this;
  177. }
  178. public function getCountry(): ?Country
  179. {
  180. return $this->country;
  181. }
  182. public function setCountry(?Country $country): self
  183. {
  184. $this->country = $country;
  185. return $this;
  186. }
  187. /**
  188. * @return Collection<int, User>
  189. */
  190. public function getUsers(): Collection
  191. {
  192. return $this->users;
  193. }
  194. public function addUser(User $user): self
  195. {
  196. if (!$this->users->contains($user)) {
  197. $this->users[] = $user;
  198. $user->setSubsidiaryCompany($this);
  199. }
  200. return $this;
  201. }
  202. public function removeUser(User $user): self
  203. {
  204. if ($this->users->removeElement($user)) {
  205. // set the owning side to null (unless already changed)
  206. if ($user->getSubsidiaryCompany() === $this) {
  207. $user->setSubsidiaryCompany(null);
  208. }
  209. }
  210. return $this;
  211. }
  212. /**
  213. * @return Collection<int, Target>
  214. */
  215. public function getTargets(): Collection
  216. {
  217. return $this->targets;
  218. }
  219. public function addTarget(Target $target): self
  220. {
  221. if (!$this->targets->contains($target)) {
  222. $this->targets[] = $target;
  223. $target->setSubsidiaryCompany($this);
  224. }
  225. return $this;
  226. }
  227. public function removeTarget(Target $target): self
  228. {
  229. if ($this->targets->removeElement($target)) {
  230. // set the owning side to null (unless already changed)
  231. if ($target->getSubsidiaryCompany() === $this) {
  232. $target->setSubsidiaryCompany(null);
  233. }
  234. }
  235. return $this;
  236. }
  237. }