Fix an obscure bug in the DBI exception handler, clobbering the exception contents...
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Relationship.pm
index 39c0d12..228499b 100644 (file)
@@ -31,9 +31,9 @@ DBIx::Class::Relationship - Inter-table relationships
   MyDB::Schema::Actor->many_to_many('roles' => 'actorroles', 'role');
 
   ## Using relationships
-  $schema->resultset('Actor')->roles();
-  $schema->resultset('Role')->search_related('actors', { Name => 'Fred' });
-  $schema->resultset('ActorRole')->add_to_roles({ Name => 'Sherlock Holmes'});
+  $schema->resultset('Actor')->find({ id => 1})->roles();
+  $schema->resultset('Role')->find({ id => 1 })->actorroles->search_related('actor', { Name => 'Fred' });
+  $schema->resultset('Actor')->add_to_roles({ Name => 'Sherlock Holmes'});
 
 See L<DBIx::Class::Manual::Cookbook> for more.
 
@@ -330,9 +330,12 @@ L<DBIx::Class::Relationship::Base/"create_related">.
 
 If you delete an object in a class with a C<has_many> relationship, all
 the related objects will be deleted as well.  To turn this behaviour off,
-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.
+pass C<< cascade_delete => 0 >> in the C<$attr> hashref.
+
+The cascaded operations are performed after the requested delete or
+update, so if your database has a constraint on the relationship, it
+will have deleted/updated the related records or raised an exception
+before DBIx::Class gets to perform the cascaded operation.
 
 If you copy an object in a class with a C<has_many> relationship, all
 the related objects will be copied as well. To turn this behaviour off,
@@ -383,7 +386,7 @@ OR
 =item cond
 
 A hashref where the keys are C<foreign.$column_on_related_table> and
-the values are C<self.$foreign_key_column>. This is useful for
+the values are C<self.$matching_column>. This is useful for
 relations that are across multiple columns.
 
 =back
@@ -414,8 +417,12 @@ relations that are across multiple columns.
 If you update or delete an object in a class with a C<might_have>
 relationship, the related object will be updated or deleted as well. To
 turn off this behavior, add C<< cascade_delete => 0 >> to the C<$attr>
-hashref. Any database-level update or delete constraints will override
-this behavior.
+hashref.
+
+The cascaded operations are performed after the requested delete or
+update, so if your database has a constraint on the relationship, it
+will have deleted/updated the related records or raised an exception
+before DBIx::Class gets to perform the cascaded operation.
 
 See L<DBIx::Class::Relationship::Base> for documentation on relationship
 methods and valid relationship attributes.
@@ -461,7 +468,7 @@ OR
 =item cond
 
 A hashref where the keys are C<foreign.$column_on_related_table> and
-the values are C<self.$foreign_key_column>. This is useful for
+the values are C<self.$matching_column>. This is useful for
 relations that are across multiple columns.
 
 =back