Look at the Containable behaviour (http://book.cakephp.org/view/1323/Containable), then you can do something like this:
$result = $this->DepartmentBook->find( 'all', array('contain' = 'DieseaseCourse.DirectoryDisease') ); Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 16 May 2011, at 21:43, Dominik Gajewski wrote: > I've studied this chapter but hasn't helped > > 2011/5/16 Tilen Majerle <tilen.maje...@gmail.com>: >> Check this! :) >> http://book.cakephp.org/view/1017/Retrieving-Your-Data >> -- >> Lep pozdrav, Tilen Majerle >> http://majerle.eu >> >> >> 2011/5/16 Dominik Gajewski <dominikgajews...@gmail.com> >>> >>> Hi >>> I have proble to retrive data from my database >>> >>> I have 3 models >>> >>> DepartmentBook, DiseaseCourse, DirectoryDisease >>> >>> and >>> >>> DepartmentBook hasMany DiseaseCourse, >>> DirectoryDisease hasOne DiseaseCourse >>> >>> I have to retrive data using DepartmentBook >>> >>> $this->DepartmentBook->find('all', array('conditions' => >>> array( 'MainBook.user_data_id' => $userId))); >>> >>> , so also i have access to DiseaseCourse, but i would like to get data >>> from DirectoryDisease. How should i create cake query? >>> >>> P.S. MainBook is in relation only with DepartmentBook -> MainBook >>> hasMany DepartmentBook >>> >>> -- >>> Pozdrawiam >>> Dominik Gajewski >>> >>> -- >>> 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+unsubscr...@googlegroups.com For more options, visit this group >>> at http://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 >> cake-php+unsubscr...@googlegroups.com For more options, visit this group at >> http://groups.google.com/group/cake-php >> > > > > -- > Pozdrawiam > Dominik Gajewski > > -- > 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+unsubscr...@googlegroups.com For more options, visit this group at > http://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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php