I have a pretty simple pair of objects, Photo and Album, defined as follows:

> class Album extends Model {
>     public $name = 'Album';
>
> public $hasMany = array(
> 'Photo' => array(
> 'className'     => 'Photo',
> 'order'     => 'Photo.order ASC'
> )
> );
> }

 

>
class Photo extends Model {
>     public $name = 'Photo';
>     public $belongsTo = array('Album');
> }


I currently have 3 albums, one with 0 photos, one with 1 photo, and one 
with 2 photos.  When I do the following in the controller, I expect to get 
3 albums back:

$albumlist = $this->Album->find('all');
> debug($albumlist);


But in fact, I get 4 - the one with 2 photos is shown twice.  If I had 
another photo, I get the album back 3 times.  I'm absolutely stumped as to 
what's causing this, and have a feeling it must be something really stupid 
that I've done.  I've set up much more complex models than this in the 
past, with no problems.

Also, when I try to retrieve a photo, I don't get the associated album 
back, just the photo itself.

Can anyone see anything wrong in what I've got so far?

Thanks!

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to