mardi 20 janvier 2015

Multiple OneToMany/ManyToOne bidirectional associations in Doctrine


Vote count:

0




I'm facing an issue with Doctrine associations with join tables.


I have three entities: Location, Company and Vote. As you may presume, I'd like to make it possible to vote on both: location and company however I have no idea how to set up multiple oneToMany/manyToOne with join tables in Doctrine.


Here's the database structure I'd like to achieve:



companies
companies_votes (company_id + vote_id)
locations
locations_votes (location_id + vote_id)
votes


According to Doctrine documentation it's not possible to set up bidirectional oneToMany association with join table. I've tried few configurations with joinTable option in my mapping file, but it's being ignored - the join table is not being created. If possible, I'd like to avoid creating 3rd entity for each association.


Does anyone knows how to solve such issue?



asked 1 min ago







Multiple OneToMany/ManyToOne bidirectional associations in Doctrine

Aucun commentaire:

Enregistrer un commentaire