franco
franco

Reputation: 112

Doctrine2 One-To-Many, Unidirectional with Join Table with data in Join Table

I'm working with Symfony2 and I have this schema:

Products:
  id
  name
  value

List:
  id
  owner_name
  created_at
  status

I read how to make relations with Join Table in Doctrine2 docs and all works fine. But now, I want to add one field (status) to the table products_list to have:

products_list:
  product_id
  list_id
  status

Any help?

thanks :)

Upvotes: 1

Views: 138

Answers (1)

Tobias
Tobias

Reputation: 954

If the association should stay a oneToMany, you have to make a thrid entity.

products_list
  product(OneToOne)
  list(ManyToOne)
  status

list:
  products_list(OneToMany)

products:
  products_list(OneToOne)

Upvotes: 1

Related Questions