[Catalyst] Accessing $schema in Model glue class (solved?)

Tobias Kremer list at funkreich.de
Thu Jan 24 16:31:59 GMT 2008


Quoting Tobias Kremer <list at funkreich.de>:
> Realizing that MyApp::Model::Schema is already just a subclass of
> C::M::DBIC::Schema (doh!) I came up with the following solution that just
> overrides new():

Hmmm ... Could somebody take a look at the following version I came up with
and tell me if using Urbia2->cache (from Catalyst::Plugin::Cache::Memcached)
in this context is okay:

# in MyApp::Model::Schema (which ISA Catalyst::Model::DBIC::Schema)
sub new {
  my $self = shift->NEXT::new(@_);
  $self->schema->default_resultset_attributes( {
    cache_object => Urbia2->cache
  } );
  return $self;
}

Thanks a lot and sorry for braindumping to the list :)

--Tobias



More information about the Catalyst mailing list