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 )], related_load_with => { bars => ['doof'] }, 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.
The value of load_with should be an array ref of relationship names. The array ref is passed into all the Manager get_objects* methods as the with_objects value.
load_with
with_objects
Similar to load_with, but the with_objects argument is passed in all the *_related methods. The related_load_with value should be a hash ref with keys using relationships names and the values being array refs of relationship names in the foreign (related) classes.
related_load_with
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.
Implements required method. Returns array or array ref based on calling context, for objects related to obj via relationship. relationship should be a method name callable on obj.
Like search_related() but returns an iterator.
Like search_related() but returns an integer.
Implements required method. Returns array or array ref based on calling context, for objects related to obj via relationship that match foreign_value. relationship should be a method name callable on obj.
Associate foreign object identified by foreign_value with obj via the relationship rel_name.
CAUTION: For many-to-many relationships only.
Dissociate foreign object identified by foreign_value from obj via the relationship rel_name.
Returns the Rose::DB::Object::Metadata::Relationship instance for rel_name if it exists, or undef if it does not.
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.
See CatalystX::CRUD::Model::Utils::make_sql_query() for API details.
Returns hash ref of all column names that return type =~ m/^date(time)$/. This is so that wildcard searches for date and datetime-based columns will get proper SQL rendering.
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.