Inheritance: extends BaseActiveRecordVersioned
 public function getFurtherFindingsAssigned()
 {
     $further_findings = array();
     if ($this->id) {
         foreach (OphCiExamination_FurtherFindings_Assignment::model()->findAll('element_id=?', array($this->id)) as $ff) {
             $further_findings[] = $ff->finding_id;
         }
     }
     return $further_findings;
 }
示例#2
0
 protected function saveComplexAttributes_Element_OphCiExamination_FurtherFindings($element, $data, $index)
 {
     $ids = array();
     if (!empty($element->further_findings_assignment)) {
         foreach ($element->further_findings_assignment as $assignment) {
             $assignment->element_id = $element->id;
             if (!$assignment->save()) {
                 throw new \Exception('Unable to save further finding assignment: ' . print_r($assignment->errors, true));
             }
             $ids[] = $assignment->id;
         }
     }
     $criteria = new \CDbCriteria();
     $criteria->addCondition('element_id = :eid');
     $criteria->params[':eid'] = $element->id;
     if (!empty($ids)) {
         $criteria->addNotInCondition('id', $ids);
     }
     models\OphCiExamination_FurtherFindings_Assignment::model()->deleteAll($criteria);
 }