Skip to content

Document cascade_ defaults for custom join conditions #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: maint/0.0828xx
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion lib/DBIx/Class/Relationship/Base.pm
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,10 @@ be copied too. To turn this behaviour off, pass C<< cascade_copy => 0 >>
in the C<$attr> hashref.

The behaviour defaults to C<< cascade_copy => 1 >> for C<has_many>
relationships.
relationships. If your C<$condition> is a coderef (see L</Custom join conditions>)
the default changes to C<< cascade_copy => 0 >>, and you need to
explicitly turn this feature on by passing C<< cascade_copy => 1 >>
in the C<$attr> hashref.

=item cascade_delete

Expand All @@ -392,6 +395,11 @@ C<has_one> and C<might_have> relationships. You can disable this
behaviour on a per-relationship basis by supplying
C<< cascade_delete => 0 >> in the relationship attributes.

If your C<$condition> is a coderef (see L</Custom join conditions>)
the default changes to C<< cascade_delete => 0 >>, and you need to
explicitly turn this feature on by passing C<< cascade_delete => 1 >>
in the C<$attr> hashref.

The cascaded operations are performed after the requested delete,
so if your database has a constraint on the relationship, it will
have deleted/updated the related records or raised an exception
Expand All @@ -404,6 +412,11 @@ C<might_have> relationships. You can disable this behaviour on a
per-relationship basis by supplying C<< cascade_update => 0 >> in
the relationship attributes.

If your C<$condition> is a coderef (see L</Custom join conditions>)
the default changes to C<< cascade_update => 0 >>, and you need to
explicitly turn this feature on by passing C<< cascade_update => 1 >>
in the C<$attr> hashref.

The C<belongs_to> relationship does not update across relationships
by default, so if you have a 'proxy' attribute on a belongs_to and want to
use 'update' on it, you must set C<< cascade_update => 1 >>.
Expand Down