src/Entity/Banners.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. /**
  8.  * @ORM\Entity(repositoryClass="App\Repository\BannersRepository")
  9.  */
  10. class Banners
  11. {
  12.     public function __construct(){
  13.                  $this->date = new \DateTime;
  14.                  $this->isEnabled false;
  15.              }
  16.     /**
  17.      * @var int
  18.      *
  19.      * @ORM\Column(name="id", type="integer")
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue(strategy="AUTO")
  22.      */
  23.     private $id;
  24.     /**
  25.      * @var string
  26.      *
  27.      * @ORM\Column(name="title", type="string", length=255, nullable=true)
  28.      */
  29.     private $title;
  30.     /**
  31.      * @var string
  32.      *
  33.      * @ORM\Column(name="btnTitle", type="string", length=255, nullable=true)
  34.      */
  35.     private $btnTitle;
  36.     /**
  37.      * @var string
  38.      *
  39.      * @ORM\Column(name="link", type="string", length=255, nullable=true)
  40.      */
  41.     private $link;
  42.     /**
  43.      * @var string
  44.      *
  45.      * @ORM\Column(name="description", type="text", nullable=true)
  46.      */
  47.     private $description;
  48.     /**
  49.      * @ORM\ManyToOne(targetEntity="App\Entity\Picture", cascade={"persist","remove"})
  50.      * @ORM\JoinColumn(nullable=true)
  51.      */
  52.     private $banner;
  53.     /**
  54.      * @var bool
  55.      *
  56.      * @ORM\Column(name="isEnabled", type="boolean", nullable=true)
  57.      */
  58.     private $isEnabled;
  59.     /**
  60.      * @var \DateTime
  61.      *
  62.      * @ORM\Column(name="createdAt", type="datetime", nullable=true)
  63.      */
  64.     private $createdAt;
  65.     /**
  66.      * @var \DateTime
  67.      *
  68.      * @ORM\Column(name="lastUpdate", type="datetime", nullable=true)
  69.      */
  70.     private $lastUpdate;
  71.     /**
  72.      * @ORM\Column(type="datetime", nullable=true)
  73.      */
  74.     private $date;
  75.     public function getId(): ?int
  76.     {
  77.         return $this->id;
  78.     }
  79.     public function getTitle(): ?string
  80.     {
  81.         return $this->title;
  82.     }
  83.     public function setTitle(?string $title): self
  84.     {
  85.         $this->title $title;
  86.         return $this;
  87.     }
  88.     public function getBtnTitle(): ?string
  89.     {
  90.         return $this->btnTitle;
  91.     }
  92.     public function setBtnTitle(?string $btnTitle): self
  93.     {
  94.         $this->btnTitle $btnTitle;
  95.         return $this;
  96.     }
  97.     public function getLink(): ?string
  98.     {
  99.         return $this->link;
  100.     }
  101.     public function setLink(?string $link): self
  102.     {
  103.         $this->link $link;
  104.         return $this;
  105.     }
  106.     public function getDescription(): ?string
  107.     {
  108.         return $this->description;
  109.     }
  110.     public function setDescription(?string $description): self
  111.     {
  112.         $this->description $description;
  113.         return $this;
  114.     }
  115.     public function getIsEnabled(): ?bool
  116.     {
  117.         return $this->isEnabled;
  118.     }
  119.     public function setIsEnabled(?bool $isEnabled): self
  120.     {
  121.         $this->isEnabled $isEnabled;
  122.         return $this;
  123.     }
  124.     public function getCreatedAt(): ?\DateTimeInterface
  125.     {
  126.         return $this->createdAt;
  127.     }
  128.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  129.     {
  130.         $this->createdAt $createdAt;
  131.         return $this;
  132.     }
  133.     public function getLastUpdate(): ?\DateTimeInterface
  134.     {
  135.         return $this->lastUpdate;
  136.     }
  137.     public function setLastUpdate(?\DateTimeInterface $lastUpdate): self
  138.     {
  139.         $this->lastUpdate $lastUpdate;
  140.         return $this;
  141.     }
  142.     public function getBanner(): ?Picture
  143.     {
  144.         return $this->banner;
  145.     }
  146.     public function setBanner(?Picture $banner$exists false): self
  147.     {
  148.         if($banner->getTarget()){
  149.             $this->banner $banner;
  150.             if(!$exists){
  151.                 $this->banner->setDir('upload/images/banners');
  152.                 $this->banner->setThumbnailDir('upload/thumbnails/banners');
  153.             }
  154.         }
  155.         return $this;
  156.     }
  157.     public function getDate(): ?\DateTimeInterface
  158.     {
  159.         return $this->date;
  160.     }
  161.     public function setDate(?\DateTimeInterface $date): self
  162.     {
  163.         $this->date $date;
  164.         return $this;
  165.     }
  166. }