Hi,
I'm not sure why this is failing.
If I do the following in one of my OM classes:
// Set the reference to the reservation provider
$this->setReservProvider($reservProvider);
...
$this->save();
I get an integrity violation. It seems like all the fields get
updated in the subsequent update statement as follows:
Apr 06 14:57:00 symfony [debug] {sfPropelLogger} prepare: UPDATE
reservation SET `FACILITY_ID`=:p1, `LEVEL_ID`=:p2,
`EVENT_GENDER_ID`=:p3, `EVENT_CATEGORY_ID`=:p4, `EVENT_TYPE_ID`=:p5,
`UPDATED_AT`=:p6 WHERE reservation.ID=:p7
Apr 06 14:57:00 symfony [debug] {sfPropelLogger} Binding 325 at
position :p1 w/ PDO type PDO::PARAM_INT
Apr 06 14:57:00 symfony [debug] {sfPropelLogger} Binding 2 at
position :p2 w/ PDO type PDO::PARAM_INT
Apr 06 14:57:00 symfony [debug] {sfPropelLogger} Binding NULL at
position :p3 w/ PDO type PDO::PARAM_NULL
Apr 06 14:57:00 symfony [debug] {sfPropelLogger} Binding 1 at
position :p4 w/ PDO type PDO::PARAM_INT
Apr 06 14:57:00 symfony [debug] {sfPropelLogger} Binding 1 at
position :p5 w/ PDO type PDO::PARAM_INT
Apr 06 14:57:00 symfony [debug] {sfPropelLogger} Binding '2009-04-06
14:56:59' at position :p6 w/ PDO type PDO::PARAM_STR
Apr 06 14:57:00 symfony [debug] {sfPropelLogger} Binding 1 at
position :p7 w/ PDO type PDO::PARAM_INT
Apr 06 14:57:00 symfony [err] {sfPropelLogger} SQLSTATE[23000]:
Integrity constraint violation: 1048 Column 'event_gender_id' cannot
be null
However, if I just set the id, as follows:
// Set the reference to the reservation provider
$this->setReservProviderId($reservProvider->getId());
...
$this->save();
It seems to work:
Apr 06 15:03:21 symfony [debug] {sfPropelLogger} prepare: UPDATE
reservation SET `RESERV_PROVIDER_ID`=:p1, `UPDATED_AT`=:p2 WHERE
reservation.ID=:p3
Apr 06 15:03:21 symfony [debug] {sfPropelLogger} Binding 1 at
position :p1 w/ PDO type PDO::PARAM_INT
Apr 06 15:03:21 symfony [debug] {sfPropelLogger} Binding '2009-04-06
15:03:21' at position :p2 w/ PDO type PDO::PARAM_STR
Apr 06 15:03:21 symfony [debug] {sfPropelLogger} Binding 1 at
position :p3 w/ PDO type PDO::PARAM_INT
What I don't like about this, of course, is that I have made changes
to the ReservProvider, so when I do my save(), these changes are not
being propagated via the relationship.
I'm not sure if there is something special I need to do - I'd
certainly like to avoid having to call save() individually on each
object within my graph? I would have thought that if I set the object
reference for my Reservation, rather than just the ID of the object,
it would have worked.
Regards,
Steve
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---