]> git.decadent.org.uk Git - maypole.git/blobdiff - lib/Maypole/Model/Base.pm
Lots of documentation.
[maypole.git] / lib / Maypole / Model / Base.pm
index 908a2fca294a926e2f412c5daee3d2345479c9d7..c4c959f7c7c42a4c2b0b0ec933bc56242120b83b 100644 (file)
@@ -1,4 +1,4 @@
-package Apache::MVC::Model::Base;
+package Maypole::Model::Base;
 our %remember;
 sub MODIFY_CODE_ATTRIBUTES { $remember{$_[1]} = $_[2]; () }
 
@@ -15,7 +15,7 @@ sub process {
 
 =head1 NAME
 
-Apache::MVC::Model::Base - Base class for model classes
+Maypole::Model::Base - Base class for model classes
 
 =head1 DESCRIPTION
 
@@ -34,6 +34,25 @@ errors. A hash of errors will be passed to the template.
 
 sub do_edit { die "This is an abstract method" }
 
+=head2 setup_database
+
+    $model->setup_database($config, $namespace, @data)
+
+Uses the user-defined data in C<@data> to specify a database- for
+example, by passing in a DSN. The model class should open the database,
+and create a class for each table in the database. These classes will
+then be C<adopt>ed. It should also populate C<< $config->{tables} >> and
+C<< $config->{classes} >> with the names of the classes and tables
+respectively. The classes should be placed under the specified
+namespace. For instance, C<beer> should be mapped to the class
+C<BeerDB::Beer>.
+
+=head2 class_of
+
+    $model->class_of($r, $table)
+
+This maps between a table name and its associated class.
+
 =head2 retrieve
 
 This turns an ID into an object of the appropriate class.
@@ -71,11 +90,13 @@ similar.
 
 =cut
 
+sub class_of       { die "This is an abstract method" }
+sub setup_database { die "This is an abstract method" }
 sub list :Exported { die "This is an abstract method" };
 
 =pod
 
-Also, see the exported commands in C<Apache::MVC::Model::CDBI>.
+Also, see the exported commands in C<Maypole::Model::CDBI>.
 
 =head1 Other overrides