src/Entity/PageBlockCarousel.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PageBlockCarouselRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=PageBlockCarouselRepository::class)
  9.  */
  10. class PageBlockCarousel
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\OneToMany(targetEntity=PageBlockCarouselItem::class, mappedBy="pageBlockCarousel", orphanRemoval=true, cascade={"persist", "remove"})
  20.      */
  21.     private $items;
  22.     public function __construct()
  23.     {
  24.         $this->items = new ArrayCollection();
  25.     }
  26.     public function getId(): ?int
  27.     {
  28.         return $this->id;
  29.     }
  30.     /**
  31.      * @return Collection|PageBlockCarouselItem[]
  32.      */
  33.     public function getItems(): Collection
  34.     {
  35.         return $this->items;
  36.     }
  37.     public function addItem(PageBlockCarouselItem $item): self
  38.     {
  39.         if (!$this->items->contains($item)) {
  40.             $this->items[] = $item;
  41.             $item->setPageBlockCarousel($this);
  42.         }
  43.         return $this;
  44.     }
  45.     public function removeItem(PageBlockCarouselItem $item): self
  46.     {
  47.         if ($this->items->removeElement($item)) {
  48.             // set the owning side to null (unless already changed)
  49.             if ($item->getPageBlockCarousel() === $this) {
  50.                 $item->setPageBlockCarousel(null);
  51.             }
  52.         }
  53.         return $this;
  54.     }
  55.     public function __toString(): string
  56.     {
  57.         return '';
  58.     }
  59. }