src/Entity/Gos/Uniqskills/Slider.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos\Uniqskills;
  3. use App\Entity\Gos\Language;
  4. use App\Entity\Gos\PortalSettings;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. /**
  11.  * @ORM\Table()
  12.  * @ORM\Entity(repositoryClass="App\Repository\Gos\Uniqskills\SliderRepository")
  13.  * @Vich\Uploadable
  14.  * @ORM\HasLifecycleCallbacks
  15.  */
  16. class Slider
  17. {
  18.     /**
  19.      * @ORM\Column(type="integer")
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue(strategy="IDENTITY")
  22.      */
  23.     private $id;
  24.     /**
  25.      * @ORM\Column(type="boolean", nullable=true)
  26.      */
  27.     private $isActive;
  28.     /**
  29.      * @ORM\Column(type="string", length=255)
  30.      */
  31.     private $name;
  32.     /**
  33.      * @ORM\Column(type="integer", nullable=true)
  34.      */
  35.     private $position;
  36.     /**
  37.      * @Gedmo\Slug(fields={"name"})
  38.      * @ORM\Column(type="string", length=191, unique=true)
  39.      */
  40.     private $slug;
  41.     /**
  42.      * @ORM\Column(type="text")
  43.      */
  44.     private $body;
  45.     /**
  46.      * NOTE: This is not a mapped field of entity metadata, just a simple property.
  47.      *
  48.      * @Assert\File(
  49.      * maxSize="100M",
  50.      * mimeTypes={"image/png", "image/jpeg", "image/pjpeg"}
  51.      * )
  52.      *
  53.      * @Vich\UploadableField(mapping="product_image", fileNameProperty="imageName")
  54.      *
  55.      * @var File
  56.      */
  57.     private $imageFile;
  58.     /**
  59.      * @ORM\Column(type="string", length=255, nullable=true)
  60.      *
  61.      * @var string
  62.      */
  63.     private $imageName;
  64.     /**
  65.      * NOTE: This is not a mapped field of entity metadata, just a simple property.
  66.      *
  67.      * @Assert\File(
  68.      * maxSize="100M",
  69.      * mimeTypes={"image/png", "image/jpeg", "image/pjpeg"}
  70.      * )
  71.      *
  72.      * @Vich\UploadableField(mapping="product_image", fileNameProperty="mobileImageName")
  73.      *
  74.      * @var File
  75.      */
  76.     private $mobileImageFile;
  77.     /**
  78.      * @ORM\Column(type="string", length=255, nullable=true)
  79.      *
  80.      * @var string
  81.      */
  82.     private $mobileImageName;
  83.     /**
  84.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\Language", inversedBy="slider")
  85.      * @ORM\JoinColumn()
  86.      */
  87.     private $language;
  88.     /**
  89.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\PortalSettings", inversedBy="slider")
  90.      * @ORM\JoinColumn()
  91.      */
  92.     private $portalSettings;
  93.     /**
  94.      * @ORM\Column(type="datetime")
  95.      */
  96.     private $createdAt;
  97.     /**
  98.      * @ORM\Column(type="datetime", nullable=true)
  99.      */
  100.     private $updatedAt;
  101.     /** @ORM\PrePersist() */
  102.     public function prePersist()
  103.     {
  104.         $this->createdAt = new \DateTime();
  105.     }
  106.     /** @ORM\PreUpdate() */
  107.     public function preUpdate()
  108.     {
  109.         $this->updatedAt = new \DateTime();
  110.     }
  111.     public function __toString()
  112.     {
  113.         return (string)$this->name;
  114.     }
  115.     /**
  116.      * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  117.      * of 'UploadedFile' is injected into this setter to trigger the  update. If this
  118.      * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  119.      * must be able to accept an instance of 'File' as the bundle will inject one here
  120.      * during Doctrine hydration.
  121.      *
  122.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $image
  123.      *
  124.      * @return Slider
  125.      */
  126.     public function setImageFile(File $image null)
  127.     {
  128.         $this->imageFile $image;
  129.         if ($image) {
  130.             // It is required that at least one field changes if you are using doctrine
  131.             // otherwise the event listeners won't be called and the file is lost
  132.             $this->updatedAt = new \DateTimeImmutable();
  133.         }
  134.         return $this;
  135.     }
  136.     /**
  137.      * @return File|null
  138.      */
  139.     public function getImageFile()
  140.     {
  141.         return $this->imageFile;
  142.     }
  143.     /**
  144.      * @param string $imageName
  145.      *
  146.      * @return Author
  147.      */
  148.     public function setImageName($imageName)
  149.     {
  150.         $this->imageName $imageName;
  151.         return $this;
  152.     }
  153.     /**
  154.      * @return string|null
  155.      */
  156.     public function getImageName()
  157.     {
  158.         return $this->imageName;
  159.     }
  160.     /**
  161.      *
  162.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $image
  163.      *
  164.      * @return Slider
  165.      */
  166.     public function setMobileImageFile(File $mobileImage null)
  167.     {
  168.         $this->mobileImageFile $mobileImage;
  169.         if ($mobileImage) {
  170.             // It is required that at least one field changes if you are using doctrine
  171.             // otherwise the event listeners won't be called and the file is lost
  172.             $this->updatedAt = new \DateTimeImmutable();
  173.         }
  174.         return $this;
  175.     }
  176.     /**
  177.      * @return File|null
  178.      */
  179.     public function getMobileImageFile()
  180.     {
  181.         return $this->mobileImageFile;
  182.     }
  183.     /**
  184.      * @param string $mobileImageName
  185.      *
  186.      * @return Author
  187.      */
  188.     public function setMobileImageName($mobileImageName)
  189.     {
  190.         $this->mobileImageName $mobileImageName;
  191.         return $this;
  192.     }
  193.     /**
  194.      * @return string|null
  195.      */
  196.     public function getMobileImageName()
  197.     {
  198.         return $this->mobileImageName;
  199.     }
  200.     public function getId(): ?int
  201.     {
  202.         return $this->id;
  203.     }
  204.     public function getIsActive(): ?bool
  205.     {
  206.         return $this->isActive;
  207.     }
  208.     public function setIsActive(?bool $isActive): self
  209.     {
  210.         $this->isActive $isActive;
  211.         return $this;
  212.     }
  213.     public function getName(): ?string
  214.     {
  215.         return $this->name;
  216.     }
  217.     public function setName(string $name): self
  218.     {
  219.         $this->name $name;
  220.         return $this;
  221.     }
  222.     public function getPosition(): ?int
  223.     {
  224.         return $this->position;
  225.     }
  226.     public function setPosition(?int $position): self
  227.     {
  228.         $this->position $position;
  229.         return $this;
  230.     }
  231.     public function getSlug(): ?string
  232.     {
  233.         return $this->slug;
  234.     }
  235.     public function setSlug(string $slug): self
  236.     {
  237.         $this->slug $slug;
  238.         return $this;
  239.     }
  240.     public function getBody(): ?string
  241.     {
  242.         return $this->body;
  243.     }
  244.     public function setBody(string $body): self
  245.     {
  246.         $this->body $body;
  247.         return $this;
  248.     }
  249.     public function getCreatedAt(): ?\DateTimeInterface
  250.     {
  251.         return $this->createdAt;
  252.     }
  253.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  254.     {
  255.         $this->createdAt $createdAt;
  256.         return $this;
  257.     }
  258.     public function getUpdatedAt(): ?\DateTimeInterface
  259.     {
  260.         return $this->updatedAt;
  261.     }
  262.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  263.     {
  264.         $this->updatedAt $updatedAt;
  265.         return $this;
  266.     }
  267.     public function getLanguage(): ?Language
  268.     {
  269.         return $this->language;
  270.     }
  271.     public function setLanguage(?Language $language): self
  272.     {
  273.         $this->language $language;
  274.         return $this;
  275.     }
  276.     public function getPortalSettings(): ?PortalSettings
  277.     {
  278.         return $this->portalSettings;
  279.     }
  280.     public function setPortalSettings(?PortalSettings $portalSettings): self
  281.     {
  282.         $this->portalSettings $portalSettings;
  283.         return $this;
  284.     }
  285.     /* ****************************** GETTERS & SETTERS ******************************  */
  286. }