Rose::DBx::Object::MoreHelpers(3)

NAME
Rose::DBx::Object::MoreHelpers - more mixin helpers for RDBO

SYNOPSIS
 package MyRDBO;
 use base qw( Rose::DB::Object );
 use Rose::DBx::Object::MoreHelpers;

DESCRIPTION
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.

METHODS
MoreHelpers changes the default relationship method makers to include:

 find
 get_set_on_save
 add_on_save
 count
 iterator

  primary_key_uri_escaped
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.

  primary_key_value
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.

  unique_value
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().

  moniker
Returns the name of the class without any leading namespace qualifier. Similar to the DBIx::Class concept of 'moniker'.

  flatten( args )
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.

  exists( [ @params ] )
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.

Example:

 # '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.

  has_related( relationship_name )
Returns the number of related objects defined by the relationship_name accessor.

Just a wrapper around the count RDBO method type.

  has_related_pages( relationship_name, page_size )
Returns the number of "pages" given page_size for the count of related objects for relationship_name. Useful for creating pagers.

  fetch_all
Shortcut for the Manager method get_objects().

  fetch_all_iterator
Shortcut for the Manager method get_objects_iterator().

  fetch_count
Shortcut for the Manager method get_objects_count().

  column_is_boolean( column_name )
Returns true if the column type for column_name is 'boolean'.

AUTHOR
Peter Karman, "<karman at cpan.org>"

BUGS
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.

SUPPORT
You can find documentation for this module with the perldoc command.

    perldoc Rose::DBx::Object::MoreHelpers

You can also look for information at:

•   AnnoCPAN: Annotated CPAN documentation

    <http://annocpan.org/dist/Rose-DBx-Object-MoreHelpers>

•   CPAN Ratings

    <http://cpanratings.perl.org/d/Rose-DBx-Object-MoreHelpers>

•   RT: CPAN's request tracker

    <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Rose-DBx-Object-MoreHelpers>

•   Search CPAN

    <http://search.cpan.org/dist/Rose-DBx-Object-MoreHelpers>

ACKNOWLEDGEMENTS
The Minnesota Supercomputing Institute "http://www.msi.umn.edu/" sponsored the development of this software.

COPYRIGHT & LICENSE
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.