Doctrine 1.2 Column Naming Conventions for Many To Many Relationships

Posted by Alan Storm on Stack Overflow See other posts from Stack Overflow or by Alan Storm
Published on 2010-06-17T17:14:40Z Indexed on 2010/06/17 23:33 UTC
Read the original article Hit count: 221

Filed under:
|
|
|

I'm working with an existing database schema, and trying to setup two Doctrine models with a Many to Many relationship, as described in this document

When creating tables from scratch, I have no trouble getting this working. However, the existing join tables use a different naming convention that what's described in the Doctrine document. Specifically

Table 1
--------------------------------------------------
table_1_id
....other columns....

Table 2
--------------------------------------------------
table_2_id
....other columns....

Join Table
--------------------------------------------------
fktable1_id
fktable_2_id

Basically, the previous developers prefaced all forign keys with an fk.

From the examples I've seen and some brief experimenting with code, it appears that Doctrine 1.2 requires that the join table use the same column names as the tables it's joining in

  1. Is my assumption correct?

  2. If so, has the situation changed in Doctrine 2?

  3. If the answers to either of the above are true, how do you configure the models so that all the columns "line up"

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql