[EMAIL PROTECTED] wrote:
> Use the associations. Then you can return it with
> $data['Importance']['importance'].
>
> I would imagine this could be quickly accomplished with a belongsTo
> association.
>
> http://manual.cakephp.org/chapter/models
Thanks for your response.I know this should be simple and I feel dumb
because I can't get it to work. In my importance.php model I added:
var $belongsTo = array('Item' =>
array('className' => 'Item',
'conditions' => '',
'order' => '',
'foreignKey' => 'importances_id'
)
);
I already had this in my Item.php model:
var $hasMany = array('Importance' =>
array('className' => 'Importance',
'conditions' => '',
'order' => '',
'dependent' => true,
'foreignKey' => 'importances_id'
)
);
After adding the belongsTo in my importance model and
$data['Importance']['importance'] in my view.thtml I get this error:
Notice: Undefined index: importance in
N:\www\cake\app\views\items\view.thtml on line 5
What am I doing wrong?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---