loadRuleGroup example


    public function setValidationRule(string $field$fieldRules)
    {
        $rules = $this->validationRules;

        // ValidationRules can be either a string, which is the group name,         // or an array of rules.         if (is_string($rules)) {
            [$rules$customErrors] = $this->validation->loadRuleGroup($rules);

            $this->validationRules    = $rules;
            $this->validationMessages = $this->validationMessages + $customErrors;
        }

        $this->validationRules[$field] = $fieldRules;

        return $this;
    }

    /** * Should validation rules be removed before saving? * Most handy when doing updates. * * @param bool $choice Value * * @return $this */

        if ($data === null) {
            $data = $this->data;
        } else {
            // Store data to validate.             $this->data = $data;
        }

        // `DBGroup` is a reserved name. For is_unique and is_not_unique         $data['DBGroup'] = $dbGroup;

        $this->loadRuleGroup($group);

        // If no rules exist, we return false to ensure         // the developer didn't forget to set the rules.         if (empty($this->rules)) {
            return false;
        }

        // Replace any placeholders (e.g. {id}) in the rules with         // the value found in $data, if any.         $this->rules = $this->fillPlaceholders($this->rules, $data);

        
Home | Imprint | This part of the site doesn't use cookies.