Not able to add the extra field while creating the many to many relationship in using doctrine annotation.
/**
* @ORM\ManyToMany(targetEntity="Application", inversedBy ="users")
* @ORM\JoinTable(name="user_app",
* joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="application_id", referencedColumnName="id")}
*)
private $applications;
Using this annotation creating the user_app table contains user_id,application_id with relation ship of user and application table.
I want to add a new column to maintain the order of the application id using the annotation.
user_app
----------------
user_id application_id order_id
1 2 1
1 3 2
2 2 1
2 5 2
I think what you can't do this in "Annotation @ORM", try create new entity and set all data's in she.
All Association Mapping - you can see in official documentatio Doctrine ORM
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.