Hello,

I am trying to interrelate models from different data sources (Oracle and 
Active Directory in this case), and I am getting some funny behavior from 
recursive associations. Just to clarify: single level association work well.

So, consider model A belongsTo B, and model B hasMany A.

This is an example of the code that I’m trying to execute:

$this->B->find('first', array(
                                             'conditions' => array('id' => 
'1158'),
                                             'recursive' => -1,
                                             'contain' => array(
                                                            'A' => array(
                                                                           
'fields' => array(‘id’, …),
                                                                           'B' 
=> array(
                                                                                
          'fields' => array('id', …),
                                                                                
          'A' => array(
                                                                                
                         'fields' => array(…),
                                                                                
          ),
                                                                           ),
                                                            ),
                                             ),
                              ));

If the code ran correctly, I’d be getting something that looks like a circular 
array. However, my code doesn’t work as expected and the innermost value (‘A’) 
is not present (i.e., my result array looks like [B => …, A => [‘field1’, …, B 
=> [‘field1’, ‘field2’, …]]]), not even as a NULL or empty array. If instead of 
using containable I set the ‘recursive’ property OR use containable but leave 
the fields unspecified, something even stranger happens at the recursion stops 
one level before that (which is this time an empty array, i.e., I get [B => …, 
A => [‘field1’, …, B => []]]).

If I misspell the name of the innermost A on purpose, I get a warning. This is 
leading me to think that things are somehow, but not quite entirely, working. 
How could I debug this to find out what the problematic code is? It could be 
somewhere in the custom datasources or the model definitions.

Thanks,

Ricardo Vieitez | Student Assistant - Network Administration
University of Florida Department of Housing and Residence Education
PO Box 112100 | Gainesville, FL 32611-2100
office 352.392.2171 x10355 | fax 352.392.6819 | 
ricar...@housing.ufl.edu<mailto:ricar...@housing.ufl.edu>
StrengthsQuest Top 5: Analytical, Strategic, Learner, Responsibility, Relator - 
Find Out More<http://www.strengthsquest.com/content/141728/index.aspx>
Please consider the environment before printing this email.

-- 
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/d/optout.

Reply via email to