Undefined property error, but relationships seem correct

I'm having a slight problem that I can't figure out, but should be really simple.

I have the following model structure:


ProspectiveQuote [hasMany] QuoteUnit [belongsTo] Unit

but in my ProspectiveQuotesController the line


$this->ProspectiveQuote->QuoteUnit->Unit->find('list');

gives me the following error:


Undefined property: AppModel::$Unit [APP\controllers\prospective_quotes_controller.php, line 59]

What could I be doing wrong?

Asked by deathau, on 13/7/10

1 Answer

Can you past please all you Models definition code ?

I suspect a singular/plural problem with the Unit Model

Answered by mehlahon 13/7/10

I fixed the problem. I didnt have a reference from Unit to QuoteUnit.

Once i added Unit [hasmany] QuoteUnit it worked.

deathau - on 13/7/10

<< comments | comments >>
<< previous next >>

Your Answer

You can use Creole Wiki Syntax to format your text.

Tagged with

Rating

0

Viewed

117 times

Last Activity

on 13/7/10