0

I have a table like this:

initial table design

the idea is that based on the field "allowed_to_copy_id" I will allow items to be copied.

In the above example the items that are in category #1 can be copied ONLY in category 2 (relationship between "id" and "allowed_to_copy_id").

So, in ../Entity/Category.php I have this:

 /**
 * @ORM\ManyToOne(targetEntity="Category", inversedBy="sourceRestore")
 * @ORM\JoinColumn(name="allowed_to_copy_id", referencedColumnName="id")
 */
protected $copyCategory;

Ok, everythins works perfect!

Here's my problem:

I need to allow a category to be copied to one or more categories... So my database must look something like this:

modified table

I'm lost at the part where I'm getting my copyCategory object... Logically, I have get + set functions, but I don't get it how to tell to my webapp that now I'm not having only 1 category object... :(

Any ideas?

THank you!

4

1 に答える 1

1

You need to convert this to a Many-to-Many relationship.

于 2013-02-27T13:54:57.627 に答える