I want to create a FAQ System, where the admin is able to create another FAQ in the FAQ a SubFAQ in the FAQ and so on..
I know that I need to self-reference, but how could I solve this?
My Entity FAQ.php looks like this:
/**
* @OneToMany(targetEntity="Faq", mappedBy="parent")
*/
private $children;
/**
* @ManyToOne(targetEntity="Faq", inversedBy="children")
* @JoinColumn(name="parent_id", referencedColumnName="id")
*/
private $parent;
public function __construct() {
$this->children = new \Doctrine\Common\Collections\ArrayCollection();
}
What I don't understand is the inversedBy and how to use all this.
Thank you.