what is wrong in this association ? I can't get the recursive Relation
running.
I need the location name for routing the image.
It should be stored in. But is doesn'exists.
$data[Picture][Gallery][Location][location_name]
Here is the code:
<?php
class Gallery extends AppModel {
var $name = 'Gallery';
var $belongsTo = array('Location' => array('className' =>
'Location','foreignKey' => 'location_id'));
var $hasMany = array('Pictures' => array('className' =>
'Picture','foreignKey' => 'gallery_id','dependent' => false));
}
class Location extends AppModel {
var $name = 'Location';
var $hasMany = array('Gallery' => array('className' =>
'Gallery','foreignKey' => 'location_id','dependent' => false));
}
class Picture extends AppModel {
var $name = 'Picture';
var $belongsTo = array(
'Gallery' => array('className' => 'Gallery','foreignKey' =>
'gallery_id'),
'User' => array('className' => 'User','foreignKey' => 'user_id')
);
}
#Controller Action:
$this->Picture->findbyid($id);
?>
Regards
Markus
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment