|
NAMERose::DBx::Object::MoreHelpers - more mixin helpers for RDBOSYNOPSISpackage MyRDBO; use base qw( Rose::DB::Object ); use Rose::DBx::Object::MoreHelpers; DESCRIPTIONIn 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. METHODSMoreHelpers changes the default relationship method makers to include:find get_set_on_save add_on_save count iterator primary_key_uri_escapedReturns 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_valueReturns 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_valueReturns 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(). monikerReturns 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_allShortcut for the Manager method get_objects().fetch_all_iteratorShortcut for the Manager method get_objects_iterator().fetch_countShortcut for the Manager method get_objects_count().column_is_boolean( column_name )Returns true if the column type for column_name is 'boolean'.AUTHORPeter Karman, "<karman at cpan.org>"BUGSPlease 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.SUPPORTYou can find documentation for this module with the perldoc command.perldoc Rose::DBx::Object::MoreHelpers You can also look for information at:
ACKNOWLEDGEMENTSThe Minnesota Supercomputing Institute "http://www.msi.umn.edu/" sponsored the development of this software.COPYRIGHT & LICENSECopyright 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.
Visit the GSP FreeBSD Man Page Interface. |