Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

Inheriting from Catalyst::Model breaks Class::DBI accessors

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


heathkit at gmail

Jun 8, 2006, 3:13 PM

Post #1 of 3 (603 views)
Permalink
Inheriting from Catalyst::Model breaks Class::DBI accessors

For some reason, I can't make a model based around Class::DBI.

Unfortunately, I have to work with a custom database backend, so
there's no Class::DBI::Loader support, so Catalyst::Model::CDBI is
out.

I'd like to use Enzyme, but that depends on having instantiated model
objects in $c->components. Unfortunately, this rules
Catalyst::Model::CDBI::Plain out, since all the objects it creates are
Catalyst::Base.

For some reason, whenever I have a Class::DBI class inherit from
Catalyst::Model (or Catalyst::Base), the accessors no longer work.
So, I can use the model to search, but calls to get fields never make
their way down to Class:DBI.

Any ideas?

_______________________________________________
Catalyst mailing list
Catalyst [at] lists
http://lists.rawmode.org/mailman/listinfo/catalyst


blblack at gmail

Jun 8, 2006, 4:03 PM

Post #2 of 3 (550 views)
Permalink
Re: Inheriting from Catalyst::Model breaks Class::DBI accessors [In reply to]

On 6/8/06, Michael Giambalvo <heathkit [at] gmail> wrote:
> For some reason, I can't make a model based around Class::DBI.
>
> Unfortunately, I have to work with a custom database backend, so
> there's no Class::DBI::Loader support, so Catalyst::Model::CDBI is
> out.
>
> I'd like to use Enzyme, but that depends on having instantiated model
> objects in $c->components. Unfortunately, this rules
> Catalyst::Model::CDBI::Plain out, since all the objects it creates are
> Catalyst::Base.
>
> For some reason, whenever I have a Class::DBI class inherit from
> Catalyst::Model (or Catalyst::Base), the accessors no longer work.
> So, I can use the model to search, but calls to get fields never make
> their way down to Class:DBI.
>
> Any ideas?

Have you considered DBIx::Class + Catalyst::Model::DBIC::Schema?
Assuming you meant some non-so-standard DBD module when you said
"custom database backend", DBIx::Class::Schema::Loader will take a
good stab at loading it even without any explicit support.

-- Brandon

_______________________________________________
Catalyst mailing list
Catalyst [at] lists
http://lists.rawmode.org/mailman/listinfo/catalyst


mromani at ottotecnica

Jun 8, 2006, 11:20 PM

Post #3 of 3 (562 views)
Permalink
Re: Inheriting from Catalyst::Model breaks Class::DBI accessors [In reply to]

Michael Giambalvo ha scritto:
> For some reason, I can't make a model based around Class::DBI.
>
> Unfortunately, I have to work with a custom database backend, so
> there's no Class::DBI::Loader support, so Catalyst::Model::CDBI is
> out.
>
> I'd like to use Enzyme, but that depends on having instantiated model
> objects in $c->components. Unfortunately, this rules
> Catalyst::Model::CDBI::Plain out, since all the objects it creates are
> Catalyst::Base.
>
> For some reason, whenever I have a Class::DBI class inherit from
> Catalyst::Model (or Catalyst::Base), the accessors no longer work.
> So, I can use the model to search, but calls to get fields never make
> their way down to Class:DBI.
>
> Any ideas?

IME the C::DBI classes should not inherit directly from C::Base. My
usual setup is:

in MyApp::Model::CDBI;
use base 'Catalyst::Model::CDBI'; # or ::Plain

in MyApp::Model::CDBI::Products:
use base 'MyApp::Model::CDBI';

HTH

>
> _______________________________________________
> Catalyst mailing list
> Catalyst [at] lists
> http://lists.rawmode.org/mailman/listinfo/catalyst
>
>


--
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.com

_______________________________________________
Catalyst mailing list
Catalyst [at] lists
http://lists.rawmode.org/mailman/listinfo/catalyst

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.