The expected behaviour is for the row outputted from recursive_update to correctly show the nested belongs_to relationship. The actual behaviour is that it seems to lose the change in the returned row, despite correctly updating the DB.
This patch adds a test and changes a couple test schema tables:
liner_notes table changed to use dvd_id as it's PK
Add liner_notes_belongs_to table with belongs_to relationship to liner_notes
In the test, I've added comments where you can comment out a line to make the test pass. When I dug into the RecursiveUpdate code, in _update_relation when it calls set_from_related, it passes in the correct data, but the output from get_columns afterwards is unchanged, for example:
$sub_object->get_columns() = {
'dvd_id' => 5,
'notes' => 'test note',
'liner_notes_belongs_to' => 1
};
Now $object->set_from_related($name, $sub_object) is called and then:
$sub_object->get_columns() = {
'dvd_id' => 5,
'notes' => 'test note',
'liner_notes_belongs_to' => undef
};
I tried a simpler test with just the liner_notes and liner_notes_belongs_to, but they worked fine... It only stops working when I add the extra layer of the DVD.
The expected behaviour is for the row outputted from recursive_update to correctly show the nested belongs_to relationship. The actual behaviour is that it seems to lose the change in the returned row, despite correctly updating the DB.
This patch adds a test and changes a couple test schema tables:
liner_notes
table changed to usedvd_id
as it's PKliner_notes_belongs_to
table with belongs_to relationship toliner_notes
In the test, I've added comments where you can comment out a line to make the test pass. When I dug into the RecursiveUpdate code, in
_update_relation
when it callsset_from_related
, it passes in the correct data, but the output fromget_columns
afterwards is unchanged, for example:I tried a simpler test with just the liner_notes and liner_notes_belongs_to, but they worked fine... It only stops working when I add the extra layer of the DVD.