src/Entity/Banner.php line 18
- <?php
- namespace App\Entity;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- use Doctrine\Common\Collections\ArrayCollection;
- use Bornay\ZonaBundle\Entity\Zona;
- use Bornay\ZonaBundle\Entity\BannerItem;
- /**
- * Banner
- *
- * @ORM\Entity
- * @ORM\Table(name="banner")
- * @ORM\Entity(repositoryClass="App\Repository\BannerRepository")
- */
- class Banner
- {
- /**
- * @var integer
- * @ORM\Column(name="id", type="integer")
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @var string
- *
- * @ORM\Column(name="nombre", type="string", length=64)
- */
- private $nombre;
- /**
- * @var boolean
- *
- * @ORM\Column(name="activo", type="boolean", options={"default":0})
- */
- private $activo;
- /**
- * @var Collection
- * @ORM\OneToMany(targetEntity="BannerItem", mappedBy="banner" , cascade={"persist"}, orphanRemoval=true)
- * @ORM\OrderBy({"position" = "ASC"})
- */
- protected $items;
- /**
- * @var string
- *
- * @ORM\Column(name="zona", type="string", length=64)
- */
- protected $zona;
- public function __construct()
- {
- $this->items = new ArrayCollection();
- }
- public function __toString()
- {
- return $this->nombre;
- }
- public function getId(): ?int
- {
- return $this->id;
- }
- public function getNombre(): ?string
- {
- return $this->nombre;
- }
- public function setNombre(string $nombre): self
- {
- $this->nombre = $nombre;
- return $this;
- }
- public function isActivo(): ?bool
- {
- return $this->activo;
- }
- public function setActivo(bool $activo): self
- {
- $this->activo = $activo;
- return $this;
- }
- public function getZona(): ?string
- {
- return $this->zona;
- }
- public function setZona(string $zona): self
- {
- $this->zona = $zona;
- return $this;
- }
- /**
- * @return Collection<int, BannerItem>
- */
- public function getItems(): Collection
- {
- return $this->items;
- }
- public function addItem(BannerItem $item): self
- {
- if (!$this->items->contains($item)) {
- $item->setBanner($this);
- $this->items->add($item);
- }
- return $this;
- }
- public function removeItem(BannerItem $item): self
- {
- if ($this->items->removeElement($item)) {
- // set the owning side to null (unless already changed)
- if ($item->getBanner() === $this) {
- $item->setBanner(null);
- }
- }
- return $this;
- }
- }