|
NAMEGantry::Utils::DBIxClass - a DBIx::Class subclass models can inherit fromSYNOPSISpackage YourModel; use base 'Gantry::Utils::DBIxClass'; # standard DBIx::Class table definition __PACKAGE__->sequence_name( 'your_seq' ); __PACKAGE__->base_model( 'Your::Schema' ); DESCRIPTIONBy inheriting from this module instead of from DBIx::Class directly, you gain additional helper methods which various parts of Gantry use.METHODS
In addition to the above methods, this base class provides the following convenience accessors to save typing. For example, instead of typing: my $schema = $self->get_schema(); my @rows = $schema->resultset( 'table_name' )->search( { ... }, { ... } ); These methods let you say: my @rows => $TABLE_NAME->gsearch( $self, { ... }, { ... } );
For these methods to work, the invoking controller must use Gantry::Plugins::DBIxClassConn. It handles dbic connections and exports get_schema which all of the g methods call. Alternatively, if you are in a script, you may use other similar methods: my $schema = AddressBook::Model->connect( $conf->{ dbconn }, $conf->{ dbuser }, $conf->{ dbpass }, ); my @rows => $TABLE_NAME->ssearch( $schema, ... ); These methods expect a valid dbic schema as their first argument. The available s* methods are:
Other helper methods:
AUTHORPhil Crow <philcrow2000@yahoo.com>COPYRIGHT and LICENSECopyright (c) 2006, Phil CrowThis library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.
Visit the GSP FreeBSD Man Page Interface. |