Tuesday, February 7, 2012

Re: get Values of third Join

Have a look at the Containable behaviour. My guess is your recursion level is too low, so it isn't going 'out' far enough to include the Anagrafica model.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 6 Feb 2012, at 23:39:45, Byteo wrote:

Hi,
I have a little problem to retrieve some data from my 'Anagrafica'
model....

My models:
-------------------------

class Jobber extends AppModel {
public $name= "Jobber";
public $belongsTo = array('User');
var $useTable = 'jobber';
}


class User extends AppModel {
public $name= "User";
public $belongsTo = array('Anagrafica');
var $useTable = 'user';
...
...
}

class Anagrafica extends AppModel {
public $name= "Anagrafica";
var $hasOne = 'User';
var $useTable = 'anagrafica';

}

class JobbersController ...{
..
..
public function index($value='')
{
  ...
  $this->set('jobbers',$this->Jobber->find('all',array('order' =>
array('Jobber.created DESC'))));
  ...
}
 ...
 ...
}
--------------------------
Now, I need to retrieve some fields from Anagrafica in my index Jobber
View:
...
<td><?php echo $jobber['User']['myFiled']; ?></td> <---- OK
.. <td><?php echo $jobber['Jobber']['myField']; ?></td>  <-----OK
<td><?php echo $jobber['Anagrafica']['myField']; ?></td>   <-------
ERROR
<td><?php echo $jobber['Jobber']['Anagrafica']['myField']; ?></td>
<------- ERROR
..
My SLQ  QUERY DON'T EXTRACT NOTHING ABOUT ANAGRAFICA TABLE....WHY?

thank you!!
..

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: