Ok, got it. I'll go for this containable behaviour right now.
Thanks for you replies guys. Regards On 2 jun, 23:03, Roland Pish <[email protected]> wrote: > Thanks Graham! > > So, this conditions array is mandatory in find method right? > > Regards > > On 2 jun, 23:01, Roland Pish <[email protected]> wrote: > > > Thanks for your reply Jeremy. > > > I was avoiding the conditions array because I thought cake would do > > the "magic" and the automatic filter. > > In this specific case does cake do this "magic"? or is it neccesary to > > pass the conditions array? > > > Regards. > > > On 2 jun, 22:56, Jeremy Burns <[email protected]> wrote: > > > > I'd try this: > > > > > $foreignSchools = $this->Student->ForeignSchool->find('all', > > > > array('conditions' => array('ForeignSchool.student_id' => 2))); > > > > (hope the number of brackets is right...) > > > > Jeremy Burns > > > [email protected] > > > > On 3 Jun 2010, at 05:51, Roland Pish wrote: > > > > > Hello. I don't know if I'm doing things well, so I'll fire my > > > > question. > > > > I have a model relationship this way: Student hasMany ForeignSchool. > > > > First, I'll show my scenario, files and relevant code, then I'll > > > > explain the problem. > > > > > SCENARIO: > > > > * Model file student.php (hasmany declaration): > > > > var $hasMany = array( > > > > > 'ForeignSchool' => array( > > > > > 'className' => 'ForeignSchool', > > > > > 'foreignKey' => 'student_id', > > > > > 'dependent' => true, > > > > > ), > > > > > ); > > > > > * Model file foreign_school.php (belongsto declaration): > > > > var $belongsTo = array( > > > > > 'Student' => array( > > > > > 'className' => 'Student', > > > > > 'foreignKey' => 'student_id', > > > > > ), > > > > > ); > > > > > * Controller file students_controller.php (find call test): > > > > $this->Student->id = 2; //test hard code > > > > $foreignSchools = $this->Student->ForeignSchool->find('all'); > > > > > $this->set(compact('foreignSchools')); > > > > > * And in the corresponding view file: > > > > print_r($foreignSchools); > > > > > PROBLEM: > > > > The call to print_r($foreignSchools) is showing all the foreign > > > > schools but not the schools of the current Student. Is it something > > > > I'm missing that is avoiding the "filtering" of the foreign schools > > > > shown in the view? > > > > > Thanks a lot! > > > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers > > > > with their CakePHP related questions. > > > > > You received this message because you are subscribed to the Google > > > > Groups "CakePHP" group. > > > > To post to this group, send email to [email protected] > > > > To unsubscribe from this group, send email to > > > > [email protected] For more options, visit this > > > > group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
