1Class::DBI::Cascade::NoUnsee(r3)Contributed Perl DocumenCtlaatsiso:n:DBI::Cascade::None(3)
2
3
4
6 Class::DBI::Cascade::None - Do nothing upon deletion
7
9 This is a Cascading Delete strategy that will do nothing, leaving
10 orphaned records behind.
11
12 It is the base class for most ofther Cascade strategies, and so
13 provides several important methods:
14
16 new
17 my $strategy = Cascade::Class->new($Relationship);
18
19 This must be instantiated with a Class::DBI::Relationship object.
20
22 foreign_for
23 my $iterator = $strategy->foreign_for($obj);
24
25 This will return all the objects which are foreign to $obj across the
26 relationship. It's a normal Class::DBI search you can get the results
27 either as a list or as an iterator.
28
29 cascade
30 $strategy->cascade($obj);
31
32 Cascade across the related objects to $obj.
33
35 Creating a Cascade strategy should be fairly simple. You usually just
36 need to inherit from here, and then supply a cascade() method that does
37 the required thing with the results from foreign_for().
38
39 So, for example, Cascade::Delete is implemented simply as:
40
41 package Class::DBI::Cascade::Delete;
42
43 use base 'Class::DBI::Cascade::None';
44
45 sub cascade {
46 my ($self, $obj) = @_;
47 $self->foreign_for($obj)->delete_all;
48 }
49
50
51
52perl v5.30.1 2020-01-29 Class::DBI::Cascade::None(3)