0

I have database with about 100 tables and I'm using Doctrine 2 as my Data Mapper. I successfully generated entities for my tables, however, I noticed that many-to-one relationships didn't generate bidirectionally. Only many-to-one part of the relation generates, the one-to-many does not.

For instance in my Company entity I have

/**
 * @var \User
 *
 * @ManyToOne(targetEntity="User")
 * @JoinColumns({
 *   @JoinColumn(name="user_id", referencedColumnName="id")
 * })
 */
private $user;

but I don't have anything pointing to the Company entity in User. I am aware that Doctrine doesn't do this OOTB it says so in their documentation but I was wondering if there is a way to get around this limitation.

Writing 300+ relations by hand is a task I don't want to undertake.

Is there perhaps an alternative Data Mapper library for PHP that can solve this for me? Thanks in advance.

4

1 回答 1

0

我最终使用了Propel,因为它生成的一切都非常好,尽管我最终得到了一些非常大的文件(14k LoC)。

似乎根本没有一个 PHP ORM 可以做所有正确的事情。

于 2013-07-03T09:02:30.087 回答