Creasixtine
Creasixtine

Reputation: 760

@ManyToMany association with other fields in the Join Table

Under Symfony2, how to manage a Many-to-many association with additional fields in the joining table ?

For instance, I want to know which person uses a horse, and when. User and Horse have a many-to-many association and we store the date when this user rides that horse.

Upvotes: 1

Views: 410

Answers (1)

JB Nizet
JB Nizet

Reputation: 691635

If the join table is more than just a join table, and in fact contains additional columns, than you don't have a ManyToMany anymore, but two OneToMany associations :

  • a person has many rides
  • a horse has many rides
  • a ride has one person
  • a ride has one horse

Upvotes: 2

Related Questions