1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
- namespace Tree\Fixture;
- use Gedmo\Tree\Node as NodeInterface;
- use Gedmo\Mapping\Annotation as Gedmo;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * @ORM\Entity(repositoryClass="Gedmo\Tree\Entity\Repository\MaterializedPathRepository")
- * @Gedmo\Tree(type="materializedPath")
- */
- class MPCategory
- {
- /**
- * @ORM\Column(name="id", type="integer")
- * @ORM\Id
- * @ORM\GeneratedValue
- */
- private $id;
- /**
- * @Gedmo\TreePath
- * @ORM\Column(name="path", type="string", length=3000, nullable=true)
- */
- private $path;
- /**
- * @Gedmo\TreePathSource
- * @ORM\Column(name="title", type="string", length=64)
- */
- private $title;
- /**
- * @Gedmo\TreeParent
- * @ORM\ManyToOne(targetEntity="MPCategory", inversedBy="children")
- * @ORM\JoinColumns({
- * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="SET NULL")
- * })
- */
- private $parentId;
- /**
- * @Gedmo\TreeLevel
- * @ORM\Column(name="lvl", type="integer", nullable=true)
- */
- private $level;
- /**
- * @ORM\OneToMany(targetEntity="MPCategory", mappedBy="parent")
- */
- private $children;
- /**
- * @ORM\OneToMany(targetEntity="Article", mappedBy="category")
- */
- private $comments;
- public function getId()
- {
- return $this->id;
- }
- public function setTitle($title)
- {
- $this->title = $title;
- }
- public function getTitle()
- {
- return $this->title;
- }
- public function setParent(MPCategory $parent = null)
- {
- $this->parentId = $parent;
- }
- public function getParent()
- {
- return $this->parentId;
- }
- public function setPath($path)
- {
- $this->path = $path;
- }
- public function getPath()
- {
- return $this->path;
- }
- public function getLevel()
- {
- return $this->level;
- }
- }
|