I've 2 organizations Item and Itemimage. The connection between Item to Itemimage is OneToMany Unidirectional with JoinColumn. I required the aid of doctrine documentation. The OneToMany unidirectional with JoinColumn is accomplished using the ManyToMany Annotation:

/**
 * @ManyToMany(targetEntity="Itemimage")
 * @JoinTable(name="itemimage",
 *      joinColumns={@JoinColumn(name="item_id", referencedColumnName="id")},
 *      inverseJoinColumns={@JoinColumn(name="image_id", referencedColumnName="itemid")}
 *      )
 */

Where:

  • image_id: itemid is really a property within the Itemimage Entity
  • item_id: may be the primary key property from the Item Entity

I designed a property $images in Item Entity and gave it the above mentioned docblock. However , after i attempted upgrading the schema. I recieve a doctrine error: "The Table 'itemimage' already is available". I am sure that's not the situation. I've no clue how to proceed.

Help me with this particular.

Thanks! I thank you for help.

It should be:

/**
 * @ManyToMany(targetEntity="Itemimage")
 * @JoinTable(name="itemimage_map",
 *      joinColumns={@JoinColumn(name="item_id", referencedColumnName="id")},
 *      inverseJoinColumns={@JoinColumn(name="image_id", referencedColumnName="id")}
 *      )
 */

resulting in the development of another table (itemimage_map) which will contain only the mapping from the other two tables. It's not a current table you need to join there. That table will contain item_id and image_id what are primary secrets of tables you need to map.