I have the following tables:
patient
-
id
-
first_name
-
last_name
event
-
id
-
patient_id
-
event_description
notification
-
id
-
event_id
-
notification_description
I have the following relations defined in my models:
Notification.php
public function relations()
{
return array(
'event' => array(self::BELONGS_TO, 'Event', 'event_id'),
);
}
Event.php
public function relations()
{
return array(
'patient' => array(self::BELONGS_TO, 'Patient', 'patient_id'),
);
}
I want to get all notifications for patient with first name "Joe" and last name "Smith". Is there a way to do that without writing out an SQL statement?