Wrong behavior when inserting rows into crossRef table with auto increment primary key column.#1676
Wrong behavior when inserting rows into crossRef table with auto increment primary key column.#1676WebsourceCz wants to merge 1 commit intopropelorm:masterfrom
Conversation
…ey column defined at other than first position in table schema, then auto increment value is set to first defined primary key column instead of the correct one.
|
Can you add a test case for this please? |
|
ping @WebsourceCz |
| $script .= " | ||
| if (\$pk !== null) { | ||
| \$this->set" . $column->getPhpName() . "(\$pk); | ||
| \$this->set" . $col->getPhpName() . "(\$pk); |
There was a problem hiding this comment.
Can we keep the $column variable, or is there a conflict?
|
Maybe you can provide as an example or alike we can add into the tests manually |
|
Imagine you have table for M:N relation of another two tables and you need to work with relation rows using autoincrement id. So xml schema of this table is for example:
When new row is inserted by Propel, old code found page_id as first primary key and set new auto increment id value returned from database to page_id column instead of id column. I know that I can set id as first column in the table, but I think, that when I tried it, there was some problem with auto creating of generated object and query methods for cross relation. |
When inserting rows into crossRef table with auto increment primary key column defined at other than first position in table schema, then auto increment value is set to first defined primary key column instead of the correct one.