[Dbix-class] Catalyst::Model::DBIC::Schema patch for overloading connection.

Jesper Krogh jesper at krogh.cc
Mon May 1 17:38:34 CEST 2006


> The cleanest approach, IMHO, would probably be to subclass your
> DBIx::Class::Schema class and override the connection() method there,
> and then use it as normal in the model class:
>
> package MyApp::Schema; ... normal schema setup ...
>
>
> package MyApp::SchemaForTheWeb; use base qw/MyApp::Schema/; sub connection
> {
> ... override as per wiki, roughly ...
> }
>
>
> package MyApp::Model::WebSchema; __PACKAGE__->config(
> schema_class => 'MyApp::SchemaForTheWeb'; );

This id absolutely my preferred way to do it. .. I had just overrideen
->connect in stead of ->connection and thus it didnt work from
Catalyst::Model::DBIC::Schema since it uses ->connection.

Thanks a lot.

Jesper

-- 
Jesper Krogh




More information about the Dbix-class mailing list