In the project I am working on, I have the following models:

class Student extends AppModel
{
  var $name = 'Student';
  var $belongsTo = 'School';
  var $hasMany = 'Competitor';
}

class Competitor extends AppModel
{
  var $name = 'Competitor';
  var $belongsTo = array('Student','Trackmeet');
}

class School extends AppModel
{
  var $name = 'School';
  var $hasMany = array('User','Student','Trackmeet');
}

class Trackmeet extends AppModel
{
  var $name = 'Trackmeet';
  var $belongsTo = 'School';
  var $hasMany = 'Competitor';
}

class Trackmeet extends AppModel
{
  var $name = 'Trackmeet';
  var $belongsTo = 'School';
  var $hasMany = 'Competitor';
}

In the Trackmeet controller, I am able to select all of the
competitors in a specific event which returns an array with elements
('Competitor','Student','Trackmeet). I would like to be able to find
out the name of the school the student attends so I can pass it to the
appropriate view.  Do I have to do a separate query based on school_id
in the student model or is there an easier way?

Thanks for any help.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to