1 package Maypole::Model::CDBI::Plain;
2 use base 'Maypole::Model::CDBI';
4 Maypole::Config->mk_accessors(qw(table_to_class));
7 my ( $self, $config, $namespace, $classes ) = @_;
8 $config->{classes} = $classes;
9 $config->{table_to_class} = { map { $_->table => $_ } @$classes };
10 $config->{tables} = [ keys %{ $config->{table_to_class} } ];
14 my ( $self, $r, $table ) = @_;
15 return $r->config->{table_to_class}->{$table};
22 Maypole::Model::CDBI::Plain - Class::DBI model without ::Loader
27 use base 'Maypole::Application';
29 use Foo::Other::Table;
31 Foo->config->{model_class} = "Maypole::Model::CDBI::Plain";
32 Foo->setup([qw/ Foo::SomeTable Foo::Other::Table /]);
36 This module allows you to use Maypole with previously set-up
37 C<Class::DBI> classes; simply call C<setup> with a list reference
38 of the classes you're going to use, and Maypole will work out the
39 tables and set up the inheritance relationships as normal.
51 See L<Maypole::Model::Base>