The problem is that "name" is ambiguous - do you mean the Gallery.name
or the Image.name ?
As a convention, you should prefix all your fields with the model
name, so your query would be:
$this->Gallery->findAll("Gallery.id = '$id'",
array("Gallery.name","Gallery.description","Image.filename") );
or even just
$this->Gallery-
>read( array('Gallery.name','Gallery.description','Image.filename'),
$id )
as I assume your Gallery.id field is unique :)
peper wrote:
> Hi.
> I'm new in CakePHP. My problem is:
> I've got Gallery(id,name,description) and
> Image(id,name,filename,gallery_id) models.
> When I make:
> $this->Gallery->findAll("id = '$id'");
>
> I get a Gallery and related imges. Works fine. But I want only gallery
> name, description images filename, so I do:
> $this->Gallery->findAll("id = '$id'",
> array("name","description","Image.filename")
> );
>
> and it returnes false :-(
>
> What's 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?hl=en
-~----------~----~----~----~------~----~------~--~---