Hi Wilson,
thats how my query looks like:
        $checklist = $this->Checklist->find('first', array('conditions' 
=> array('Checklist.id' => $id),
                                                           'contain' => 
array(
                                                                
'Product' => array(
                                                                        
'fields' => array('id', 'name', 'name_short', 'year'),
                                                                        
'conditions' => '',
                                                                        
'Module.name' => array(
                                                                        
        'Subject.description' => array(
                                                                        
                        'Check.check'
                                                                        
                )
                                                                        
        )
                                                                        ),
                                                                'Check',
                                                                
'Language.lang_short', 'Language.name',
                                                                
'OperatingSystem.name',
                                                                
'User.name', 'User.email')));

Hope that helps :)

greets
Andreas

Wilson schrieb:
> Hi Andreas,
>
> I'm trying to this same thing, but without success.  Do you mind
> pasting your find logic here?
>
> On Jun 12, 9:20 am, Andreas Derksen <[email protected]> wrote:
>   
>> Thanks, Works fine! Thought to complicated... :-)
>> Containable behavior is really nice ;-)
>>
>> greets
>> Andreas
>>
>> Martin Westin schrieb:
>>
>>     
>>> You just go:
>>>       
>>> 'contain' => array(
>>>   'Product' => array(
>>>     'conditions' => array('Product.id' => $productId),
>>>     'Module' => array(
>>>       'Subject'
>>>     )
>>>   ),
>>>   'Check'
>>> )
>>>       
>>> That is: in contain you simply name the nearest "associates" and in
>>> each of those you name furhter associates to return.
>>>       
>>> On Jun 12, 2:02 pm, Andreas Derksen <[email protected]> wrote:
>>>       
>>>> Hi, im currently developing a checklist application witch has the 
>>>> following Models and relations:
>>>> Checklist belongsTo Product
>>>> Checklist hasMany Check
>>>> Product HABTM Module
>>>> Module hasMany Subjects
>>>> Subject belongsTo Module
>>>> So, what i want to do now is to generate tables like this:Checklist ID 
>>>> 2Module 1Subject 1Subject 2Subject 3Subject 4Module 2Subject 1Subject 
>>>> 2Subject 3Subject 4
>>>> I tried to query it like this:
>>>> $this->Checklist->find('first', array('contain' => array(
>>>>                                                              'Product' => 
>>>> array('conditions' => array('Product.id' => $productId)),
>>>>                                                              'Check' )));
>>>> the result is:Array ( [Checklist] => Array ( [id] => 1 [product_id] => 1 ) 
>>>> [Product] => Array ( [id] => 1 [name] => Product1 ) [Check] => Array ( [0] 
>>>> => Array ( [id] => 1 [check] => true [checklist_id] => 1 [subject_id] => 1 
>>>> ) ) )Now I need the Product array recursive, means: the associated 
>>>> Module(s) and the Subject(s) associated to the Module(s).
>>>> A $this->Checklist->find('first', array('recursive' => 2, 'conditions' => 
>>>> array('id' => $checklistId))); returns everything I need, ... and more. 
>>>> thats the problem.
>>>> How can I do that?
>>>> Thanks in advance
>>>> Andreas
>>>>         
>>     
> >
>   

--~--~---------~--~----~------------~-------~--~----~
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