X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FMaypole%2FModel%2FBase.pm;h=580e6e1c942cb7cbfd3be63dae9f1cd4c6a74590;hb=24259799350483f32219fd3755e0bed54f909c54;hp=ea1632a8cce0436c7d4c669604d788cc72bbea3b;hpb=ef3da5818c452a331e863d30efc41f5b65d0f624;p=maypole.git diff --git a/lib/Maypole/Model/Base.pm b/lib/Maypole/Model/Base.pm index ea1632a..580e6e1 100644 --- a/lib/Maypole/Model/Base.pm +++ b/lib/Maypole/Model/Base.pm @@ -15,12 +15,7 @@ sub process { return if $r->{template}; # Authentication has set this, we're done. $r->{template} = $method; - $r->objects( [] ); - my $obj = $class->retrieve( $r->{args}->[0] ); - if ($obj) { - $r->objects( [$obj] ); - shift @{ $r->{args} }; - } + $r->objects([ $class->fetch_objects($r) ]); $class->$method( $r, $obj, @{ $r->{args} } ); } @@ -68,9 +63,9 @@ C. This maps between a table name and its associated class. -=head2 retrieve +=head2 fetch_objects -This turns an ID into an object of the appropriate class. +This method should populate $r->objects from $r->{args}. =head2 adopt @@ -90,6 +85,7 @@ This is the name of the table. sub class_of { die "This is an abstract method" } sub setup_database { die "This is an abstract method" } +sub fetch_objects { die "This is an abstract method" } =head2 Commands @@ -107,7 +103,6 @@ errors. A hash of errors will be passed to the template. sub do_edit { die "This is an abstract method" } - =item list The C method should fill C<< $r-> objects >> with all of the @@ -127,7 +122,6 @@ Empty Action. =cut - sub list : Exported { die "This is an abstract method"; }