propelorm/Propel — Issue #282: Versionable behavior, error with fk in baseX Class
Author: aamsellem
Created: 2012-02-06 09:06:23+00:00
State: open

I got a problem with generated class using versionable behavior in the function "populateFromVersion"

The problem appears when we use two or more tables with the versionable behavior and one of them have a id field with a fieldname not equal to "id".

It's work if two id's name is "ID" because ID field exist in both table but if one id field name is different the error appear.

schema :
A:
diff_id : { type: integer, required: true, primaryKey: true, autoIncrement: true, phpName: Id }
_propel_behaviors:

versionable: { log_created_at: true, log_created_by: true}
B:
id: ~
a_id: { type: integer, foreignTable: a, foreignReference: diff_id, default : null }
_propel_behaviors:

versionable: { log_created_at: true, log_created_by: true}

It will generate in baseA :

$c1 = $query->getNewCriterion(BPeer::DIFF_ID, $value);

instead of

$c1 = $query->getNewCriterion(BPeer::ID, $value);

in that case $query is a BQuery object.

It's seems that the problem come from here : https://github.com/propelorm/Propel/commit/a54ac77c41577276447fa27302355a90ecb6a60e