Advertisement
Guest User

Nico Kaiser

a guest
Apr 20th, 2010
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Entities;
  4.  
  5. /**
  6.  * @Entity
  7.  * @Table(name="groups")
  8.  */
  9. class Group
  10. {
  11.     /**
  12.      * @Id
  13.      * @Column(type="integer")
  14.      * @GeneratedValue(strategy="AUTO")
  15.      */
  16.     public $id;
  17.  
  18.     /**
  19.      * @OneToMany(targetEntity="Entities\Group", mappedBy="parent", cascade={"persist", "detach"})
  20.      */
  21.     public $children;
  22.  
  23.     /**
  24.      * @ManyToOne(targetEntity="Entities\Group", inversedBy="children")
  25.      * @JoinColumn(name="parentId", referencedColumnName="id")
  26.      */
  27.     public $parent;
  28.  
  29.     public function __construct()
  30.     {
  31.         $this->children = new \Doctrine\Common\Collections\ArrayCollection;
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement