Rose::DBx::Object::MoreHelpers - more mixin helpers for RDBO
use base qw( Rose::DB::Object );
In the tradition of Rose::DB::Object::Helpers, more importable methods.
This class inherits from Rose::Object::MixIn. See the Rose::Object::MixIn documentation for a full explanation of how to import methods from this class. The helper methods themselves are described below.
MoreHelpers changes the default relationship method makers to include:
Returns the primary key value, URI-escaped. If there are multiple columns comprising the primary key, they are joined into a single string.
If there are no values set for any of the column(s) comprising the primary key, returns 0.
Otherwise, returns all column values joined with ;; as per CatalystX::CRUD::Controller API.
Returns the value of the primary key column(s). If the value is comprised of multiple column values, the return value will be an array ref of values.
Returns the first single-column unique value from the object by default. This is intended for the common case where you use a serial integer as the primary key but want to display a more human-friendly value programmatically, like a name.
If no unique single-column values are found, returns the primary_key_value().
Returns the name of the class without any leading namespace qualifier. Similar to the DBIx::Class concept of 'moniker'.
Returns the serialized object and its immediately related objects.
As of version 0.03, this is just a wrapper around the as_tree() Helper method with the "force_load" arg set to true. args are passed directly to the as_tree() method.
Requires RDBO 0.7712 or later.
Returns true if the object exists in the database, false otherwise.
May be called as class or object method.
This method uses the Rose::DB::Object::Manager class to check the database based on non-unique column(s). Call it like you would load_speculative() but when you do not have a unique combination of columns (which all the load* methods require).
When called as object method, if @params is omitted, the current column values of the object are used.
# 'title' has no unique constraints on it
my $object = Object->new(title => 'Foo');
$object->save unless $object->exists;
NOTE: Using exists() as a way of enforcing data integrity is far inferior to actually placing a constraint on a table in the database. However, for things like testing and development data, it can be a useful utility method.
Returns the number of related objects defined by the relationship_name accessor.
Just a wrapper around the count RDBO method type.
Returns the number of "pages" given page_size for the count of related objects for relationship_name. Useful for creating pagers.
Shortcut for the Manager method get_objects().
Shortcut for the Manager method get_objects_iterator().
Shortcut for the Manager method get_objects_count().
Returns true if the column type for column_name is 'boolean'.
Peter Karman, <karman at cpan.org>
<karman at cpan.org>
Please report any bugs or feature requests to bug-rose-dbx-object-morehelpers at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Rose-DBx-Object-MoreHelpers. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-rose-dbx-object-morehelpers at rt.cpan.org
You can find documentation for this module with the perldoc command.
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
RT: CPAN's request tracker
The Minnesota Supercomputing Institute http://www.msi.umn.edu/ sponsored the development of this software.
Copyright 2008 by the Regents of the University of Minnesota.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Rose::DBx::Object::MoreHelpers, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.