src/Entity/CategoryTranslation.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Event\LifecycleEventArgs;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use App\Entity\Behaviors\TranslationTrait;
  6. use App\Entity\Behaviors\SluggableTrait;
  7. use Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface;
  8. use Knp\DoctrineBehaviors\Contract\Entity\SluggableInterface;
  9. /**
  10. * @ORM\Table(
  11. * uniqueConstraints={@ORM\UniqueConstraint(name="sluging", columns={"locale", "slug"})}
  12. * )
  13. * @ORM\Entity(repositoryClass="App\Repository\TranslationRepository")
  14. * @ORM\HasLifecycleCallbacks()
  15. * @ORM\EntityListeners({"App\Listener\EntityListener"})
  16. */
  17. class CategoryTranslation implements TranslationInterface, SluggableInterface
  18. {
  19. use SluggableTrait;
  20. use TranslationTrait;
  21. protected $isEmptyOff = true;
  22. /**
  23. * @ORM\Column(type="string", length=190)
  24. */
  25. protected $name;
  26. /**
  27. * @ORM\Column(type="string", length=190)
  28. */
  29. protected $slug;
  30. /**
  31. * @ORM\Column(type="string", length=2)
  32. */
  33. protected $locale;
  34. /**
  35. * @ORM\Column(type="string", length=255, nullable=true)
  36. */
  37. protected $metaDescription;
  38. /**
  39. * @ORM\Column(type="string", length=255, nullable=true)
  40. */
  41. protected $metaTitle;
  42. /**
  43. * @ORM\Column(type="string", length=255, nullable=true)
  44. */
  45. protected $metaKeywords;
  46. /**
  47. * @ORM\Column(type="text", nullable=true)
  48. */
  49. protected $description;
  50. /**
  51. * @ORM\Column(type="datetime", nullable=true)
  52. */
  53. private $createts;
  54. /**
  55. * @ORM\ManyToOne(targetEntity="App\Entity\User")
  56. * @ORM\JoinColumn(nullable=true)
  57. */
  58. private $createUser;
  59. /**
  60. * @ORM\Column(type="datetime", nullable=true)
  61. */
  62. private $editts;
  63. /**
  64. * @ORM\ManyToOne(targetEntity="App\Entity\User")
  65. */
  66. private $editUser;
  67. public function getName(): ?string
  68. {
  69. return $this->name;
  70. }
  71. public function setName(string $name): self
  72. {
  73. $this->name = $name;
  74. return $this;
  75. }
  76. public function getMetaDescription(): ?string
  77. {
  78. return $this->metaDescription;
  79. }
  80. public function setMetaDescription(?string $metaDescription): self
  81. {
  82. $this->metaDescription = $metaDescription;
  83. return $this;
  84. }
  85. public function getMetaKeywords(): ?string
  86. {
  87. return $this->metaKeywords;
  88. }
  89. public function setMetaKeywords(?string $metaKeywords): self
  90. {
  91. $this->metaKeywords = $metaKeywords;
  92. return $this;
  93. }
  94. public function getCreatets(): ?\DateTimeInterface
  95. {
  96. return $this->createts;
  97. }
  98. public function setCreatets(\DateTimeInterface $createts): self
  99. {
  100. $this->createts = $createts;
  101. return $this;
  102. }
  103. public function getCreateUser(): ?User
  104. {
  105. return $this->createUser;
  106. }
  107. public function setCreateUser(?User $createUser): self
  108. {
  109. $this->createUser = $createUser;
  110. return $this;
  111. }
  112. public function getEditts(): ?\DateTimeInterface
  113. {
  114. return $this->editts;
  115. }
  116. public function setEditts(?\DateTimeInterface $editts): self
  117. {
  118. $this->editts = $editts;
  119. return $this;
  120. }
  121. public function getEditUser(): ?User
  122. {
  123. return $this->editUser;
  124. }
  125. public function setEditUser(?User $editUser): self
  126. {
  127. $this->editUser = $editUser;
  128. return $this;
  129. }
  130. /**
  131. * Get Description
  132. *
  133. * @return mixed
  134. */
  135. public function getDescription()
  136. {
  137. return $this->description;
  138. }
  139. /**
  140. * Set Description
  141. *
  142. * @param mixed $description
  143. */
  144. public function setDescription( $description )
  145. {
  146. $this->description = $description;
  147. }
  148. /**
  149. * Get Slug
  150. *
  151. * @return mixed
  152. */
  153. public function getSlug(): string
  154. {
  155. return (string) $this->slug;
  156. }
  157. /**
  158. * Set Slug
  159. *
  160. * @param mixed $slug
  161. */
  162. public function setSlug($slug): void
  163. {
  164. $this->slug = $slug;
  165. }
  166. /**
  167. * Get MetaTitle
  168. *
  169. * @return mixed
  170. */
  171. public function getMetaTitle()
  172. {
  173. return $this->metaTitle;
  174. }
  175. /**
  176. * Set MetaTitle
  177. *
  178. * @param mixed $metaTitle
  179. */
  180. public function setMetaTitle( $metaTitle )
  181. {
  182. $this->metaTitle = $metaTitle;
  183. }
  184. public function getSluggableFields(): array
  185. {
  186. return ['name'];
  187. }
  188. }