You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.1KB

  1. <?php
  2. namespace Lc\SovBundle\Doctrine\Extension;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Gedmo\Mapping\Annotation as Gedmo;
  5. trait TranslatableTrait
  6. {
  7. /**
  8. * Post locale
  9. * Used locale to override Translation listener's locale
  10. * @Gedmo\Locale
  11. */
  12. protected $locale;
  13. /**
  14. * @ORM\Column(type="array", nullable=true)
  15. */
  16. protected $localesEnabled = [];
  17. public function __get($name)
  18. {
  19. if(isset($this->{$name})) {
  20. return $this->{$name};
  21. }else{
  22. return null;
  23. }
  24. }
  25. public function setTranslatableLocale($locale)
  26. {
  27. $this->locale = $locale;
  28. }
  29. public function getLocalesEnabled(): ?array
  30. {
  31. return $this->localesEnabled;
  32. }
  33. public function setLocalesEnabled(?array $localesEnabled): self
  34. {
  35. $this->localesEnabled = $localesEnabled;
  36. return $this;
  37. }
  38. }