[Maypole] Help with M::M::CDBI::Plain (finish is in sight!)
Jesse Sheidlower
jester@panix.com
Sat, 17 Jul 2004 15:54:25 -0400
On Sat, Jul 17, 2004 at 02:14:53PM +0100, Simon Cozens wrote:
> Jesse Sheidlower:
>
> > [Sat Jul 17 08:54:00 2004] [error] Invalid CODE attribute:
> > Exported at /usr/local/www/modules/sfDB/Citation.pm line 18
>
> What this means is that your sfDB::Citation model doesn't correctly
> inherit from one of the Maypole model classes.
[...]
> So there is the better way to do it, which is the one that Maypole
> usually uses; this is to ensure that you set up your model class and call
> "setup" *before* loading the individual table class. As part of "setup"
> Maypole ensures that your table classes inherit from the correct model class.
The problem I get with wrapping the setup stuff in a BEGIN
block is:
[error] Can't locate object method "table" via package
"sfDB::Citation" (perhaps you forgot to load
"sfDB::Citation"?) at
/usr/local/lib/perl5/site_perl/5.8.4/Maypole/Model/CDBI/Plain.pm
line 6
Perhaps the problem with the order of loading can be solved
simply by moving the "use sfDB::Citation" etc. statements
_after_ the
sfDB->config->{model} = "Maypole::Model::CDBI::Plain";
sfDB->setup([qw/sfDB::Citation sfDB::CitationSubject sfDB::Subject/]);
lines (but _without_ wrapping these in a BEGIN block)? I also fixed a
problem that caused another error (I, er, forget the set_up_table
call in my derived classes).
This seems to fix order-of-loading issues. There is one
remaining error, though, that I have no idea the source of:
[Sat Jul 17 15:31:54 2004] [error] No such column: model_class
That's the entire error. Needless to say, I have no model_class
column in any of my tables, and nothing _I_ am doing is trying to
look at such a column, so I fear it must be coming from somewhere
in Maypole.
> I'm afraid I'm a bit tired of trying to make this particular example work
> after several rounds of email about it :) so I just suggest you play with the
> order of loading until it works.
Yes, that's why I took this one to the list, where it remains,
in the hopes that someone other than you might have had luck
with it ;-). I do think that this is not quite as simple as
you think it is, though.
Best,
Jesse Sheidlower