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

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

checks value defined when no treatment is set on the element.
public requiredIfNoTreatment ( $attribute, $params )
$attribute
$params
    public function requiredIfNoTreatment($attribute, $params)
    {
        $side = $params['side'];
        if ($side == 'left' && $this->eye_id != \Eye::RIGHT || $side == 'right' && $this->eye_id != \Eye::LEFT) {
            if ($this->{$side . '_no_treatment'} && $this->{$attribute} == null) {
                $this->addError($attribute, ucfirst($side) . ' ' . $this->getAttributeLabel($attribute) . ' must be provided when there is no treatment');
            }
        }
    }