<?php
namespace Entities;
/**
* @Entity
* @Table(name="groups")
*/
class Group
{
/**
* @Id
* @Column(type="integer")
* @GeneratedValue(strategy="AUTO")
*/
public $id;
/**
* @OneToMany(targetEntity="Entities\Group", mappedBy="parent", cascade={"persist", "detach"})
*/
public $children;
/**
* @ManyToOne(targetEntity="Entities\Group", inversedBy="children")
* @JoinColumn(name="parentId", referencedColumnName="id")
*/
public $parent;
public function __construct()
{
$this->children = new \Doctrine\Common\Collections\ArrayCollection;
}
}