OEModule\OphCiExamination\models\Element_OphCiExamination_OCT::notAllowedIfTrue PHP Méthode

notAllowedIfTrue() public méthode

validate that attribute is not set if dependency is true - should never arise through the forms requires side param.
public notAllowedIfTrue ( $attribute, $params )
$attribute
$params
    public function notAllowedIfTrue($attribute, $params)
    {
        $dependency = $params['dependency'];
        $side = $params['side'];
        $checker = 'has' . ucfirst($side);
        if ($this->{$checker}() && $this->{$dependency} && $this->{$attribute}) {
            $this->addError($attribute, ucfirst($side) . ' ' . $this->getAttributeLabel($attribute) . ' cannot be set when ' . $side . ' ' . $this->getAttributeLabel($dependency) . ' is set');
        }
    }