From: Nigel Metheringham Date: Thu, 8 May 2008 13:21:33 +0000 (+0000) Subject: cascade_copy docs - takes from http://osdir.com/ml/lang.perl.modules.dbix-class/2007... X-Git-Tag: v0.08240~458 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f4e92c39e31f23c921d17a4e242c1ec9a1068a6e;p=dbsrgits%2FDBIx-Class.git cascade_copy docs - takes from osdir.com/ml/lang.perl.modules.dbix-class/2007-03/msg00106.html --- diff --git a/lib/DBIx/Class/Relationship.pm b/lib/DBIx/Class/Relationship.pm index 9edd7af..cd4b6cd 100644 --- a/lib/DBIx/Class/Relationship.pm +++ b/lib/DBIx/Class/Relationship.pm @@ -271,6 +271,11 @@ pass C<< cascade_delete => 0 >> in the C<$attr> hashref. However, any database-level cascade or restrict will take precedence over a DBIx-Class-based cascading delete. +If you copy an object in a class with a C relationship, all +the related objects will be copied as well. To turn this behaviour off, +pass C 0 > in the C<$attr> hashref. The behaviour +defaults to C 1>. + See L for documentation on relationship methods and valid relationship attributes. diff --git a/lib/DBIx/Class/Row.pm b/lib/DBIx/Class/Row.pm index 0ba7243..d2def31 100644 --- a/lib/DBIx/Class/Row.pm +++ b/lib/DBIx/Class/Row.pm @@ -547,7 +547,9 @@ sub set_inflated_columns { my $copy = $orig->copy({ change => $to, ... }); -Inserts a new row with the specified changes. +Inserts a new row with the specified changes. If the row has related +objects in a C then those objects may be copied too depending +on the C relationship attribute. =cut