src/Entity/Menu.php line 16
- <?php
- namespace App\Entity;
- use Doctrine\ORM\Mapping as ORM;
- use Doctrine\Common\Collections\ArrayCollection;
- /**
- * Menu
- *
- * @ORM\Entity
- * @ORM\Table(name="menu")
- * @ORM\Entity(repositoryClass="App\Repository\MenuRepository")
- */
- class Menu
- {
- const ZONA_PRINCIPAL = 'principal';
- const ZONA_PIE = 'pie';
- public static function getZonaLista()
- {
- return array(
- self::ZONA_PRINCIPAL,
- self::ZONA_PIE
- );
- }
- /**
- * @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="MenuItem", mappedBy="menu" , 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 getItems()
- {
- return $this->items;
- }
- public function addItem(MenuItem $item)
- {
- if (!$this->items->contains($item))
- {
- $item->setMenu($this);
- $this->items->add($item);
- }
- }
- public function removeItem(MenuItem $item)
- {
- if ($this->items->contains($item))
- return $this->items->removeElement($item);
- }
- public function __toString()
- {
- return $this->getNombre();
- }
- /**
- * Set id
- *
- * @param string $id
- * @return Pais
- */
- public function setId($id)
- {
- $this->id = $id;
- return $this;
- }
- /**
- * Get id
- *
- * @return string
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set nombre
- *
- * @param string $nombre
- * @return Pais
- */
- public function setNombre($nombre)
- {
- $this->nombre = $nombre;
- return $this;
- }
- /**
- * Get nombre
- *
- * @return string
- */
- public function getNombre()
- {
- return $this->nombre;
- }
- /**
- * Set activo
- *
- * @param boolean $activo
- * @return Pais
- */
- public function setActivo($activo)
- {
- $this->activo = $activo;
- return $this;
- }
- /**
- * Get activo
- *
- * @return boolean
- */
- public function getActivo()
- {
- return $this->activo;
- }
- /**
- * Set zona
- *
- * @param string $zona
- * @return Zona
- */
- public function setZona($zona)
- {
- $this->zona = $zona;
- return $this;
- }
- /**
- * Get zona
- *
- * @return string
- */
- public function getZona()
- {
- return $this->zona;
- }
- }