123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <?php
- namespace Tree\Fixture;
- use Gedmo\Mapping\Annotation as Gedmo;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * @ORM\Entity(repositoryClass="Gedmo\Tree\Entity\Repository\NestedTreeRepository")
- * @Gedmo\Tree(type="nested")
- */
- class RootCategory
- {
- /**
- * @ORM\Column(name="id", type="integer")
- * @ORM\Id
- * @ORM\GeneratedValue
- */
- private $id;
- /**
- * @ORM\Column(name="title", type="string", length=64)
- */
- private $title;
- /**
- * @Gedmo\TreeLeft
- * @ORM\Column(name="lft", type="integer")
- */
- private $lft;
- /**
- * @Gedmo\TreeRight
- * @ORM\Column(name="rgt", type="integer")
- */
- private $rgt;
- /**
- * @Gedmo\TreeParent
- * @ORM\ManyToOne(targetEntity="RootCategory", inversedBy="children")
- * @ORM\JoinColumns({
- * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="SET NULL")
- * })
- */
- private $parent;
- /**
- * @Gedmo\TreeRoot
- * @ORM\Column(type="integer")
- */
- private $root;
- /**
- * @Gedmo\TreeLevel
- * @ORM\Column(name="lvl", type="integer")
- */
- private $level;
- /**
- * @ORM\OneToMany(targetEntity="RootCategory", mappedBy="parent")
- */
- private $children;
- public function getId()
- {
- return $this->id;
- }
- public function setTitle($title)
- {
- $this->title = $title;
- }
- public function getTitle()
- {
- return $this->title;
- }
- public function setParent(RootCategory $parent = null)
- {
- $this->parent = $parent;
- }
- public function getParent()
- {
- return $this->parent;
- }
- public function getRoot()
- {
- return $this->root;
- }
- public function getLeft()
- {
- return $this->lft;
- }
- public function getRight()
- {
- return $this->rgt;
- }
- public function getLevel()
- {
- return $this->level;
- }
- }
|