Hi, I made some tests with recursion setting ($this->User->recursive = 3;)but my sql query doesn't catch any Anagrafica field!
SELECT `Jobber`.`id`, `Jobber`.`user_id`, `Jobber`.`mestiere_id`, `Jobber`.`regione_id`, `Jobber`.`provincia_id`, `Jobber`.`comune_id`, `Jobber`.`descrizione`, `Jobber`.`onorario`, `Jobber`.`sesso`, `Jobber`.`tags`, `Jobber`.`pathFotos`, `Jobber`.`created`, `Jobber`.`modified`, `User`.`id`, `User`.`username`, `User`.`password`, `User`.`role`, `User`.`email`, `User`.`anagrafica_id`, `User`.`stato`, `User`.`dt_scadenza`, `User`.`created`, `User`.`modified`, `Mestiere`.`id`, `Mestiere`.`descrizione`, `Mestiere`.`tipo`, `Mestiere`.`active`, `Regione`.`id`, `Regione`.`codice`, `Regione`.`descrizione`, `Provincia`.`id`, `Provincia`.`descrizione`, `Provincia`.`codice`, `Provincia`.`sigla`, `Provincia`.`regione_id`, `Comune`.`id`, `Comune`.`descrizione`, `Comune`.`cap`, `Comune`.`provincia_id`, `Comune`.`cistat`, `Comune`.`cfisc`, `Comune`.`tipo`, `Comune`.`dt_var`, `Comune`.`dt_ins` FROM `jobber` AS `Jobber` LEFT JOIN `user` AS `User` ON (`Jobber`.`user_id` = `User`.`id`) LEFT JOIN `categoria` AS `Mestiere` ON (`Jobber`.`mestiere_id` = `Mestiere`.`id`) LEFT JOIN `regione` AS `Regione` ON (`Jobber`.`regione_id` = `Regione`.`id`) LEFT JOIN `provincia` AS `Provincia` ON (`Jobber`.`provincia_id` = `Provincia`.`id`) LEFT JOIN `comune` AS `Comune` ON (`Jobber`.`comune_id` = `Comune`.`id`) WHERE 1 = 1 LIMIT 20 Anagrafica table is not joined! why? On 7 Feb, 09:57, Jeremy Burns | Class Outfit <[email protected]> wrote: > 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 > > Tutorialshttp://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > > [email protected] For more options, visit this group > > athttp://groups.google.com/group/cake-php -- 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 [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
