SHARE
TWEET

Nico Kaiser

a guest Apr 20th, 2010 164 Never
  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. }
RAW Paste Data
Top