1
私は管理者がその上のFAQでFAQにSubFAQを別のFAQを作成し、することができますよくある質問システムを作成したい。..教義自己参照協会マッピング(symfonyの)
私が知っているI自己参照が必要ですが、どうすればこの問題を解決できますか?
私のエンティティFAQ.phpは、次のようになります。
/**
* @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();
}
私は理解していないことinversedByであり、このすべてを使用する方法。
ありがとうございます。
http://stackoverflow.com/questions/12493865/what-is-the-difference-between-inversedby-and-mappedby#12495834が役立ちます。 –
http://doctrine-orm.readthedocs.io/projects/doctrine-orm/en/latest/reference/association-mapping.html#association-mapping –