[Catalyst] Catalyst model, again
Sean Davis
sdavis2 at mail.nih.gov
Thu Jan 12 22:29:09 CET 2006
On 1/12/06 2:31 PM, "Matt S Trout" <dbix-class at trout.me.uk> wrote:
> On Thu, Jan 12, 2006 at 12:50:45PM -0500, Sean Davis wrote:
>> I have the following classes and ApacheAdmin::Model::DB is just for
>> connecting to the database--nothing unusual there. With the test script at
>> the bottom, I get the following error:
>>
>> Cannot load ApacheAdmin::Model::User without a primary key (username) with a
>> non-null value or another unique key with at least one non-null value. at
>> test.pl line 9
>>
>> If I remove the inheritance from Catalyst::Model, everything works fine.
>> It's not too big a deal in practice--I don't NEED the catalyst::model
>> inheritance--but I'm curious why this doesn't work.
>
> Inheriting from Catalyst::Model makes your class a Catalyst component class.
>
> So Catalyst tries to call 'new' on it during setup.
>
> Given in this case an object of your model isa user, not a Catalyst component,
> not inheriting from something that indicates it as such works :)
Thanks for the clarification.
Sean
More information about the Catalyst
mailing list