src/Entity/Quote.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\QuoteRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use App\Validator\UniquePublishing;
  8. /**
  9. * @ORM\Entity(repositoryClass=QuoteRepository::class)
  10. * @UniquePublishing
  11. */
  12. class Quote extends BaseEntity
  13. {
  14. /**
  15. * @ORM\Id
  16. * @ORM\GeneratedValue
  17. * @ORM\Column(type="integer")
  18. */
  19. private $id;
  20. /**
  21. * @ORM\Column(type="string", length=255, nullable=true)
  22. */
  23. private $title;
  24. /**
  25. * @ORM\Column(type="text")
  26. */
  27. private $content;
  28. /**
  29. * @ORM\Column(type="datetime", nullable=true)
  30. */
  31. private $startAt;
  32. /**
  33. * @ORM\Column(type="datetime", nullable=true)
  34. */
  35. private $endAt;
  36. /**
  37. * @ORM\Column(type="boolean")
  38. */
  39. private $isPublished;
  40. /**
  41. * @ORM\ManyToOne(targetEntity=User::class, inversedBy="quotes")
  42. */
  43. private $publishedBy;
  44. /**
  45. * @ORM\Column(type="datetime", nullable=true)
  46. */
  47. private $publishedAt;
  48. /**
  49. * @ORM\OneToMany(targetEntity=SubsidiaryCompany::class, mappedBy="quote", fetch="EXTRA_LAZY")
  50. */
  51. private $subsidiaryCompanies;
  52. /**
  53. * @ORM\Column(type="string", length=255, nullable=true)
  54. */
  55. private $author;
  56. public function __construct()
  57. {
  58. $this->subsidiaryCompanies = new ArrayCollection();
  59. }
  60. public function getId(): ?int
  61. {
  62. return $this->id;
  63. }
  64. public function getTitle(): ?string
  65. {
  66. return $this->title;
  67. }
  68. public function setTitle(string $title): self
  69. {
  70. $this->title = $title;
  71. return $this;
  72. }
  73. public function getContent(): ?string
  74. {
  75. return $this->content;
  76. }
  77. public function setContent(string $content): self
  78. {
  79. $this->content = $content;
  80. return $this;
  81. }
  82. public function getStartAt(): ?\DateTimeInterface
  83. {
  84. return $this->startAt;
  85. }
  86. public function setStartAt(?\DateTimeInterface $startAt): self
  87. {
  88. $this->startAt = $startAt;
  89. return $this;
  90. }
  91. public function getEndAt(): ?\DateTimeInterface
  92. {
  93. return $this->endAt;
  94. }
  95. public function setEndAt(?\DateTimeInterface $endAt): self
  96. {
  97. $this->endAt = $endAt;
  98. return $this;
  99. }
  100. public function isIsPublished(): ?bool
  101. {
  102. return $this->isPublished;
  103. }
  104. public function setIsPublished(bool $isPublished): self
  105. {
  106. $this->isPublished = $isPublished;
  107. return $this;
  108. }
  109. public function getPublishedBy(): ?User
  110. {
  111. return $this->publishedBy;
  112. }
  113. public function setPublishedBy(?User $publishedBy): self
  114. {
  115. $this->publishedBy = $publishedBy;
  116. return $this;
  117. }
  118. public function getPublishedAt(): ?\DateTimeInterface
  119. {
  120. return $this->publishedAt;
  121. }
  122. public function setPublishedAt(?\DateTimeInterface $publishedAt): self
  123. {
  124. $this->publishedAt = $publishedAt;
  125. return $this;
  126. }
  127. /**
  128. * @return Collection<int, SubsidiaryCompany>
  129. */
  130. public function getSubsidiaryCompanies(): Collection
  131. {
  132. return $this->subsidiaryCompanies;
  133. }
  134. public function addSubsidiaryCompany(SubsidiaryCompany $subsidiaryCompany): self
  135. {
  136. if (!$this->subsidiaryCompanies->contains($subsidiaryCompany)) {
  137. $this->subsidiaryCompanies[] = $subsidiaryCompany;
  138. $subsidiaryCompany->setQuote($this);
  139. }
  140. return $this;
  141. }
  142. public function removeSubsidiaryCompany(SubsidiaryCompany $subsidiaryCompany): self
  143. {
  144. if ($this->subsidiaryCompanies->removeElement($subsidiaryCompany)) {
  145. // set the owning side to null (unless already changed)
  146. if ($subsidiaryCompany->getQuote() === $this) {
  147. $subsidiaryCompany->setQuote(null);
  148. }
  149. }
  150. return $this;
  151. }
  152. public function getAuthor(): ?string
  153. {
  154. return $this->author;
  155. }
  156. public function setAuthor(?string $author): self
  157. {
  158. $this->author = $author;
  159. return $this;
  160. }
  161. }