OphTrOperationbooking_ScheduleOperation_PatientUnavailable::validateReasonIsEnabled PHP Метод

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

validate the related object for $attribute is enabled.
public validateReasonIsEnabled ( $attribute, $params )
$attribute
$params - 'model' is the model that the $attribute is the id for
    public function validateReasonIsEnabled($attribute, $params)
    {
        $model = $params['model'];
        if ($this->{$attribute}) {
            $obj = $model::model()->findByPk($this->{$attribute});
            if (!$obj->enabled) {
                $this->addError($attribute, $this->getAttributeLabel($attribute) . ' must be active for new entry');
            }
        }
    }