Advertisement
Guest User

Untitled

a guest
Sep 8th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.98 KB | None | 0 0
  1. <?php
  2. namespace CoreBundle\Entity;
  3.  
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. use Sonata\TranslationBundle\Model\Gedmo\TranslatableInterface;
  8. use Sonata\TranslationBundle\Traits\Translatable;
  9.  
  10. /**
  11.  * @ORM\Entity
  12.  * @ORM\AttributeOverrides({})
  13.  * @Gedmo\Tree(type="nested")
  14.  */
  15. class Category implements TranslatableInterface
  16. {
  17.     use Translatable;
  18.  
  19.     /**
  20.      * @ORM\Id
  21.      * @ORM\Column(type="integer")
  22.      * @ORM\GeneratedValue(strategy="AUTO")
  23.      *
  24.      */
  25.     private $id;
  26.  
  27.     /**
  28.      * @Gedmo\Translatable
  29.      * @ORM\Column(type="string", length=255, nullable=false)
  30.      */
  31.     private $title;
  32.  
  33.     /**
  34.      * @Gedmo\SortablePosition
  35.      * @ORM\Column(type="integer", nullable=false)
  36.      */
  37.     private $position;
  38.  
  39.     /**
  40.      * @ORM\Column(type="integer", nullable=true, name="lft")
  41.      * @Gedmo\TreeLeft
  42.      */
  43.     private $left;
  44.  
  45.     /**
  46.      * @ORM\Column(type="integer", nullable=true, name="lvl")
  47.      * @Gedmo\TreeLevel
  48.      */
  49.     private $level;
  50.  
  51.     /**
  52.      * @ORM\Column(type="integer", nullable=true, name="rgt")
  53.      * @Gedmo\TreeRight
  54.      */
  55.     private $right;
  56.  
  57.     /**
  58.      * @ORM\OneToMany(targetEntity="IpSell\Bundle\CoreBundle\Entity\Project", mappedBy="category")
  59.      */
  60.     private $projects;
  61.  
  62.     /**
  63.      * @ORM\OneToMany(targetEntity="IpSell\Bundle\CoreBundle\Entity\Category", mappedBy="parent")
  64.      * @ORM\OrderBy({"left"="ASC"})
  65.      */
  66.     private $children;
  67.  
  68.     /**
  69.      * @ORM\ManyToOne(targetEntity="IpSell\Bundle\CoreBundle\Entity\Category")
  70.      * @ORM\JoinColumn(name="root_id", referencedColumnName="id", onDelete="CASCADE")
  71.      */
  72.     private $root;
  73.  
  74.     /**
  75.      * @ORM\ManyToOne(targetEntity="IpSell\Bundle\CoreBundle\Entity\Category", inversedBy="children")
  76.      * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE")
  77.      * @Gedmo\TreeParent
  78.      */
  79.     private $parent;
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement