X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2FMaypole%2FModel%2FCDBI%2FPlain.pm;h=fd34a75c91d312bcb6437cca6c4dc6883d67e52d;hb=688f03716c8809f3e5cd1a2bf95276b3c45747cf;hp=7a36f68034bbe3b6104489a0dc2f8c6db465b366;hpb=432a630c59b57863c970edd60bac04f583dcd22c;p=maypole.git diff --git a/lib/Maypole/Model/CDBI/Plain.pm b/lib/Maypole/Model/CDBI/Plain.pm index 7a36f68..fd34a75 100644 --- a/lib/Maypole/Model/CDBI/Plain.pm +++ b/lib/Maypole/Model/CDBI/Plain.pm @@ -36,15 +36,10 @@ tables and set up the inheritance relationships as normal. This method loads the model classes for the application -=head1 SEE ALSO - -L - -L - =cut + sub setup_database { my ( $self, $config, $namespace, $classes ) = @_; $config->{classes} = $classes; @@ -54,11 +49,39 @@ sub setup_database { $config->{tables} = [ keys %{ $config->{table_to_class} } ]; } +=head2 class_of + + returns class for given table + +=cut + sub class_of { my ( $self, $r, $table ) = @_; return $r->config->{table_to_class}->{$table}; } +=head2 adopt + +This class method is passed the name of a model class that represensts a table +and allows the master model class to do any set-up required. + +=cut + +sub adopt { + my ( $self, $child ) = @_; + if ( my $col = $child->stringify_column ) { + $child->columns( Stringify => $col ); + } +} + +=head1 SEE ALSO + +L + +L + +=cut + 1;