Hello,
I have the two tables.
SUBJECT
ID
NAME
Schedule
ID
SUBJECTID
DATE
TIME
My idea is to join the two tables, and make a schedule with a tabular input form.
So, for a given subject, if a schedule is not found for a given date, an outer join is performed.
Lets say, a MATH exam is not scheduled on 2000-12-12. then when i join the tables, then i should get a result set like this .
ID NAME DATE TIME
- MATH. NULL NULL
Now when i try to display this in the view, then it complains that the model
does not have DATE and TIME, just ID and NAME. How can i overcome this ?
I have defined relationships like this
in Subject Model
'Subjects' => array(self::HAS_MANY, 'Schedule','SUBJECTID'),
in Schedules Model
'Schedules' => array(self::BELONGS_TO, 'Subject', 'SUBJECTID'),
in the controller i am fetching it like this
$schedules = Subject::model()->with(‘Subjects’)->findAll();
In the view, i can do
$schedules->NAME
but cannot fetch $schedules->DATE or $schedules->TIME.
So, in short, how can i fetch the columns of the joined table in my resultset ?
thanks
Arvind