[Dbix-class] Emulating CDBI "temp" columns

Drew Taylor taylor.andrew.j at gmail.com
Fri Jul 21 17:42:39 CEST 2006


On 7/21/06, Christopher H. Laco <claco at chrislaco.com> wrote:
> Drew Taylor wrote:
> >
> > 2) I'm using DBIC w/ Catalyst, and thus am using C::P::DBIC::Schema
> > (latest version - no Loader). I'd like to have a base class common for
> > all my table objects (ie. a common toJSON() method), but can't figure
> > out how to do it in conjunction w/ the C::P::DBIC::Schema plugin.
>
> I'd suspect that it barfed because when the schema tried loading the
> result source classes, it tried loading My::Schema::BaseClass as it's
> own source, which it isn't.

I don't have the exact error message handy, so I can't say for sure,
but that sounds plausible.

> I assume you have a main schema file, something like My::Schema, that
> loads the My::Schema::User via load_classes()? By default, it will load
> all of the classes, including BaseClass.

Correct: I have:
__PACKAGE__->load_classes();
__PACKAGE__->connection(....);

> Try loading all the classes BUT My::Schema::BaseClass in your Schema and
> see if that fixes the issue under Model::DBIC::Schema/Catalyst.

So you're saying that once I get over the start-up problem, the normal
inheritance (via "use base Foo") will work like it always does? Is
there a load_classes() option to exclude certain classes?

Thanks,
Drew
-- 
----------------------------------------------------------------
 Drew Taylor                 *  Web development & consulting
 Email: drew at drewtaylor.com  *  Site implementation & hosting
 Web  : www.drewtaylor.com   *  perl/mod_perl/DBI/mysql/postgres
 ----------------------------------------------------------------



More information about the Dbix-class mailing list