OEModule\OphCiExamination\models\Element_OphCiExamination_InjectionManagementComplex::getInjectionTreatments PHP Метод

getInjectionTreatments() публичный Метод

get the treatments list to select from for this element on the given side.
public getInjectionTreatments ( $side ) : OphTrIntravitrealinjection_Treatment_Drug[] | null
$side
Результат OphTrIntravitrealinjection_Treatment_Drug[] | null
    public function getInjectionTreatments($side)
    {
        if ($this->injectionInstalled()) {
            # Note that this will namespaced to modules at some point.
            $treatments = \OphTrIntravitrealinjection_Treatment_Drug::model()->active()->findAll();
            if ($current_id = $this->{$side . '_treatment_id'}) {
                $treatment_list = array();
                foreach ($treatments as $treatment) {
                    if ($treatment->id == $current_id) {
                        return $treatments;
                    }
                    $treatment_list[] = $treatment;
                }
                $treatment_list[] = $this->{$side . '_treatment'};
                $treatments = $treatment_list;
            }
            return $treatments;
        }
    }