It's possible in Doctrine2 to manage Many to Many relations with a third key to be able to add more than one identic relationship?
I have one "Users" table and one other "Plans" table and i did the normal many to many relationship that produces user_plan table with the two primary keys (user_id and plan_id) but I need in my application to be able to add the same plan to user more than one time. For example: user_plan(generated_id, user_id, plan_id)
My current user yml definition:
Entity\FosUser:
type: entity
table: fos_user
fields:
id:
id: true
type: integer
unsigned: false
nullable: false
generator:
strategy: IDENTITY
manyToMany:
plans:
targetEntity: Plan
inversedBy: users
joinTable:
name: user_plan
joinColumns:
plan_id:
referencedColumnName: id
inverseJoinColumns:
user_id:
referencedColumnName: id
lifecycleCallbacks:
prePersist: [ setUserValue ]
preUpdate: []
My current plan yml definition:
Entity\Plan:
type: entity
table: plan
fields:
id:
id: true
type: integer
unsigned: false
nullable: false
generator:
strategy: IDENTITY
planName:
type: string
length: 50
fixed: false
nullable: false
column: plan_name
manyToMany:
users:
targetEntity: FosUser
mappedBy: plans
LifecycleCallbacks:
prePersist: [ setCreatedAtValue ]
preUpdate: [ setUpdatedAtValue ]
Someone knows if it's possible to do that with symfony2?