<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Category
*
* @ORM\Table(name="category")
* @ORM\Entity(repositoryClass="App\Repository\CategoryRepository")
*/
class Category
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;
/**
* @ORM\ManyToOne(targetEntity="Category", inversedBy="children")
* @ORM\JoinColumn(name="father_id", referencedColumnName="id")
*/
private $catFather;
/**
* @ORM\OneToMany(targetEntity="Category", mappedBy="catFather")
*/
private $children;
/**
* @var int
*
* @ORM\Column(name="code", type="integer", nullable=true)
*/
private $code;
/**
* @var array
*
* @ORM\Column(name="actions", type="array", nullable=true)
*/
private $actions;
public function __toString()
{
return $this->name;
}
/**
* 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 catFather
*
* @param integer $catFather
*
* @return Category
*/
public function setCatFather($catFather)
{
$this->catFather = $catFather;
return $this;
}
/**
* Get catFather
*
* @return int
*/
public function getCatFather()
{
return $this->catFather;
}
/**
* Set code
*
* @param integer $code
*
* @return Category
*/
public function setCode($code)
{
$this->code = $code;
return $this;
}
/**
* Get code
*
* @return int
*/
public function getCode()
{
return $this->code;
}
/**
* Set actions
*
* @param array $actionss
*
* @return Category
*/
public function setActions($actionss)
{
$this->actions = $actionss;
return $this;
}
/**
* Get actions
*
* @return array
*/
public function getActions()
{
return $this->actions;
}
/**
* Constructor
*/
public function __construct()
{
$this->children = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add child
*
* @param \App\Entity\Category $child
*
* @return Category
*/
public function addChild(\App\Entity\Category $child)
{
$this->children[] = $child;
return $this;
}
/**
* Remove child
*
* @param \App\Entity\Category $child
*/
public function removeChild(\App\Entity\Category $child)
{
$this->children->removeElement($child);
}
/**
* Get children
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getChildren()
{
return $this->children;
}
}