0

I have the following problem. I have the following relationships: A->B->C->D With the respective relations in models. I need to get all the "D" belonging to "A"

$this->A->B->C->D->find('all', array ('conditions' =>
    array('B.a_id' => $id)
));

but get the error that there b.a_id.

I tried recursive = 2;

But I keep getting the same problem.

What am I doing wrong? PD: Sorry, but my English is not good

Adr
  • 3
  • 1

1 Answers1

0

Maybe the better idea is to connect the Models A, B, C, D to your Controller.

In your Controller:

var $uses = array('A', 'B', 'C', 'D');
$this->D->recursive = 2;
$result = $this->D->find('all', array ('conditions' => array('B.a_id' => $id)));

If that is not it try just finding all D's and then make conditions when you debbug $result variable:

$result = $this->D->find('all');
debug($result);
die;