Hi,

I'm not sure if this is a bug, or I'm just blind... I've developed
some apps in cakePHP already, but I can't find the reason for this
problem.

I have a "Gallery" and a "User" Model. When fetching a Gallery, the
User array is empty (It should contain the fields specified in the
belongsTo-Relation).
Here's the gallery model:

class Gallery extends AppModel
{
  public $name = 'Gallery';
  public $primaryKey = 'gallery_id';
  public $hasMany = array(
    'Images' => array(
      'className' => 'GalleryImage',
      'foreignKey' => 'gallery_id'
    )
  );
  public $belongsTo = array(
    'User' => array(
      'className' => 'User',
      'foreignKey' => 'user_id',
      'fields' => array(
        'User.user_id',
        'User.first_name',
        'User.last_name'
      )
    )
  );
}

When doing a find():

$this->Gallery->find(
  array(
    'Gallery.gallery_id' => $gallery_id
  ),
  array(
    'Gallery.gallery_id',
    'Gallery.title',
    'Gallery.description',
    'Gallery.created'
  ),
  array(),
  2
);

The afterFind()-Method in the User-Model contains an empty results-
Array:

array(1) { [0]=>  array(1) { ["User"]=>  array(0) { } } }

It seems, that cake build up the array, but had no fields to fetch.
I have the same belongsTo in another model and there it works (=
fetches the fields specified in the belongsTo-Relation). I've
commented out all afterFinds()'s I have in this Model and the other,
but it didn't help.

Does anyone have an idea what this could be? Is it a (known?) bug?

Thanks for your help and greetings,

Andy!

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to