propelorm/Propel — Issue #189: auto_add_pk behavior can break a foreign keys
Author: rozwell
Created: 2011-11-13 00:52:43+00:00
State: open

There is probably more than one issue here, very connected to each other but let's start from the beginning:
For some time I had to sort tables in my schema to get valid sql file - if they had a relation between them, the referred table had to be first.

Today I had to add a foreign key on the table itself but... this error came back, it didn't create valid index.
After some digging I found out that the problem was in auto_add_pk which was adding id but I guess at the end of whole table initialization process.

That was the first issue, while digging I discovered some (probably) unused methods, like:
* generator/lib/model/Table.php: applyBehaviors()
* generator/lib/model/Table.php: getEarlyBehaviors()

Maybe EarlyBehaviors was designed to prevent this issue but... it was never used?