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