Hello all,
I am new to cakephp and I am having trouble setting up the following
relationships for my photo blog.
Here are the relationships
Post: hasMany: array('Photo')
Photo: belongsTo: array('Post', 'Equipment')
Equipment: hasMany: array('Photo')
Essentially a post can have many pictures with it, each picture was
taken with a specific camera.
As far as the tables go, the photo table has a post_id, as well as
equipment_id.
Basically, I am trying to get the equipment that a photo belongs to
within the posts controller, does that make sense?
In my post's index view, I have the following code:
<?php foreach ($data as $post): ?>
<?php foreach($post['Photo'] as $photo):?>
?php echo $photo['Equipment']['name']; ?>
<?php endforeach; ?>
<?php endforeach; ?<>
I am getting the following php notice:
Notice (8): Undefined index: Equipment [APP\views\posts\index.ctp,
line 27]
Is there something special that needs to be done to make sure that the
equipment object pulled for each photo? In the cake log the equipment
table isn't being queried at all, I am thinking I need to explicitly
ask it to pull that data somewhere.
Any help is greatly appreciated. Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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?hl=en
-~----------~----~----~----~------~----~------~--~---