Egg::Model::DBIC - Model for DBIx::Class.


Egg-Release-DBIC documentation  | view source Contained in the Egg-Release-DBIC distribution.

Index


NAME

Top

Egg::Model::DBIC - Model for DBIx::Class.

SYNOPSIS

Top

  my $schema= $e->model('dbic::myschema');

  # If the transaction is effective.
  $schema->storage->txn_begin;

  my $table= $schema->resultset('hoge_master');
     Or
  my $table= $e->model('dbic::myschema::hoge_master');

  $table->search( ... );

  # And.
  $schema->storage->txn_rollback;
     Or
  $schema->storage->txn_commit;

DESCRIPTION

Top

It is MODEL to use DBIx::Class.

A series of Schema module is generated by using the helper for use.

  % cd /path/to/MyApp/bin
  % ./myapp_helper.pl M::DBIC [SCHEMA_NAME] -d dbi:SQLite:dbname=dbfile -u user -p passwd

The name that can be used as Perl module name in the part of SCHEMA_NAME is passed.

The option to continue is not indispensable.

Details are Egg::Helper::Model::DBIC. Please drink and refer to the document.

And, 'DBIC' is added to the MODEL setting of the project.

  % vi /path/to/MyApp/lib/MyApp/config.pm
  ..........
  ...
  MODEL => ['DBIC'],

Using this model by this becomes possible.

When the object of Schema is acquired from the application, as follows is done.

  my $schema= $e->model('dbic::schema_name');

The object to which DBIx::Class::Schema is succeeded to by this can be received.

And, the object of the table does as follows.

  my $table = $e->model('dbic::schema_name::table_name');

  # If you have already acquired the Schema object.
  my $table = $schema->resultset('table_name');

The object to which DBIx::Class::ResultSet is succeeded to by this can be received.

SEE ALSO

Top

Egg::Release, Egg::Model, Egg::Model::DBIC::Base, Egg::Helper::Model::DBIC, DBIx::Class, DBIx::Class::Schema, DBIx::Class::ResultSet, UNIVERSAL::require,

AUTHOR

Top

Masatoshi Mizuno, <lushe&64;cpan.org>

COPYRIGHT AND LICENSE

Top


Egg-Release-DBIC documentation  | view source Contained in the Egg-Release-DBIC distribution.