Hi,
Using "create" in DBIx::Class::ResultSet, I can specify a hashref of
related-object column values, and that will cause the appropriate foreign key
for the `belongs_to` relationship to be looked-up and included in the row:
$row = $event_rs->create({
event => "My event",
recur => { freq => "daily" },
});
Is it possible to perform a similar action when updating the row? For example,
something like this:
$row->update({
event => "My updated event",
recur => { freq => "weekly" },
});
The above fails because the update method is expecting a row object for the
relation, not a hashref. At the moment, I am performing a separate "find" to
locate the matching "recur" row, then using that in the "update" method:
$recur = $recurrence_rs->find({ freq => "weekly" });
$row->update({
event => "My updated event",
recur => $recur,
});
Many thanks,
Martin
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]