Rechercher une page de manuel
Maypole::Model::CDBI.3pm
Langue: en
Version: 2007-05-18 (fedora - 01/12/10)
Section: 3 (Bibliothèques de fonctions)
Sommaire
NAME
Maypole::Model::CDBI - Model class based on Class::DBIDESCRIPTION
This is a master model class which uses Class::DBI to do all the hard work of fetching rows and representing them as objects. It is a good model to copy if you're replacing it with other database abstraction modules.It implements a base set of methods required for a Maypole Data Model.
It inherits accessor and helper methods from Maypole::Model::Base.
When specified as the application model, it will use Class::DBI::Loader to generate the model classes from the provided database. If you do not wish to use this functionality, use Maypole::Model::CDBI::Plain which will instead use Class::DBI classes provided.
Untainter
Set the class you use to untaint and validate form data Note it must be of type CGI::Untaint::Maypole (takes $r arg) or CGI::Untaintadd_model_superclass
Adds model as superclass to model classes (if necessary)Inherited from Maypole::Model::CDBI::Base
Action Methods
Action methods are methods that are accessed through web (or other public) interface.Inherited from Maypole::Model::CDBI::Base
do_edit
If there is an object in "$r->objects", then it should be edited with the parameters in "$r->params"; otherwise, a new object should be created with those parameters, and put back into "$r->objects". The template should be changed to "view", or "edit" if there were any errors. A hash of errors will be passed to the template.do_delete
Inherited from Maypole::Model::CDBI::Base.This action deletes records
do_search
Inherited from Maypole::Model::CDBI::Base.This action method searches for database records.
list
Inherited from Maypole::Model::CDBI::Base.The "list" method fills "$r->objects" with all of the objects in the class. The results are paged using a pager.
Helper Methods
setup
This method is inherited from Maypole::Model::Base and calls setup_database, which uses Class::DBI::Loader to create and load Class::DBI classes from the given database schema.
setup_database
The $opts argument is a hashref of options. The ``options'' key is a hashref of Database connection options . Other keys may be various Loader arguments or flags. It has this form:{
# DB connection options
options { AutoCommit => 1 , ... },
# Loader args
relationships => 1,
...
}
class_of
returns class for given table
SEE ALSO
Maypole, Maypole::Model::CDBI::Base.AUTHOR
Maypole is currently maintained by Aaron Trevena.AUTHOR EMERITUS
Simon Cozens, "simon#cpan.org"Simon Flack maintained Maypole from 2.05 to 2.09
Sebastian Riedel, "sri#oook.de" maintained Maypole from 1.99_01 to 2.04
LICENSE
You may distribute this code under the same terms as Perl itself.Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre