[Catalyst] Catalyst model, again

Matt S Trout dbix-class at trout.me.uk
Thu Jan 12 20:31:50 CET 2006


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 :)

-- 
     Matt S Trout       Offering custom development, consultancy and support
  Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list