[Dbix-class] Emulating CDBI "temp" columns

Christopher H. Laco claco at chrislaco.com
Fri Jul 21 17:05:06 CEST 2006


Drew Taylor wrote:
> Hi,
> We just switched from CDBI to DBIC (.06999_07) for a webapp project
> and I have a couple questions:
> 
> 1) For one of the classes, I want the equivalent of CDBI's TEMP
> columns or some other sort of bucket to place temporary data that will
> never hit the database. I see that DBIx::Class uses
> Class::Data::Accessor - but it appears to be class (not
> object)-oriented.
> 
> 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.
> 
> At first I just tried having My::Schema::User inherit directly from
> My::Schema::BaseClass, but that makes DBIC barf on Catalyst startup.
> After poking around in the docs, it seems that
> $schema->compose_namespace() will do what I want but I have no idea
> how to work this within the DBIC 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 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.

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

-=Chris

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.rawmode.org/pipermail/dbix-class/attachments/20060721/b58d4625/attachment.pgp 


More information about the Dbix-class mailing list