src/Entity/Parameter.php line 23

Open in your IDE?
  1. <?php
  2.     namespace App\Entity;
  3.     use App\Repository\ParameterRepository;
  4.     use App\Traits\DateTrait;
  5.     use DateTime;
  6.     use Doctrine\ORM\Mapping as ORM;
  7.     use JMS\Serializer\Annotation as Serializer;
  8.     use JMS\Serializer\Annotation\Expose;
  9.     use JMS\Serializer\Annotation\Groups;
  10.     use Symfony\Component\HttpFoundation\File\File;
  11.     use Vich\UploaderBundle\Mapping\Annotation as Vich;
  12.     /**
  13.      * @ORM\Entity(repositoryClass=ParameterRepository::class)
  14.      * @ORM\HasLifecycleCallbacks()
  15.      *
  16.      * @Serializer\ExclusionPolicy("ALL")
  17.      *
  18.      * @Vich\Uploadable
  19.      */
  20.     class Parameter
  21.     {
  22.         /**
  23.          * @ORM\Id
  24.          * @ORM\GeneratedValue
  25.          * @ORM\Column(type="integer")
  26.          *
  27.          * @Expose
  28.          * @Groups({"parameter"})
  29.          */
  30.         private ?int $id NULL;
  31.         /**
  32.          * @ORM\Column(type="string")
  33.          *
  34.          * @Expose
  35.          * @Groups({"parameter"})
  36.          */
  37.         private string $slug;
  38.         /**
  39.          * @ORM\Column(type="text", nullable=true)
  40.          */
  41.         private ?string $value;
  42.         /**
  43.          * @ORM\Column(type="string", length=255, nullable=true)
  44.          *
  45.          * @Expose
  46.          * @Groups({"parameter"})
  47.          */
  48.         private ?string $title;
  49.         /**
  50.          * @ORM\Column(type="string", length=255, nullable=true)
  51.          *
  52.          * @Expose
  53.          * @Groups({"parameter"})
  54.          */
  55.         private ?string $fileName;
  56.         /**
  57.          * @Vich\UploadableField(mapping="general_documents", fileNameProperty="fileName")
  58.          */
  59.         private ?File $file;
  60.         /**
  61.          * @ORM\Column(type="string", length=255, nullable=true)
  62.          */
  63.         private ?string $originalName;
  64.         /**
  65.          * @ORM\Column(type="string", length=255, nullable=true)
  66.          *
  67.          * @Expose
  68.          * @Groups({"parameter"})
  69.          */
  70.         private ?string $externLink;
  71.         /**
  72.          * @deprecated
  73.          * @ORM\Column(type="boolean", nullable=true)
  74.          */
  75.         private ?bool $noFooter;
  76.         /**
  77.          * @ORM\Column(type="string", length=255, nullable=true)
  78.          */
  79.         private ?string $displayRole;
  80.         /**
  81.          * @ORM\Column(type="string", length=255, nullable=true)
  82.          */
  83.         private ?string $displayJob;
  84.         /**
  85.          * @ORM\ManyToOne(targetEntity=ParameterHook::class, inversedBy="parameters")
  86.          *
  87.          * @Expose
  88.          * @Groups({"parameter"})
  89.          */
  90.         private ?ParameterHook $parameterHook;
  91.         /**
  92.          * @ORM\Column(type="string", length=255, nullable=true)
  93.          */
  94.         private $thumbnail;
  95.         // Vich Uploader
  96.         /**
  97.          * @Vich\UploadableField(mapping="parameter_thumbnail", fileNameProperty="thumbnail")
  98.          * @var File
  99.          */
  100.         private $thumbnailFile;
  101.         /**
  102.          * @ORM\Column(type="string", length=255, nullable=true)
  103.          */
  104.         private $displayUniverses;
  105.         /**
  106.          * @ORM\ManyToOne(targetEntity=User::class, inversedBy="relatedParameters")
  107.          *
  108.          * @Expose
  109.          * @Groups({"parameter"})
  110.          */
  111.         private $userRelated;
  112.         /**
  113.          * @ORM\Column(type="boolean", nullable=true)
  114.          * @Expose
  115.          * @Groups({"parameter"})
  116.          */
  117.         private $public;
  118.         /**
  119.          * @ORM\Column(type="string", length=16, nullable=true)
  120.          */
  121.         private $display;
  122.         /**
  123.          * @ORM\Column(type="string", length=255, nullable=true)
  124.          * @Expose
  125.          * @Groups({"parameter"})
  126.          */
  127.         private ?string $language;
  128.         use DateTrait;
  129.         public function getFile(): ?File
  130.         {
  131.             return $this->file ?? NULL;
  132.         }
  133.         public function setFile(File $file NULL): void
  134.         {
  135.             $this->file $file;
  136.             if ($file) {
  137.                 $this->updatedAt = new DateTime('now');
  138.             }
  139.         }
  140.         public function getId(): ?int
  141.         {
  142.             return $this->id;
  143.         }
  144.         public function getSlug(): ?string
  145.         {
  146.             return $this->slug ?? NULL;
  147.         }
  148.         public function setSlug(string $slug): self
  149.         {
  150.             $this->slug $slug;
  151.             return $this;
  152.         }
  153.         public function getValue(): ?string
  154.         {
  155.             return $this->value ?? NULL;
  156.         }
  157.         public function setValue(?string $value): self
  158.         {
  159.             $this->value $value;
  160.             return $this;
  161.         }
  162.         public function getTitle(): ?string
  163.         {
  164.             return $this->title ?? NULL;
  165.         }
  166.         public function setTitle(?string $title): self
  167.         {
  168.             $this->title $title;
  169.             return $this;
  170.         }
  171.         public function getFileName(): ?string
  172.         {
  173.             return $this->fileName ?? NULL;
  174.         }
  175.         public function setFileName(?string $fileName): self
  176.         {
  177.             $this->fileName $fileName;
  178.             return $this;
  179.         }
  180.         public function getOriginalName(): ?string
  181.         {
  182.             return $this->originalName ?? NULL;
  183.         }
  184.         public function setOriginalName(?string $originalName): self
  185.         {
  186.             $this->originalName $originalName;
  187.             return $this;
  188.         }
  189.         public function getExternLink(): ?string
  190.         {
  191.             return $this->externLink ?? NULL;
  192.         }
  193.         public function setExternLink(?string $externLink): self
  194.         {
  195.             $this->externLink $externLink;
  196.             return $this;
  197.         }
  198.         public function getNoFooter(): ?bool
  199.         {
  200.             return $this->noFooter;
  201.         }
  202.         public function setNoFooter(?bool $noFooter): self
  203.         {
  204.             $this->noFooter $noFooter;
  205.             return $this;
  206.         }
  207.         public function getDisplayRole(): ?array
  208.         {
  209.             if ($this->displayRole === NULL) {
  210.                 return NULL;
  211.             }
  212.             return explode(';'$this->displayRole);
  213.         }
  214.         public function setDisplayRole(?array $displayRole): self
  215.         {
  216.             if ($displayRole === []) {
  217.                 $this->displayRole NULL;
  218.             } else {
  219.                 $this->displayRole implode(';'$displayRole);
  220.             }
  221.             return $this;
  222.         }
  223.         public function getDisplayJob(): ?array
  224.         {
  225.             if ($this->displayJob === NULL) {
  226.                 return NULL;
  227.             }
  228.             return explode(';'$this->displayJob);
  229.         }
  230.         public function setDisplayJob(?array $displayJob): self
  231.         {
  232.             if ($displayJob === []) {
  233.                 $this->displayJob NULL;
  234.             } else {
  235.                 $this->displayJob implode(';'$displayJob);
  236.             }
  237.             return $this;
  238.         }
  239.         public function getParameterHook(): ?ParameterHook
  240.         {
  241.             return $this->parameterHook;
  242.         }
  243.         public function setParameterHook(?ParameterHook $parameterHook): self
  244.         {
  245.             $this->parameterHook $parameterHook;
  246.             return $this;
  247.         }
  248.         public function getThumbnail(): ?string
  249.         {
  250.             return $this->thumbnail;
  251.         }
  252.         public function setThumbnail(?string $thumbnail): self
  253.         {
  254.             $this->thumbnail $thumbnail;
  255.             return $this;
  256.         }
  257.         public function getThumbnailFile(): ?File
  258.         {
  259.             return $this->thumbnailFile;
  260.         }
  261.         /**
  262.          * @param File $thumbnailFile
  263.          *
  264.          * @return void
  265.          */
  266.         public function setThumbnailFile(File $thumbnailFile): void
  267.         {
  268.             $this->thumbnailFile $thumbnailFile;
  269.             if (NULL !== $thumbnailFile) {
  270.                 // It is required that at least one field changes if you are using doctrine
  271.                 // otherwise the event listeners won't be called and the file is lost
  272.                 $this->updatedAt = new DateTime();
  273.             }
  274.         }
  275.         public function getDisplayUniverses(): ?array
  276.         {
  277.             if ($this->displayUniverses === NULL) {
  278.                 return NULL;
  279.             }
  280.             return explode(';'$this->displayUniverses);
  281.         }
  282.         public function setDisplayUniverses(?array $displayUniverses): self
  283.         {
  284.             if ($displayUniverses === []) {
  285.                 $this->displayUniverses NULL;
  286.             } else {
  287.                 $this->displayUniverses implode(';'$displayUniverses);
  288.             }
  289.             return $this;
  290.         }
  291.         public function getUserRelated(): ?User
  292.         {
  293.             return $this->userRelated;
  294.         }
  295.         public function setUserRelated(?User $userRelated): self
  296.         {
  297.             $this->userRelated $userRelated;
  298.             return $this;
  299.         }
  300.         public function isPublic(): ?bool
  301.         {
  302.             return $this->public ?? FALSE;
  303.         }
  304.         public function setPublic(?bool $public): self
  305.         {
  306.             $this->public $public;
  307.             return $this;
  308.         }
  309.         public function getDisplay(): ?string
  310.         {
  311.             return $this->display;
  312.         }
  313.         public function setDisplay(?string $display): self
  314.         {
  315.             $this->display $display;
  316.             return $this;
  317.         }
  318.         public function getLanguage(): ?string
  319.         {
  320.             return $this->language ?? NULL;
  321.         }
  322.         public function setLanguage(string $language): self
  323.         {
  324.             $this->language $language;
  325.             return $this;
  326.         }
  327.     }