CatalystX::CRUD::Model::RDBO - Rose::DB::Object CRUD
package MyApp::Model::Foo; use base qw( CatalystX::CRUD::Model::RDBO ); __PACKAGE__->config( name => 'My::RDBO::Foo', manager => 'My::RDBO::Foo::Manager', load_with => [qw( bar )], page_size => 50, ); 1;
CatalystX::CRUD::Model::RDBO is a CatalystX::CRUD implementation for Rose::DB::Object.
The config options can be set as in the SYNOPSIS example.
The name of the Rose::DB::Object-based class that the model represents. Accessible via name() or config->{name}.
If manager is not defined in config(), the Xsetup() method will attempt to load a class named with the name value from config() with ::Manager appended. This assumes the namespace convention of Rose::DB::Object::Manager.
manager
name
::Manager
If there is no such module in your @INC path, then the fall-back default is Rose::DB::Object::Manager.
Implements the required Xsetup() method. Instatiates the model's name() and manager() values based on config().
Returns a CatalystX::CRUD::Object::RDBO object.
If present, @params is passed directly to name()'s new() method, and is expected to be an array of key/value pairs. Then the load() method is called on the resulting object.
If @params are not present, the new() object is simply returned, which is equivalent to calling new_object().
All the methods called within fetch() are wrapped in an eval() and sanity checked afterwards. If there are any errors, throw_error() is called.
Example:
my $foo = $c->model('Foo')->fetch( id => 1234 ); if (@{ $c->error }) { # do something to deal with the error }
NOTE: If the object's presence in the database is questionable, your controller code may want to use new_object() and then call load_speculative() yourself. Example:
my $foo = $c->model('Foo')->new_object( id => 1234 ); $foo->load_speculative; if ($foo->not_found) { # do something }
@params is passed directly to the Manager get_objects() method. See the Rose::DB::Object::Manager documentation.
Returns an array or array ref (based on wantarray) of CatalystX::CRUD::Object::RDBO objects.
@params is passed directly to the Manager get_objects_count() method. See the Rose::DB::Object::Manager documentation.
Returns an integer.
@params is passed directly to the Manager get_objects_iterator() method. See the Rose::DB::Object::Manager documentation.
Returns a CatalystX::CRUD::Iterator object whose next() method will return a CatalystX::CRUD::Object::RDBO object.
Implement a RDBO-specific query factory based on request parameters. Return value can be passed directly to search(), iterator() or count() as documented in the CatalystX::CRUD::Model API.
field_names should be an array of valid form field names.
The following reserved request param names are implemented:
Sort order. Should be a SQL-friendly string parse-able by Sort::SQL.
For the Data::Pageset pager object. Defaults to page_size(). An upper limit of 200 is implemented by default to reduce the risk of a user [unwittingly] creating a denial of service situation.
What page the current request is coming from. Used to set the offset value in the query. Defaults to 1.
1
Peter Karman, <karman at cpan.org>
<karman at cpan.org>
Please report any bugs or feature requests to bug-catalystx-crud-model-rdbo at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CatalystX-CRUD-Model-RDBO. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-catalystx-crud-model-rdbo at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc CatalystX::CRUD::Model::RDBO
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/CatalystX-CRUD-Model-RDBO
CPAN Ratings
http://cpanratings.perl.org/d/CatalystX-CRUD-Model-RDBO
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=CatalystX-CRUD-Model-RDBO
Search CPAN
http://search.cpan.org/dist/CatalystX-CRUD-Model-RDBO
This module is based on Catalyst::Model::RDBO by the same author.
Copyright 2007 Peter Karman, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install CatalystX::CRUD::Model::RDBO, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CatalystX::CRUD::Model::RDBO
CPAN shell
perl -MCPAN -e shell install CatalystX::CRUD::Model::RDBO
For more information on module installation, please visit the detailed CPAN module installation guide.