<?php
namespace MLDev\PublicationBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Doctrine\Common\Collections\ArrayCollection;
use MLDev\BaseBundle\Entity\Traits\Timestampable;
/**
* Category
*
* @ORM\Table(name="MLDev_Publication_Category")
* @ORM\Entity(repositoryClass="MLDev\PublicationBundle\Repository\CategoryRepository")
* @ORM\HasLifecycleCallbacks()
*/
class Category
{
use Timestampable;
/**
* @var int
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;
/**
* @var string
*
* @Gedmo\Slug(fields={"name"}, updatable=false, unique=true, separator="-")
* @ORM\Column(name="alias", type="string", length=255, nullable=false)
*/
private $alias;
/**
* @ORM\OneToMany(targetEntity="\MLDev\PublicationBundle\Entity\Item", mappedBy="category", cascade={"persist", "remove"})
*/
private $items = [];
/**
* @ORM\ManyToOne(targetEntity="\MLDev\BaseBundle\Entity\Page")
* @ORM\JoinColumn(name="page_id", referencedColumnName="id", onDelete="SET NULL")
*/
private $page;
/**
* Category constructor.
*/
public function __construct()
{
$this->items = new ArrayCollection();
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set name.
*
* @param string $name
*
* @return Category
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name.
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set alias.
*
* @param string $alias
*
* @return Category
*/
public function setAlias($alias)
{
$this->alias = $alias;
return $this;
}
/**
* Get alias.
*
* @return string
*/
public function getAlias()
{
return $this->alias;
}
/**
* @return mixed
*/
public function getItems()
{
return $this->items;
}
/**
* @param mixed $items
*/
public function setItems($items)
{
$this->items = $items;
}
/**
* @return mixed
*/
public function getPage()
{
return $this->page;
}
/**
* @param mixed $page
*/
public function setPage($page)
{
$this->page = $page;
}
}