src/Entity/Live.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\LiveRepository;
  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. use JMS\Serializer\Annotation as Serializer;
  9. /**
  10. * @ORM\Entity(repositoryClass=LiveRepository::class)
  11. * @Serializer\ExclusionPolicy("ALL")
  12. */
  13. class Live extends BaseEntity
  14. {
  15. /**
  16. * @ORM\Id
  17. * @ORM\GeneratedValue
  18. * @ORM\Column(type="integer")
  19. * @Serializer\Expose
  20. * @Serializer\Groups({"live_participation", "live_list"})
  21. */
  22. private $id;
  23. /**
  24. * @ORM\Column(type="string", length=255)
  25. * @Serializer\Expose
  26. * @Serializer\Groups({"live_participation", "live_list"})
  27. */
  28. private $title;
  29. /**
  30. * @ORM\Column(type="text", nullable=true)
  31. */
  32. private $description;
  33. /**
  34. * @ORM\OneToMany(targetEntity=Course::class, mappedBy="live", cascade={"remove"}, fetch="EXTRA_LAZY")
  35. */
  36. private $courses;
  37. /**
  38. * @ORM\Column(type="string", length=255)
  39. * @Serializer\Expose
  40. * @Serializer\Groups({"live_participation", "live_list"})
  41. */
  42. private $type;
  43. /**
  44. * @ORM\ManyToMany(targetEntity=User::class, inversedBy="lives")
  45. * @Serializer\Expose
  46. * @Serializer\Groups({"live_details"})
  47. */
  48. private $coaches;
  49. /**
  50. * @ORM\OneToMany(targetEntity=SubsidiaryCompany::class, mappedBy="live", cascade={"remove"}, fetch="EXTRA_LAZY")
  51. */
  52. private $subsidiaryCompanies;
  53. /**
  54. * @ORM\OneToMany(targetEntity=Job::class, mappedBy="live", cascade={"remove"}, fetch="EXTRA_LAZY")
  55. */
  56. private $jobs;
  57. /**
  58. * @ORM\OneToMany(targetEntity=Office::class, mappedBy="live", cascade={"remove"}, fetch="EXTRA_LAZY")
  59. */
  60. private $offices;
  61. /**
  62. * @ORM\OneToMany(targetEntity=Contract::class, mappedBy="live", cascade={"remove"}, fetch="EXTRA_LAZY")
  63. */
  64. private $contracts;
  65. /**
  66. * @ORM\Column(type="boolean")
  67. */
  68. private $isAllJobs = true;
  69. /**
  70. * @ORM\Column(type="boolean")
  71. */
  72. private $isAllOffices = true;
  73. /**
  74. * @ORM\Column(type="boolean")
  75. */
  76. private $isAllContracts = true;
  77. /**
  78. * @ORM\Column(type="boolean")
  79. */
  80. private $isAllSubsidiaryCompanies = true;
  81. /**
  82. * @ORM\OneToOne(targetEntity=ImageManager::class, cascade={"persist", "remove"})
  83. * @Serializer\Expose
  84. * @Serializer\Groups({"live_participation", "live_list"})
  85. */
  86. private $cover;
  87. /**
  88. * @ORM\Column(type="boolean")
  89. */
  90. private $isPublished = false;
  91. /**
  92. * @ORM\Column(type="json", nullable=true)
  93. */
  94. private $knowledges = [];
  95. /**
  96. * @ORM\Column(type="datetime", nullable=true)
  97. * @Serializer\Expose
  98. * @Serializer\Groups({"live_list"})
  99. */
  100. private $startAt;
  101. /**
  102. * @ORM\Column(type="datetime", nullable=true)
  103. * @Serializer\Expose
  104. * @Serializer\Groups({"live_list"})
  105. */
  106. private $endAt;
  107. /**
  108. * @Gedmo\Slug(fields={"title"})
  109. * @ORM\Column(length=191)
  110. */
  111. private $slug;
  112. /**
  113. * @ORM\OneToMany(targetEntity=ModuleItem::class, mappedBy="live", cascade={"persist", "remove"}, fetch="EXTRA_LAZY")
  114. */
  115. private $moduleItems;
  116. /**
  117. * @ORM\OneToMany(targetEntity=ModuleParticipation::class, mappedBy="live", cascade={"persist", "remove"}, fetch="EXTRA_LAZY")
  118. */
  119. private $moduleParticipations;
  120. /**
  121. * @ORM\Column(type="time", nullable=true)
  122. */
  123. private $time;
  124. /**
  125. * @ORM\OneToMany(targetEntity=LiveParticipant::class, mappedBy="live", cascade={"remove"}, fetch="EXTRA_LAZY")
  126. */
  127. private $liveParticipants;
  128. /**
  129. * @ORM\Column(type="boolean", nullable=true)
  130. */
  131. private $isDoNotMiss;
  132. /**
  133. * @ORM\Column(type="text", nullable=true)
  134. */
  135. private $rejectReason;
  136. /**
  137. * @ORM\Column(type="string", length=255, nullable=true)
  138. */
  139. private $currentPlace;
  140. /**
  141. * @ORM\ManyToMany(targetEntity=Module::class, inversedBy="lives")
  142. * @Serializer\Expose
  143. * @Serializer\Groups({"live_details"})
  144. */
  145. private $modules;
  146. /**
  147. * @ORM\OneToMany(targetEntity=LiveView::class, mappedBy="live", orphanRemoval=true, fetch="EXTRA_LAZY")
  148. */
  149. private $liveViews;
  150. /**
  151. * @ORM\Column(type="string", length=1000000, nullable=true)
  152. */
  153. private $reviewReason;
  154. /**
  155. * @ORM\OneToMany(targetEntity=LiveRecord::class, mappedBy="live", orphanRemoval=true, fetch="EXTRA_LAZY")
  156. */
  157. private $liveRecords;
  158. /**
  159. * @ORM\Column(type="boolean", nullable=true)
  160. */
  161. private $startingNotificationSent = false;
  162. public function __construct()
  163. {
  164. $this->courses = new ArrayCollection();
  165. $this->coaches = new ArrayCollection();
  166. $this->subsidiaryCompanies = new ArrayCollection();
  167. $this->jobs = new ArrayCollection();
  168. $this->offices = new ArrayCollection();
  169. $this->contracts = new ArrayCollection();
  170. $this->moduleItems = new ArrayCollection();
  171. $this->moduleParticipations = new ArrayCollection();
  172. $this->liveParticipants = new ArrayCollection();
  173. $this->modules = new ArrayCollection();
  174. $this->liveViews = new ArrayCollection();
  175. $this->liveRecords = new ArrayCollection();
  176. }
  177. public function getId(): ?int
  178. {
  179. return $this->id;
  180. }
  181. public function getTitle(): ?string
  182. {
  183. return $this->title;
  184. }
  185. public function setTitle(string $title): self
  186. {
  187. $this->title = $title;
  188. return $this;
  189. }
  190. public function getDescription(): ?string
  191. {
  192. return $this->description;
  193. }
  194. public function setDescription(?string $description): self
  195. {
  196. $this->description = $description;
  197. return $this;
  198. }
  199. /**
  200. * @return Collection<int, Course>
  201. */
  202. public function getCourses(): Collection
  203. {
  204. return $this->courses;
  205. }
  206. public function addCourse(Course $course): self
  207. {
  208. if (!$this->courses->contains($course)) {
  209. $this->courses[] = $course;
  210. $course->setLive($this);
  211. }
  212. return $this;
  213. }
  214. public function removeCourse(Course $course): self
  215. {
  216. if ($this->courses->removeElement($course)) {
  217. // set the owning side to null (unless already changed)
  218. if ($course->getLive() === $this) {
  219. $course->setLive(null);
  220. }
  221. }
  222. return $this;
  223. }
  224. public function getType(): ?string
  225. {
  226. return $this->type;
  227. }
  228. public function setType(string $type): self
  229. {
  230. $this->type = $type;
  231. return $this;
  232. }
  233. /**
  234. * @return Collection<int, User>
  235. */
  236. public function getCoaches(): Collection
  237. {
  238. return $this->coaches;
  239. }
  240. public function addCoach(User $coach): self
  241. {
  242. if (!$this->coaches->contains($coach)) {
  243. $this->coaches[] = $coach;
  244. }
  245. return $this;
  246. }
  247. public function removeCoach(User $coach): self
  248. {
  249. $this->coaches->removeElement($coach);
  250. return $this;
  251. }
  252. /**
  253. * @return Collection<int, SubsidiaryCompany>
  254. */
  255. public function getSubsidiaryCompanies(): Collection
  256. {
  257. return $this->subsidiaryCompanies;
  258. }
  259. public function addSubsidiaryCompany(SubsidiaryCompany $subsidiaryCompany): self
  260. {
  261. if (!$this->subsidiaryCompanies->contains($subsidiaryCompany)) {
  262. $this->subsidiaryCompanies[] = $subsidiaryCompany;
  263. $subsidiaryCompany->setLive($this);
  264. }
  265. return $this;
  266. }
  267. public function removeSubsidiaryCompany(SubsidiaryCompany $subsidiaryCompany): self
  268. {
  269. if ($this->subsidiaryCompanies->removeElement($subsidiaryCompany)) {
  270. // set the owning side to null (unless already changed)
  271. if ($subsidiaryCompany->getLive() === $this) {
  272. $subsidiaryCompany->setLive(null);
  273. }
  274. }
  275. return $this;
  276. }
  277. /**
  278. * @return Collection<int, Job>
  279. */
  280. public function getJobs(): Collection
  281. {
  282. return $this->jobs;
  283. }
  284. public function addJob(Job $job): self
  285. {
  286. if (!$this->jobs->contains($job)) {
  287. $this->jobs[] = $job;
  288. $job->setLive($this);
  289. }
  290. return $this;
  291. }
  292. public function removeJob(Job $job): self
  293. {
  294. if ($this->jobs->removeElement($job)) {
  295. // set the owning side to null (unless already changed)
  296. if ($job->getLive() === $this) {
  297. $job->setLive(null);
  298. }
  299. }
  300. return $this;
  301. }
  302. /**
  303. * @return Collection<int, Office>
  304. */
  305. public function getOffices(): Collection
  306. {
  307. return $this->offices;
  308. }
  309. public function addOffice(Office $office): self
  310. {
  311. if (!$this->offices->contains($office)) {
  312. $this->offices[] = $office;
  313. $office->setLive($this);
  314. }
  315. return $this;
  316. }
  317. public function removeOffice(Office $office): self
  318. {
  319. if ($this->offices->removeElement($office)) {
  320. // set the owning side to null (unless already changed)
  321. if ($office->getLive() === $this) {
  322. $office->setLive(null);
  323. }
  324. }
  325. return $this;
  326. }
  327. /**
  328. * @return Collection<int, Contract>
  329. */
  330. public function getContracts(): Collection
  331. {
  332. return $this->contracts;
  333. }
  334. public function addContract(Contract $contract): self
  335. {
  336. if (!$this->contracts->contains($contract)) {
  337. $this->contracts[] = $contract;
  338. $contract->setLive($this);
  339. }
  340. return $this;
  341. }
  342. public function removeContract(Contract $contract): self
  343. {
  344. if ($this->contracts->removeElement($contract)) {
  345. // set the owning side to null (unless already changed)
  346. if ($contract->getLive() === $this) {
  347. $contract->setLive(null);
  348. }
  349. }
  350. return $this;
  351. }
  352. public function isIsAllJobs(): ?bool
  353. {
  354. return $this->isAllJobs;
  355. }
  356. public function setIsAllJobs(bool $isAllJobs): self
  357. {
  358. $this->isAllJobs = $isAllJobs;
  359. return $this;
  360. }
  361. public function isIsAllOffices(): ?bool
  362. {
  363. return $this->isAllOffices;
  364. }
  365. public function setIsAllOffices(bool $isAllOffices): self
  366. {
  367. $this->isAllOffices = $isAllOffices;
  368. return $this;
  369. }
  370. public function isIsAllContracts(): ?bool
  371. {
  372. return $this->isAllContracts;
  373. }
  374. public function setIsAllContracts(bool $isAllContracts): self
  375. {
  376. $this->isAllContracts = $isAllContracts;
  377. return $this;
  378. }
  379. public function isIsAllSubsidiaryCompanies(): ?bool
  380. {
  381. return $this->isAllSubsidiaryCompanies;
  382. }
  383. public function setIsAllSubsidiaryCompanies(bool $isAllSubsidiaryCompanies): self
  384. {
  385. $this->isAllSubsidiaryCompanies = $isAllSubsidiaryCompanies;
  386. return $this;
  387. }
  388. public function getCover(): ?ImageManager
  389. {
  390. return $this->cover;
  391. }
  392. public function setCover(?ImageManager $cover): self
  393. {
  394. $this->cover = $cover;
  395. return $this;
  396. }
  397. public function isIsPublished(): ?bool
  398. {
  399. return $this->isPublished;
  400. }
  401. public function setIsPublished(bool $isPublished): self
  402. {
  403. $this->isPublished = $isPublished;
  404. return $this;
  405. }
  406. public function getKnowledges(): ?array
  407. {
  408. return $this->knowledges;
  409. }
  410. public function setKnowledges(?array $knowledges): self
  411. {
  412. $this->knowledges = $knowledges;
  413. return $this;
  414. }
  415. public function getStartAt(): ?\DateTimeInterface
  416. {
  417. return $this->startAt;
  418. }
  419. public function setStartAt(?\DateTimeInterface $startAt): self
  420. {
  421. $this->startAt = $startAt;
  422. return $this;
  423. }
  424. public function getEndAt(): ?\DateTimeInterface
  425. {
  426. return $this->endAt;
  427. }
  428. public function setEndAt(?\DateTimeInterface $endAt): self
  429. {
  430. $this->endAt = $endAt;
  431. return $this;
  432. }
  433. /**
  434. * Get the value of slug
  435. */
  436. public function getSlug()
  437. {
  438. return $this->slug;
  439. }
  440. /**
  441. * Set the value of slug
  442. *
  443. * @return self
  444. */
  445. public function setSlug($slug)
  446. {
  447. $this->slug = $slug;
  448. return $this;
  449. }
  450. /**
  451. * @return Collection<int, ModuleItem>
  452. */
  453. public function getModuleItems(): Collection
  454. {
  455. return $this->moduleItems;
  456. }
  457. public function addModuleItem(ModuleItem $moduleItem): self
  458. {
  459. if (!$this->moduleItems->contains($moduleItem)) {
  460. $this->moduleItems[] = $moduleItem;
  461. $moduleItem->setLive($this);
  462. }
  463. return $this;
  464. }
  465. public function removeModuleItem(ModuleItem $moduleItem): self
  466. {
  467. if ($this->moduleItems->removeElement($moduleItem)) {
  468. // set the owning side to null (unless already changed)
  469. if ($moduleItem->getLive() === $this) {
  470. $moduleItem->setLive(null);
  471. }
  472. }
  473. return $this;
  474. }
  475. /**
  476. * @return Collection<int, ModuleParticipation>
  477. */
  478. public function getModuleParticipations(): Collection
  479. {
  480. return $this->moduleParticipations;
  481. }
  482. public function addModuleParticipation(ModuleParticipation $moduleParticipation): self
  483. {
  484. if (!$this->moduleParticipations->contains($moduleParticipation)) {
  485. $this->moduleParticipations[] = $moduleParticipation;
  486. $moduleParticipation->setLive($this);
  487. }
  488. return $this;
  489. }
  490. public function removeModuleParticipation(ModuleParticipation $moduleParticipation): self
  491. {
  492. if ($this->moduleParticipations->removeElement($moduleParticipation)) {
  493. // set the owning side to null (unless already changed)
  494. if ($moduleParticipation->getLive() === $this) {
  495. $moduleParticipation->setLive(null);
  496. }
  497. }
  498. return $this;
  499. }
  500. public function getTime(): ?\DateTimeInterface
  501. {
  502. return $this->time;
  503. }
  504. public function setTime(?\DateTimeInterface $time): self
  505. {
  506. $this->time = $time;
  507. return $this;
  508. }
  509. /**
  510. * @return Collection<int, LiveParticipant>
  511. */
  512. public function getLiveParticipants(): Collection
  513. {
  514. return $this->liveParticipants;
  515. }
  516. public function addLiveParticipant(LiveParticipant $liveParticipant): self
  517. {
  518. if (!$this->liveParticipants->contains($liveParticipant)) {
  519. $this->liveParticipants[] = $liveParticipant;
  520. $liveParticipant->setLive($this);
  521. }
  522. return $this;
  523. }
  524. public function removeLiveParticipant(LiveParticipant $liveParticipant): self
  525. {
  526. if ($this->liveParticipants->removeElement($liveParticipant)) {
  527. // set the owning side to null (unless already changed)
  528. if ($liveParticipant->getLive() === $this) {
  529. $liveParticipant->setLive(null);
  530. }
  531. }
  532. return $this;
  533. }
  534. public function isIsDoNotMiss(): ?bool
  535. {
  536. return $this->isDoNotMiss;
  537. }
  538. public function setIsDoNotMiss(?bool $isDoNotMiss): self
  539. {
  540. $this->isDoNotMiss = $isDoNotMiss;
  541. return $this;
  542. }
  543. public function getRejectReason(): ?string
  544. {
  545. return $this->rejectReason;
  546. }
  547. public function setRejectReason(?string $rejectReason): self
  548. {
  549. $this->rejectReason = $rejectReason;
  550. return $this;
  551. }
  552. public function getCurrentPlace(): ?string
  553. {
  554. return $this->currentPlace;
  555. }
  556. public function setCurrentPlace(?string $currentPlace): self
  557. {
  558. $this->currentPlace = $currentPlace;
  559. return $this;
  560. }
  561. /**
  562. * @return Collection<int, Module>
  563. */
  564. public function getModules(): Collection
  565. {
  566. return $this->modules;
  567. }
  568. public function addModule(Module $module): self
  569. {
  570. if (!$this->modules->contains($module)) {
  571. $this->modules[] = $module;
  572. }
  573. return $this;
  574. }
  575. public function removeModule(Module $module): self
  576. {
  577. $this->modules->removeElement($module);
  578. return $this;
  579. }
  580. /**
  581. * @return Collection<int, LiveView>
  582. */
  583. public function getLiveViews(): Collection
  584. {
  585. return $this->liveViews;
  586. }
  587. public function addLiveView(LiveView $liveView): self
  588. {
  589. if (!$this->liveViews->contains($liveView)) {
  590. $this->liveViews[] = $liveView;
  591. $liveView->setLive($this);
  592. }
  593. return $this;
  594. }
  595. public function removeLiveView(LiveView $liveView): self
  596. {
  597. if ($this->liveViews->removeElement($liveView)) {
  598. // set the owning side to null (unless already changed)
  599. if ($liveView->getLive() === $this) {
  600. $liveView->setLive(null);
  601. }
  602. }
  603. return $this;
  604. }
  605. public function getReviewReason(): ?string
  606. {
  607. return $this->reviewReason;
  608. }
  609. public function setReviewReason(?string $reviewReason): self
  610. {
  611. $this->reviewReason = $reviewReason;
  612. return $this;
  613. }
  614. /**
  615. * @return Collection<int, LiveRecord>
  616. */
  617. public function getLiveRecords(): Collection
  618. {
  619. return $this->liveRecords;
  620. }
  621. public function addLiveRecord(LiveRecord $liveRecord): self
  622. {
  623. if (!$this->liveRecords->contains($liveRecord)) {
  624. $this->liveRecords[] = $liveRecord;
  625. $liveRecord->setLive($this);
  626. }
  627. return $this;
  628. }
  629. public function removeLiveRecord(LiveRecord $liveRecord): self
  630. {
  631. if ($this->liveRecords->removeElement($liveRecord)) {
  632. // set the owning side to null (unless already changed)
  633. if ($liveRecord->getLive() === $this) {
  634. $liveRecord->setLive(null);
  635. }
  636. }
  637. return $this;
  638. }
  639. public function isStartingNotificationSent(): ?bool
  640. {
  641. return $this->startingNotificationSent;
  642. }
  643. public function setStartingNotificationSent(?bool $startingNotificationSent): self
  644. {
  645. $this->startingNotificationSent = $startingNotificationSent;
  646. return $this;
  647. }
  648. }