[Catalyst] Creating Good Adaptor or Bridge Models (WAS: Creating a thin Model)

Matt S Trout dbix-class at trout.me.uk
Sat Jun 9 16:08:47 GMT 2007


On Sat, Jun 09, 2007 at 01:26:20PM +0000, Zbigniew Lukasiak wrote:
> On 5/23/07, Matt S Trout <dbix-class at trout.me.uk> wrote:
> >
> >Maybe something more like
> >
> >setup_components:
> >  Model::ModelName:
> >    class: Catalyst::Model::DBIC::Schema
> >    instantiate:
> >      schema_class: My::Schema
> >      connect_info: ....
> >
> >?
> 
> I would change it to:
> 
> setup_components:
> ModelName:
>   type: model
>   class: Catalyst::Model::DBIC::Schema
>   instantiate:
>     schema_class: My::Schema
>     connect_info: ....
> 
> to get rid of the Model => model mapping.

But then you'd need special case syntax to declare two types of cntroller
of the same name somewhere. Ick.

And it wouldn't be consistent with the rest of the config style anymore.

> I not sure how this would work with the old style of config without
> the setup_components subdir (using the Model::ModelName directly in
> the config hash):
> 
> MyApp->config(
>               name     => 'MyApp',
>               root     => MyApp->path_to('root');,
>               'Model::DBIC::Schema' => {
> 
> but I understand that the setup_components way is now the recommended one.

Huh?

That would still work. The idea is the extension syntax I'm describing would
replace the ModelName.pm file so provide instantiation defaults etc., then
the 'Model::ModelName' config entry would override those as usual.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 



More information about the Catalyst mailing list