Alex Povolotsky <[EMAIL PROTECTED]> writes:

> First of all, $c->model('Model::Class') returns DBIx::ResultSet, NOT
> YourApp::Schema::Class. It is quite unclear for me, and seems to be
> illogical, but it is.

If you'd prefer to use things in a more "classic" DBIC style, you could
do something like:

  my $thingies = $c->model('MyAppDB')->resultset('Thingy');

It may trouble you, however, that in this style $c->model('MyAppDB')
masquerades as a DBIx::Class::Schema, when in fact it's a
Catalyst::Model::DBIC::Schema. So here's real classic DBIC:

  my $schema   = $c->model('MyAppDB')->schema;
  my $thingies = $schema->resultset('Thingy');

But that's very long to type, so Catalyst::Model::DBIC::Schema does some
magic that gives shortcuts to the resultset:

  my $thingies = $c->model('MyAppDB::Thingy');

As far as I am aware, there is no technical reason to use one style over
the others.  Pick the style that you like best and use it consistently
across your project. :-)

/rdj

_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to