/**
* Handle the patient unavailables.
*
* @see BaseEventTypeController::setElementComplexAttributesFromData($element, $data, $index)
*/
protected function setComplexAttributes_Element_OphTrOperationbooking_ScheduleOperation($element, $data, $index)
{
if (isset($data['Element_OphTrOperationbooking_ScheduleOperation']['patient_unavailables'])) {
$puns = array();
foreach ($data['Element_OphTrOperationbooking_ScheduleOperation']['patient_unavailables'] as $i => $attributes) {
if ($id = @$attributes['id']) {
$pun = OphTrOperationbooking_ScheduleOperation_PatientUnavailable::model()->findByPk($id);
} else {
$pun = new OphTrOperationbooking_ScheduleOperation_PatientUnavailable();
}
$pun->attributes = Helper::convertNHS2MySQL($attributes);
$puns[] = $pun;
}
$element->patient_unavailables = $puns;
}
}