Re: First Attempt

[prev] [thread] [next] [Date index for 2005/01/29]

From: Drew Taylor
Subject: Re: First Attempt
Date: 14:44 on 29 Jan 2005
On Fri, 28 Jan 2005 20:29:11 +0000 (GMT), cpryce@xxxxx.xxx
<cpryce@xxxxx.xxx> wrote:
> I'm trying to wrap my head around Class::DBI. I have the following simple database
> to store a resume. Each resume can have one or more areas of experise.
> 
> When I run the following script, I ger the error message:
>
> resume is not a column of MyDBI::Resume::Exper at /Library/Perl/5.8.1/Class/DBI/Relationship/HasMany.pm line 118
> package MyDBI::Resume;
> use base 'MyDBI::Resume::DBI';
> 
> __PACKAGE__->set_up_table('tblresume');
> 
> __PACKAGE__->has_many( 'expertise'  => 'MyDBI::Resume::Exper' );
> __PACKAGE__->has_many( 'education'  => 'MyDBI::Resume::Edu' );

Looks like you need the third parameter in the has_many() call. CDBI
looks at the foreign class (ie. 'MyDBI::Resume::Exper') for a has_a
definition. I'm guessing you don't have a has_a relationship defined
in M::R::Exper back to M::Resume. In this case, CDBI would use the
third parameter to has_many() to determine the linking column in
M::R::Exper. Since you don't have the 3rd parameter, CDBI guesses
(wrongly).

Drew
        -- 
        ----------------------------------------------------------------
 Drew Taylor                 *  Web development & consulting
 Email: drew@xxxxxxxxxx.xxx  *  Site implementation & hosting
 Web  : www.drewtaylor.com   *  perl/mod_perl/DBI/mysql/postgres
 ----------------------------------------------------------------

First Attempt
cpryce 20:29 on 28 Jan 2005

Re: First Attempt
Peter Speltz 20:58 on 28 Jan 2005

Re: First Attempt
Drew Taylor 14:44 on 29 Jan 2005

Re: First Attempt
Christopher Pryce 15:26 on 29 Jan 2005

Generated at 12:39 on 05 Feb 2005 by mariachi v0.52