[Catalyst] Accessing $schema in Model glue class

Tobias Kremer list at funkreich.de
Thu Jan 24 13:14:12 GMT 2008


Like many, I have a MyApp::Model::Schema class that uses
Catalyst::Model::DBIC::Schema as glue between my
Catalyst app and my DBIx::Class model.

AFAICT, MyApp::Model::Schema class would be a good place to issue a
$schema->default_resultset_attributes( { cache_object ... } ) call
which is needed by DBIx::Class::Cursor::Cached. Is there an easy way to
access $schema from within MyApp::Model::Schema?

I suppose $c is not available when MyApp::Model::Schema is set up, is it?
I'm using Catalyst::Plugin::Cache::Memcached which already provides a
cache() method that would be perfect to set as cache_object ... So what I
basically want to do is add something like this to MyApp::Model::Schema

$schema->default_resultset_attributes( { cache_object => $c->cache } );

Any ideas?

--Tobias



More information about the Catalyst mailing list