[Catalyst] CDBI Plain not inheriting table and columns

Philip Edelbrock phil at edgedesign.us
Tue Aug 2 20:41:20 CEST 2005


(see below)

Jonathan Manning wrote:
> Matt S Trout wrote:
> 
>>What do you mean "Catalyst can't find the table" ??
>>
>>CatalystApp::M::Experiment->retrieve(...) for example should work fine.
>>
>>Paste some example code from your Controller classes to explain, please.
> 
> 
> I don't have much controller code yet because I can't get the basics to
> work. I tried the following:
> 
> sub view :Local {
>   my ($self, $c) = @_;
>   $c->stash->{table} = CatalystApp::M::Experiment->table; # debug
>   $c->stash->{item} = CatalystApp::M::Experiment->retrieve(1); ## dies!
>   # never gets here...
> }
> 
> This gives me:
> Catalyst error: Caught exception "Can't retrieve unless primary columns
> are defined at ./CBrowser/C/Experiments.pm line 110"
> 

Hey, I'm a newbie just figuring things out.  I ran into the same error 
during my playing, tho.

When you used the create script to make the models, it should have 
created some pm's in M/Experiment/ for each of your tables, right? 
Change your stash and retrieve to:

    $c->stash->{table} = CatalystApp::M::Experiment::MYTABLE->table;
    $c->stash->{item} = CatalystApp::M::Experiment::MYTABLE->retrieve(1);

With MYTABLE being the name of one of the pm's in Experiment/.

I hope this helps!


Phil



More information about the Catalyst mailing list