src/CoreBundle/Entity/Language.php line 18

Open in your IDE?
  1. <?php
  2. namespace Core\Entity;
  3. use Core\Entity\Traits\EntityTrait;
  4. use Core\Entity\Traits\TranslatableTrait;
  5. use Symfony\Component\HttpFoundation\File\File;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  8. /**
  9.  * Langues disponibles de l'application
  10.  *
  11.  * @Vich\Uploadable
  12.  * @ORM\Entity(repositoryClass="Core\Repository\LanguageRepository")
  13.  * @ORM\Table(name="core_language")
  14.  */
  15. class Language
  16. {
  17.     use TranslatableTrait;
  18.     use EntityTrait {
  19.         EntityTrait::__construct as private __entityConstruct;
  20.     }
  21.     /**
  22.      * Code de langue
  23.      *
  24.      * @ORM\Column(type="string", length=255, nullable=true)
  25.      */
  26.     private $language_code;
  27.     /**
  28.      * Code ISO
  29.      *
  30.      * @ORM\Column(type="string", length=255, nullable=true)
  31.      */
  32.     private $iso_code;
  33.     /**
  34.      * Petit format de date
  35.      *
  36.      * @ORM\Column(type="string", length=255, nullable=true)
  37.      */
  38.     private $date_format;
  39.     /**
  40.      * Format complet de date
  41.      *
  42.      * @ORM\Column(type="string", length=255, nullable=true)
  43.      */
  44.     private $date_format_full;
  45.     /**
  46.      * Image du drapeau
  47.      *
  48.      * @ORM\Column(type="string", length=255, nullable=true)
  49.      * @var string
  50.      */
  51.     private $image;
  52.     /**
  53.      * @Vich\UploadableField(mapping="images", fileNameProperty="image")
  54.      * @var File
  55.      */
  56.     private $imageFile;
  57.     /**
  58.      * Constructeur
  59.      * @throws \Exception
  60.      */
  61.     public function __construct()
  62.     {
  63.         $this->__entityConstruct();
  64.     }
  65.     /**
  66.      * @return mixed
  67.      */
  68.     public function getLanguageCode()
  69.     {
  70.         return $this->language_code;
  71.     }
  72.     /**
  73.      * @param mixed $language_code
  74.      */
  75.     public function setLanguageCode($language_code): void
  76.     {
  77.         $this->language_code $language_code;
  78.     }
  79.     /**
  80.      * @return mixed
  81.      */
  82.     public function getIsoCode()
  83.     {
  84.         return $this->iso_code;
  85.     }
  86.     /**
  87.      * @param mixed $iso_code
  88.      */
  89.     public function setIsoCode($iso_code): void
  90.     {
  91.         $this->iso_code $iso_code;
  92.     }
  93.     /**
  94.      * @return mixed
  95.      */
  96.     public function getDateFormat()
  97.     {
  98.         return $this->date_format;
  99.     }
  100.     /**
  101.      * @param mixed $date_format
  102.      */
  103.     public function setDateFormat($date_format): void
  104.     {
  105.         $this->date_format $date_format;
  106.     }
  107.     /**
  108.      * @return mixed
  109.      */
  110.     public function getDateFormatFull()
  111.     {
  112.         return $this->date_format_full;
  113.     }
  114.     /**
  115.      * @param mixed $date_format_full
  116.      */
  117.     public function setDateFormatFull($date_format_full): void
  118.     {
  119.         $this->date_format_full $date_format_full;
  120.     }
  121.     /**
  122.      * @return string
  123.      */
  124.     public function getImage()
  125.     {
  126.         return $this->image;
  127.     }
  128.     /**
  129.      * @param string $image
  130.      */
  131.     public function setImage(?string $image)
  132.     {
  133.         $this->image $image;
  134.     }
  135.     /**
  136.      * @return File
  137.      */
  138.     public function getImageFile()
  139.     {
  140.         return $this->imageFile;
  141.     }
  142.     /**
  143.      * @param File $imageFile
  144.      * @throws \Exception
  145.      */
  146.     public function setImageFile(File $imageFile)
  147.     {
  148.         $this->imageFile $imageFile;
  149.         if ($imageFile) {
  150.             $this->setUpdatedAt(new \DateTime('now'));
  151.         }
  152.     }
  153. }