src/Entity/Advertising.php line 14

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. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\AdvertisingRepository")
  8.  *
  9.  * @ORM\HasLifecycleCallbacks()
  10.  */
  11. class Advertising
  12. {
  13.     public function __construct()
  14.     {
  15.         $this->advertisingBanners = new ArrayCollection();
  16.     }
  17.     /**
  18.      * @ORM\Id()
  19.      *
  20.      * @ORM\GeneratedValue()
  21.      *
  22.      * @ORM\Column(type="integer")
  23.      */
  24.     private $id;
  25.     /**
  26.      * @ORM\Column(type="string", nullable=false, length=180)
  27.      */
  28.     private $name null;
  29.     /**
  30.      * @ORM\Column(type="datetime", nullable=true)
  31.      */
  32.     private $publication_start null;
  33.     /**
  34.      * @ORM\Column(type="datetime", nullable=true)
  35.      */
  36.     private $publication_end null;
  37.     /**
  38.      * @ORM\Column(type="boolean", nullable=false)
  39.      */
  40.     private $publication_status false;
  41.     /**
  42.      * @ORM\Column(type="datetime", nullable=true)
  43.      */
  44.     private $deleted_at;
  45.     /**
  46.      * @ORM\OneToMany(targetEntity="App\Entity\AdvertisingBanner", mappedBy="advertising")
  47.      */
  48.     private $advertisingBanners;
  49.     /**
  50.      * @ORM\Column(type="datetime", nullable=false)
  51.      */
  52.     private $created_at;
  53.     /**
  54.      * @ORM\Column(type="datetime", nullable=true)
  55.      */
  56.     private $updated_at null;
  57.     public function getId(): ?int
  58.     {
  59.         return $this->id;
  60.     }
  61.     public function getName()
  62.     {
  63.         return $this->name;
  64.     }
  65.     public function setName($name)
  66.     {
  67.         $this->name $name;
  68.         return $this;
  69.     }
  70.     public function getPublicationStart()
  71.     {
  72.         return $this->publication_start;
  73.     }
  74.     public function setPublicationStart($publication_start)
  75.     {
  76.         $this->publication_start $publication_start;
  77.         return $this;
  78.     }
  79.     public function getPublicationEnd()
  80.     {
  81.         return $this->publication_end;
  82.     }
  83.     public function setPublicationEnd($publication_end)
  84.     {
  85.         $this->publication_end $publication_end;
  86.         return $this;
  87.     }
  88.     public function getPublicationStatus()
  89.     {
  90.         return $this->publication_status;
  91.     }
  92.     public function setPublicationStatus($publication_status)
  93.     {
  94.         $this->publication_status $publication_status;
  95.         return $this;
  96.     }
  97.     public function getCreatedAt(): \DateTimeInterface
  98.     {
  99.         return $this->created_at;
  100.     }
  101.     public function setCreatedAt(\DateTimeInterface $created_at): self
  102.     {
  103.         $this->created_at $created_at;
  104.         return $this;
  105.     }
  106.     public function getUpdatedAt(): ?\DateTimeInterface
  107.     {
  108.         return $this->updated_at;
  109.     }
  110.     public function setUpdatedAt(?\DateTimeInterface $updated_at): self
  111.     {
  112.         $this->updated_at $updated_at;
  113.         return $this;
  114.     }
  115.     /**
  116.      * @ORM\PrePersist
  117.      */
  118.     public function setCreatedAtValue()
  119.     {
  120.         $this->setCreatedAt(new \DateTime());
  121.     }
  122.     /**
  123.      * @ORM\PreUpdate
  124.      */
  125.     public function setUpdatedAtValue()
  126.     {
  127.         $this->setUpdatedAt(new \DateTime());
  128.     }
  129.     public function getDeletedAt(): ?\DateTimeInterface
  130.     {
  131.         return $this->deleted_at;
  132.     }
  133.     public function setDeletedAt(?\DateTimeInterface $deleted_at): self
  134.     {
  135.         $this->deleted_at $deleted_at;
  136.         return $this;
  137.     }
  138.     /**
  139.      * @return Collection|AdvertisingBanner[]
  140.      */
  141.     public function getAdvertisingBanners(): Collection
  142.     {
  143.         return $this->advertisingBanners;
  144.     }
  145.     public function addAdvertisingBanner(AdvertisingBanner $advertisingBanner): self
  146.     {
  147.         if (!$this->advertisingBanners->contains($advertisingBanner)) {
  148.             $this->advertisingBanners[] = $advertisingBanner;
  149.             $advertisingBanner->setAdvertising($this);
  150.         }
  151.         return $this;
  152.     }
  153.     public function removeAdvertisingBanner(AdvertisingBanner $advertisingBanner): self
  154.     {
  155.         if ($this->advertisingBanners->contains($advertisingBanner)) {
  156.             $this->advertisingBanners->removeElement($advertisingBanner);
  157.             // set the owning side to null (unless already changed)
  158.             if ($advertisingBanner->getAdvertising() === $this) {
  159.                 $advertisingBanner->setAdvertising(null);
  160.             }
  161.         }
  162.         return $this;
  163.     }
  164.     public function __toString(): string
  165.     {
  166.         return $this->name;
  167.     }
  168. }