I have an object ApplicationProfile which represents a many-to-many
object:

<table name="application_profile">
  <column name="application_id" type="INTEGER" primaryKey="true"
required="true"/>
  <column name="profile_id" type="INTEGER" primaryKey="true"
required="true"/>
  <column name="is_confirmed" type="BOOLEAN" required="true"
default="0" defaultExpr="0"/>
  <foreign-key name="application_id" foreignTable="application"
onDelete="cascade">
    <reference local="application_id" foreign="application_id"/>
  </foreign-key>
  <foreign-key name="fk_profile_id" foreignTable="profiles"
onDelete="cascade">
    <reference local="profile_id" foreign="profileid"/>
  </foreign-key>
</table>


When making modifications to an ApplicationProfile object which
already exists in the db I'm having trouble saving this object. While
I can save modifications to is_confirmed, I'm unable to modify either
of columns which are used as the primary key.

This appears to be due to how the Propel generated
ApplicationProfilePeer doUpdate method works. It uses the primary key
to retrieve the records to update however if you've modified the pk
(in this example say you modified one of the columns which make up the
profile_id) then it is unable to find the correct column to modify.

public static function doUpdate($values, PropelPDO $con = null)
[...]
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/
primary key(s)
[...]

I'm wondering if this is due to a configuration issue... eg. the
doUpdate method gets generated differently when the schema.xml is
properly configured. Or if doUpdate simply can't/doesn't support this
sort of modification.

At the moment the only way to get around this issue appears to be to
add a separate single column primary key to the lookup table.
(pk_application_profile, application_id, profile_id) Another option
would perhaps be to modify doUpdate however it unclear how you would
provide it the unmodified value to use in retrieving the original
record.

Any suggestions?

--

You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.


Reply via email to