<?php

namespace Lc\SovBundle\Doctrine\Extension;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

trait TranslatableTrait
{
    /**
     * Post locale
     * Used locale to override Translation listener's locale
     * @Gedmo\Locale
     */
    protected $locale;

    /**
     * @ORM\Column(type="array", nullable=true)
     */
    protected $localesEnabled = [];

    public function __get($name)
    {
        if (isset($this->{$name})) {
            return $this->{$name};
        } else {
            return null;
        }
    }

    public function setTranslatableLocale($locale)
    {
        $this->locale = $locale;
    }

    public function getLocalesEnabled(): ?array
    {
        return $this->localesEnabled;
    }

    public function setLocalesEnabled(?array $localesEnabled): self
    {
        $this->localesEnabled = $localesEnabled;

        return $this;
    }
}