Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Nico Kaiser

By: a guest on Apr 20th, 2010  |  syntax: PHP  |  size: 0.65 KB  |  views: 155  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data