1Class::DBI::Cascade::NoUnsee(r3)Contributed Perl DocumenCtlaatsiso:n:DBI::Cascade::None(3)
2
3
4

NAME

6       Class::DBI::Cascade::None - Do nothing upon deletion
7

DESCRIPTION

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 pro‐
13       vides several important methods:
14

CONSTRUCTOR

16       new
17
18               my $strategy = Cascade::Class->new($Relationship);
19
20       This must be instantiated with a Class::DBI::Relationship object.
21

METHODS

23       foreign_for
24
25               my $iterator = $strategy->foreign_for($obj);
26
27       This will return all the objects which are foreign to $obj across the
28       relationship. It's a normal Class::DBI search you can get the results
29       either as a list or as an iterator.
30
31       cascade
32
33               $strategy->cascade($obj);
34
35       Cascade across the related objects to $obj.
36

WRITING NEW STRATEGIES

38       Creating a Cascade strategy should be fairly simple. You usually just
39       need to inherit from here, and then supply a cascade() method that does
40       the required thing with the results from foreign_for().
41
42       So, for example, Cascade::Delete is implemented simply as:
43
44               package Class::DBI::Cascade::Delete;
45
46               use base 'Class::DBI::Cascade::None';
47
48               sub cascade {
49                       my ($self, $obj) = @_;
50                       $self->foreign_for($obj)->delete_all;
51               }
52
53
54
55perl v5.8.8                       2006-11-05      Class::DBI::Cascade::None(3)
Impressum