Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.76 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Entity;
  4.  
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. use Gedmo\Timestampable\Traits\TimestampableEntity;
  8.  
  9.  
  10. /**
  11.  * @ORM\Entity(repositoryClass="App\Repository\MainSliderRepository")
  12.  */
  13. class MainSlider
  14. {
  15.     use TimestampableEntity;
  16.     const FILE_IMAGES_LOCATION = "/images/slider/";
  17.  
  18.     /**
  19.      * @ORM\Id()
  20.      * @ORM\GeneratedValue()
  21.      * @ORM\Column(type="integer")
  22.      */
  23.     private $id;
  24.  
  25.     /**
  26.      * @ORM\Column(type="string", nullable=true)
  27.      */
  28.     private $temponaryimage;
  29.  
  30.     /**
  31.      * @ORM\Column(type="integer", nullable=true)
  32.      */
  33.     private $position;
  34.  
  35.     /**
  36.      * @ORM\Column(type="boolean", nullable=true)
  37.      */
  38.     private $isPublished;
  39.  
  40.     /**
  41.      * @ORM\Column(type="boolean", nullable=false)
  42.      */
  43.     private $isDeleted = false;
  44.  
  45.     /**
  46.      * @ORM\Column(type="string", length=5, nullable=true)
  47.      */
  48.     private $extension;
  49.  
  50.     /**
  51.      * @ORM\Column(type="string", nullable=true)
  52.      */
  53.     private $titleLabel;
  54.  
  55.     /**
  56.      * @ORM\Column(type="string", nullable=true)
  57.      */
  58.     private $descriptionLabel;
  59.  
  60.     /**
  61.      * @ORM\Column(type="string",length=255, nullable=true)
  62.      */
  63.     private $link;
  64.  
  65.  
  66.  
  67.  
  68.     public function __construct()
  69.     {
  70.         $this->setPosition(0);
  71.         $this->setIsPublished(true);
  72.     }
  73.  
  74.     public function getId(): ?int
  75.     {
  76.         return $this->id;
  77.     }
  78.  
  79.     public function getPosition(): ?int
  80.     {
  81.         return $this->position;
  82.     }
  83.  
  84.     public function setPosition(?int $position): self
  85.     {
  86.         $this->position = $position;
  87.  
  88.         return $this;
  89.     }
  90.  
  91.     public function getIsPublished(): ?bool
  92.     {
  93.         return $this->isPublished;
  94.     }
  95.  
  96.     public function setIsPublished(?bool $isPublished): self
  97.     {
  98.         $this->isPublished = $isPublished;
  99.  
  100.         return $this;
  101.     }
  102.     public function toogleIsPublished(): ?bool
  103.     {
  104.  
  105.         return !$this->getIsPublished();
  106.     }
  107.  
  108.     public function getIsDeleted(): ?bool
  109.     {
  110.         return $this->isDeleted;
  111.     }
  112.  
  113.     public function setIsDeleted(bool $isDeleted): self
  114.     {
  115.         $this->isDeleted = $isDeleted;
  116.  
  117.         return $this;
  118.     }
  119.  
  120.     public function getExtension(): ?string
  121.     {
  122.         return $this->extension;
  123.     }
  124.  
  125.     public function setExtension(?string $extension): self
  126.     {
  127.         $this->extension = $extension;
  128.  
  129.         return $this;
  130.     }
  131.  
  132.     public function getTemponaryimage(): ?string
  133.     {
  134.         return $this->temponaryimage;
  135.     }
  136.  
  137.     public function setTemponaryimage(string $temponaryimage): self
  138.     {
  139.         $this->temponaryimage = $temponaryimage;
  140.  
  141.         return $this;
  142.     }
  143.     public function getImageUrl($type = false)
  144.     {
  145.         if (!$type) {
  146.             return self::FILES_IMAGES_LOCATION . $this->getId() . '.' . $this->getExtension();
  147.         } else {
  148.             return self::FILES_IMAGES_LOCATION . $this->getId() . '-' . $type . '.' . $this->getExtension();
  149.         }
  150.     }
  151.  
  152.     public function getTitleLabel(): ?string
  153.     {
  154.         return $this->titleLabel;
  155.     }
  156.  
  157.     public function setTitleLabel(?string $titleLabel): self
  158.     {
  159.         $this->titleLabel = $titleLabel;
  160.  
  161.         return $this;
  162.     }
  163.  
  164.     public function getDescriptionLabel(): ?string
  165.     {
  166.         return $this->descriptionLabel;
  167.     }
  168.  
  169.     public function setDescriptionLabel(?string $descriptionLabel): self
  170.     {
  171.         $this->descriptionLabel = $descriptionLabel;
  172.  
  173.         return $this;
  174.     }
  175.  
  176.     public function getLink(): ?string
  177.     {
  178.         return $this->link;
  179.     }
  180.  
  181.     public function setLink(?string $link): self
  182.     {
  183.         $this->link = $link;
  184.  
  185.         return $this;
  186.     }
  187. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement