src/Entity/Theme.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ThemeRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Cocur\Slugify\Slugify;
  8. /**
  9. * @ORM\Entity(repositoryClass=ThemeRepository::class)
  10. */
  11. class Theme
  12. {
  13. /**
  14. * @ORM\Id
  15. * @ORM\GeneratedValue
  16. * @ORM\Column(type="integer")
  17. */
  18. private $id;
  19. /**
  20. * @ORM\Column(type="string", length=255)
  21. */
  22. private $title;
  23. /**
  24. * @ORM\Column(type="text", nullable=true)
  25. */
  26. private $topDescription;
  27. /**
  28. * @ORM\Column(type="text", nullable=true)
  29. */
  30. private $bottomDescription;
  31. /**
  32. * @ORM\Column(type="boolean")
  33. */
  34. private $isActive;
  35. /**
  36. * @ORM\ManyToMany(targetEntity=Sejour::class, mappedBy="themes")
  37. */
  38. private $sejours;
  39. /**
  40. * @ORM\Column(type="integer", nullable=true)
  41. */
  42. private $legacyId;
  43. /**
  44. * @ORM\Column(type="string", length=255)
  45. */
  46. private $slug;
  47. /**
  48. * @ORM\Column(type="boolean", nullable=true)
  49. */
  50. private $isActivite;
  51. public function __construct()
  52. {
  53. $this->sejours = new ArrayCollection();
  54. $this->isActivite = false;
  55. }
  56. public function getId(): ?int
  57. {
  58. return $this->id;
  59. }
  60. public function getTitle(): ?string
  61. {
  62. return $this->title;
  63. }
  64. public function setTitle(string $title): self
  65. {
  66. $this->title = $title;
  67. $slugify = new Slugify();
  68. $this->slug = $slugify->Slugify($title,'_');
  69. return $this;
  70. }
  71. public function getTopDescription(): ?string
  72. {
  73. return $this->topDescription;
  74. }
  75. public function setTopDescription(?string $topDescription): self
  76. {
  77. $this->topDescription = $topDescription;
  78. return $this;
  79. }
  80. public function getBottomDescription(): ?string
  81. {
  82. return $this->bottomDescription;
  83. }
  84. public function setBottomDescription(?string $bottomDescription): self
  85. {
  86. $this->bottomDescription = $bottomDescription;
  87. return $this;
  88. }
  89. public function getIsActive(): ?bool
  90. {
  91. return $this->isActive;
  92. }
  93. public function setIsActive(bool $isActive): self
  94. {
  95. $this->isActive = $isActive;
  96. return $this;
  97. }
  98. /**
  99. * @return Collection|Sejour[]
  100. */
  101. public function getSejours(): Collection
  102. {
  103. return $this->sejours;
  104. }
  105. public function addSejour(Sejour $sejour): self
  106. {
  107. if (!$this->sejours->contains($sejour)) {
  108. $this->sejours[] = $sejour;
  109. $sejour->addTheme($this);
  110. }
  111. return $this;
  112. }
  113. public function removeSejour(Sejour $sejour): self
  114. {
  115. if ($this->sejours->removeElement($sejour)) {
  116. $sejour->removeTheme($this);
  117. }
  118. return $this;
  119. }
  120. public function getLegacyId(): ?int
  121. {
  122. return $this->legacyId;
  123. }
  124. public function setLegacyId(?int $legacyId): self
  125. {
  126. $this->legacyId = $legacyId;
  127. return $this;
  128. }
  129. public function getSlug(): ?string
  130. {
  131. return $this->slug;
  132. }
  133. public function setSlug(string $slug): self
  134. {
  135. $this->slug = $slug;
  136. return $this;
  137. }
  138. public function getIsActivite(): ?bool
  139. {
  140. return $this->isActivite;
  141. }
  142. public function setIsActivite(?bool $isActivite): self
  143. {
  144. $this->isActivite = $isActivite;
  145. return $this;
  146. }
  147. }