src/Entity/SliderItem.php line 20

Open in your IDE?
  1. <?php
  2.     namespace App\Entity;
  3.     use App\Repository\SliderItemRepository;
  4.     use App\Traits\DateTrait;
  5.     use DateTime;
  6.     use DateTimeInterface;
  7.     use Doctrine\ORM\Mapping as ORM;
  8.     use Symfony\Component\HttpFoundation\File\File;
  9.     use Symfony\Component\HttpFoundation\File\UploadedFile;
  10.     use Vich\UploaderBundle\Mapping\Annotation as Vich;
  11.     /**
  12.      * @ORM\Entity(repositoryClass=SliderItemRepository::class)
  13.      * @ORM\HasLifecycleCallbacks
  14.      *
  15.      * @Vich\Uploadable
  16.      */
  17.     class SliderItem
  18.     {
  19.         /**
  20.          * @ORM\Id
  21.          * @ORM\GeneratedValue
  22.          * @ORM\Column(type="integer")
  23.          */
  24.         private $id;
  25.         /**
  26.          * @ORM\Column(type="string", length=255, nullable=true)
  27.          */
  28.         private $image;
  29.         // Vich Uploader
  30.         /**
  31.          * @Vich\UploadableField(mapping="slider_item_images", fileNameProperty="image")
  32.          * @var File
  33.          */
  34.         private $imageFile;
  35.         /**
  36.          * @ORM\Column(type="string", length=255, nullable=true)
  37.          */
  38.         private $url;
  39.         /**
  40.          * @ORM\Column(type="string", length=255, nullable=true)
  41.          */
  42.         private $urlcible;
  43.         /**
  44.          * @ORM\Column(type="integer", options={"default": 99})
  45.          */
  46.         private $orderItem;
  47.         /**
  48.          * @ORM\Column(type="string", length=255, nullable=true)
  49.          */
  50.         private $title;
  51.         /**
  52.          * @ORM\Column(type="string", length=255, nullable=true)
  53.          */
  54.         private $description;
  55.         use DateTrait;
  56.         /**
  57.          * @ORM\ManyToOne(targetEntity=Slider::class, inversedBy="items")
  58.          * @ORM\JoinColumn(nullable=false)
  59.          */
  60.         private $slider;
  61.         /**
  62.          * @ORM\Column(type="datetime", nullable=true)
  63.          */
  64.         private $dateStart;
  65.         /**
  66.          * @ORM\Column(type="datetime", nullable=true)
  67.          */
  68.         private $dateEnd;
  69.         /**
  70.          * @ORM\Column(type="boolean", nullable=true)
  71.          */
  72.         private $displayTitle;
  73.         /**
  74.          * @ORM\Column(type="string", length=255, nullable=true)
  75.          */
  76.         private $displayJob;
  77.         /**
  78.          * @ORM\Column(type="string", length=255, nullable=true)
  79.          */
  80.         private $displayUniverses;
  81.         /**
  82.          * SliderItem constructor.
  83.          *
  84.          */
  85.         public function __construct()
  86.         {
  87.             $this->orderItem 99;
  88.         }
  89.         public function __toString()
  90.         {
  91.             return $this->image;
  92.         }
  93.         public function getId(): ?int
  94.         {
  95.             return $this->id;
  96.         }
  97.         public function getImageFile()
  98.         {
  99.             return $this->imageFile;
  100.         }
  101.         /**
  102.          * @param File|UploadedFile|null $imageFile
  103.          */
  104.         public function setImageFileFile $imageFile ): void
  105.         {
  106.             $this->imageFile $imageFile;
  107.             if ( NULL !== $imageFile ) {
  108.                 // It is required that at least one field changes if you are using doctrine
  109.                 // otherwise the event listeners won't be called and the file is lost
  110.                 $this->updatedAt = new DateTime();
  111.             }
  112.         }
  113.         public function getImage(): ?string
  114.         {
  115.             return $this->image;
  116.         }
  117.         public function setImage( ?string $image ): self
  118.         {
  119.             $this->image $image;
  120.             return $this;
  121.         }
  122.         public function getUrl(): ?string
  123.         {
  124.             return $this->url;
  125.         }
  126.         public function setUrl( ?string $url ): self
  127.         {
  128.             $this->url $url;
  129.             return $this;
  130.         }
  131.         public function getUrlcible(): ?string
  132.         {
  133.             return $this->urlcible;
  134.         }
  135.         public function setUrlcible( ?string $urlcible ): self
  136.         {
  137.             $this->urlcible $urlcible;
  138.             return $this;
  139.         }
  140.         public function getOrderItem(): ?int
  141.         {
  142.             return $this->orderItem;
  143.         }
  144.         public function setOrderItemint $orderItem ): self
  145.         {
  146.             $this->orderItem $orderItem;
  147.             return $this;
  148.         }
  149.         public function getTitle(): ?string
  150.         {
  151.             return $this->title;
  152.         }
  153.         public function setTitle( ?string $title ): self
  154.         {
  155.             $this->title $title;
  156.             return $this;
  157.         }
  158.         public function getDescription(): ?string
  159.         {
  160.             return $this->description;
  161.         }
  162.         public function setDescription( ?string $description ): self
  163.         {
  164.             $this->description $description;
  165.             return $this;
  166.         }
  167.         public function getSlider(): ?Slider
  168.         {
  169.             return $this->slider;
  170.         }
  171.         public function setSlider( ?Slider $slider ): self
  172.         {
  173.             $this->slider $slider;
  174.             return $this;
  175.         }
  176.         public function getDateStart(): ?DateTimeInterface
  177.         {
  178.             return $this->dateStart;
  179.         }
  180.         public function setDateStart( ?DateTimeInterface $dateStart ): self
  181.         {
  182.             $this->dateStart $dateStart;
  183.             return $this;
  184.         }
  185.         public function getDateEnd(): ?DateTimeInterface
  186.         {
  187.             return $this->dateEnd;
  188.         }
  189.         public function setDateEnd( ?DateTimeInterface $dateEnd ): self
  190.         {
  191.             $this->dateEnd $dateEnd;
  192.             return $this;
  193.         }
  194.         public function isDisplayTitle(): ?bool
  195.         {
  196.             return $this->displayTitle;
  197.         }
  198.         public function setDisplayTitle(?bool $displayTitle): self
  199.         {
  200.             $this->displayTitle $displayTitle;
  201.             return $this;
  202.         }
  203.         public function getDisplayJob(): ?array
  204.         {
  205.             if ($this->displayJob === NULL) {
  206.                 return NULL;
  207.             }
  208.             return explode(';'$this->displayJob);
  209.         }
  210.         public function setDisplayJob(?array $displayJob): self
  211.         {
  212.             if ($displayJob === []) {
  213.                 $this->displayJob NULL;
  214.             } else {
  215.                 $this->displayJob implode(';'$displayJob);
  216.             }
  217.             return $this;
  218.         }
  219.         public function getDisplayUniverses(): ?array
  220.         {
  221.             if ($this->displayUniverses === NULL) {
  222.                 return NULL;
  223.             }
  224.             return explode(';'$this->displayUniverses);
  225.         }
  226.         public function setDisplayUniverses(?array $displayUniverses): self
  227.         {
  228.             if ($displayUniverses === []) {
  229.                 $this->displayUniverses NULL;
  230.             } else {
  231.                 $this->displayUniverses implode(';'$displayUniverses);
  232.             }
  233.             return $this;
  234.         }
  235.     }