DBIx::Class::RDBOHelpers(3)

NAME
DBIx::Class::RDBOHelpers - DBIC compat with Rose::DBx::Object::MoreHelpers

SYNOPSIS
 package MyDB::Schema::Foo;
 use strict;

 use base 'DBIx::Class';

 __PACKAGE__->load_components(qw( RDBOHelpers Core ));
 # ... rest of schema setup here

DESCRIPTION
DBIx::Class::RDBOHelpers implements several methods with the same names as those in Rose::DBx::Object::MoreHelpers. This class helps ease compatability issues when using packages that expect these methods to exist, like Rose::HTMLx::Form::Related and CatalystX::CRUD::YUI. Most of these are convenience wrappers rather than implementing any new features.

METHODS

  has_related( rel_method_name )
Returns the number of related objects defined by the rel_method_name accessor. NOTE: If the relationship is a many-to-many, this must be the many-to-many method name, not the relationship name.

Just a wrapper around the count method.

Example:

 if (my $group_count = $user->has_related('groups')) {
     printf("user %s has %d related groups\n",
        $user->name, $group_count);
 }
 else {
     printf("User %s has no related groups\n",
        $user->name);
 }

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

  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, otherwise it will be a simple scalar.

  many_to_many( accessor_name, link_rel_name, foreign_rel_name [, attr] )
Overrides the base Relationship::ManyToMany method of the same name, in order to cache the name of the m2m method. Call it just like you would many_to_many() as documented in DBIx::Class::Relationship.

  relationship_info( rel_name )
Overrides base method of the same name. Returns hash ref of information about rel_name, with the addition of a "m2m" key if rel_name represents a many-to-many relationship.

  column_is_boolean( column_name )
Returns true if the column info for column_name indicates it is a boolean type.

Will return false if column_name is not a column or has no explicit data_type or if data_type is not 'boolean'.

  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_columns() values joined with by a single space.

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

BUGS
Please report any bugs or feature requests to "bug-dbix-class-rdbohelpers at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DBIx-Class-RDBOHelpers>. 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 DBIx::Class::RDBOHelpers

You can also look for information at:

•   AnnoCPAN: Annotated CPAN documentation

    <http://annocpan.org/dist/DBIx-Class-RDBOHelpers>

•   CPAN Ratings

    <http://cpanratings.perl.org/d/DBIx-Class-RDBOHelpers>

•   RT: CPAN's request tracker

    <http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBIx-Class-RDBOHelpers>

•   Search CPAN

    <http://search.cpan.org/dist/DBIx-Class-RDBOHelpers>

ACKNOWLEDGEMENTS
The many_to_many() code is based on DBIx::Class::IntrospectableM2M.

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