src/Entity/Channel.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\ChannelRepository")
  8.  *
  9.  * @ORM\HasLifecycleCallbacks()
  10.  */
  11. class Channel
  12. {
  13.     public function __construct()
  14.     {
  15.         $this->menus = new ArrayCollection();
  16.         $this->categories = new ArrayCollection();
  17.     }
  18.     /**
  19.      * @ORM\Id()
  20.      *
  21.      * @ORM\GeneratedValue()
  22.      *
  23.      * @ORM\Column(type="integer")
  24.      */
  25.     private $id;
  26.     /**
  27.      * @ORM\Column(type="string", nullable=false, length=180)
  28.      */
  29.     private $name null;
  30.     public function getId(): ?int
  31.     {
  32.         return $this->id;
  33.     }
  34.     public function getName()
  35.     {
  36.         return $this->name;
  37.     }
  38.     public function setName($name)
  39.     {
  40.         $this->name $name;
  41.         return $this;
  42.     }
  43.     /**
  44.      * @ORM\Column(type="datetime", nullable=false)
  45.      */
  46.     private $created_at;
  47.     /**
  48.      * @ORM\Column(type="datetime", nullable=true)
  49.      */
  50.     private $updated_at null;
  51.     public function getCreatedAt(): \DateTimeInterface
  52.     {
  53.         return $this->created_at;
  54.     }
  55.     public function setCreatedAt(\DateTimeInterface $created_at): self
  56.     {
  57.         $this->created_at $created_at;
  58.         return $this;
  59.     }
  60.     public function getUpdatedAt(): ?\DateTimeInterface
  61.     {
  62.         return $this->updated_at;
  63.     }
  64.     public function setUpdatedAt(?\DateTimeInterface $updated_at): self
  65.     {
  66.         $this->updated_at $updated_at;
  67.         return $this;
  68.     }
  69.     /**
  70.      * @ORM\PrePersist
  71.      */
  72.     public function setCreatedAtValue()
  73.     {
  74.         $this->setCreatedAt(new \DateTime());
  75.     }
  76.     /**
  77.      * @ORM\PreUpdate
  78.      */
  79.     public function setUpdatedAtValue()
  80.     {
  81.         $this->setUpdatedAt(new \DateTime());
  82.     }
  83.     /**
  84.      * @ORM\Column(type="datetime", nullable=true)
  85.      */
  86.     private $deleted_at;
  87.     /**
  88.      * @ORM\OneToMany(targetEntity="App\Entity\ChannelMenu", mappedBy="channel")
  89.      */
  90.     private $menus;
  91.     public function getDeletedAt(): ?\DateTimeInterface
  92.     {
  93.         return $this->deleted_at;
  94.     }
  95.     public function setDeletedAt(?\DateTimeInterface $deleted_at): self
  96.     {
  97.         $this->deleted_at $deleted_at;
  98.         return $this;
  99.     }
  100.     /**
  101.      * @return Collection|ChannelMenu[]
  102.      */
  103.     public function getMenus(): Collection
  104.     {
  105.         return $this->menus;
  106.     }
  107.     public function addMenu(ChannelMenu $menu): self
  108.     {
  109.         if (!$this->menus->contains($menu)) {
  110.             $this->menus[] = $menu;
  111.             $menu->setChannel($this);
  112.         }
  113.         return $this;
  114.     }
  115.     public function removeMenu(ChannelMenu $menu): self
  116.     {
  117.         if ($this->menus->contains($menu)) {
  118.             $this->menus->removeElement($menu);
  119.             // set the owning side to null (unless already changed)
  120.             if ($menu->getChannel() === $this) {
  121.                 $menu->setChannel(null);
  122.             }
  123.         }
  124.         return $this;
  125.     }
  126.     /**
  127.      * @ORM\OneToMany(targetEntity="App\Entity\ChannelCategory", mappedBy="channel")
  128.      */
  129.     private $categories;
  130.     /**
  131.      * @return Collection|ChannelCategory[]
  132.      */
  133.     public function getCategories(): Collection
  134.     {
  135.         return $this->categories;
  136.     }
  137.     public function addCategory(ChannelCategory $category): self
  138.     {
  139.         if (!$this->categories->contains($category)) {
  140.             $this->categories[] = $category;
  141.             $category->setChannel($this);
  142.         }
  143.         return $this;
  144.     }
  145.     public function removeCategory(ChannelCategory $category): self
  146.     {
  147.         if ($this->categories->contains($category)) {
  148.             $this->categories->removeElement($category);
  149.             // set the owning side to null (unless already changed)
  150.             if ($category->getChannel() === $this) {
  151.                 $category->setChannel(null);
  152.             }
  153.         }
  154.         return $this;
  155.     }
  156.     /**
  157.      * @ORM\Column(type="boolean")
  158.      */
  159.     private $active;
  160.     public function getActive(): ?bool
  161.     {
  162.         return $this->active;
  163.     }
  164.     public function setActive(bool $active): self
  165.     {
  166.         $this->active $active;
  167.         return $this;
  168.     }
  169.     /**
  170.      * @ORM\ManyToOne(targetEntity="App\Entity\StaticPage", inversedBy="channels_homepages")
  171.      *
  172.      * @ORM\JoinColumn(nullable=true)
  173.      */
  174.     private $homepage null;
  175.     /**
  176.      * @return null
  177.      */
  178.     public function getHomepage()
  179.     {
  180.         return $this->homepage;
  181.     }
  182.     /**
  183.      * @param null $homepage
  184.      *
  185.      * @return Channel
  186.      */
  187.     public function setHomepage($homepage)
  188.     {
  189.         $this->homepage $homepage;
  190.         return $this;
  191.     }
  192. }