Actually also doing before the find

$this->Paper->recursive = 0;

solved the problem...

probably because it defaults to -1 and in that case the find does not work?

thanks
        Lorenzo

John Andersen wrote:
> Add the recursive parameter to the find, as:
> 
> [code]
> $result = $this->Paper->find('all',
>                 array(
>                         'fields' => array('Paper.*'),
>                         ''conditions' => array('AuthorsPaper.id' =>
> 1),
>                         "recursive" => 1
>                 )
>         );
> [/code]
> Enjoy,
>    John
> 
> On Jan 3, 4:38 pm, Lorenzo Bettini <[email protected]> wrote:
>> Hi
>>
>> I have Paper HABTM Author (I also have the model AuthorsPaper) and I'd
>> like to do an explicit join using
>>
>> $this->Paper->bindModel(array('hasOne' => array('AuthorsPaper')));
>>
>> however, when performing a find no explicit join is performed, in fact,
>> if I try
>>
>> $result = $this->Paper->find('all',
>>                 array(
>>                         'fields' => array('Paper.*'),
>>                         ''conditions' => array('AuthorsPaper.id' => 1)
>>                 )
>>         );
>>
>> I get an sql error since AuthorsPaper.id is not found...
>>
>> where am I going wrong?
>>
>> This is similar to what's on the book
>>
>> $this->Recipe->bindModel(array('hasOne' => array('RecipesTag')));
>> $this->Recipe->find('all', array(
>>                 'fields' => array('Recipe.*'),
>>                 'conditions'=>array('RecipesTag.tag_id'=>124) // id of 
>> Dessert
>> ));
>>
>> thanks in advance
>>         Lorenzo
>>
>> --
>> Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
>> HOME:http://www.lorenzobettini.itMUSIC:http://www.purplesucker.com
>> BLOGS:http://tronprog.blogspot.com http://longlivemusic.blogspot.com
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> 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
> 


-- 
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to