Gdn_Validation::setSchema PHP Method

setSchema() public method

Set the schema for this validation.
public setSchema ( Gdn_Schema | array $Schema ) : Gdn_Validation
$Schema Gdn_Schema | array The new schema to set.
return Gdn_Validation Returns `$this` for fluent calls.
    public function setSchema($Schema)
    {
        if ($Schema instanceof Gdn_Schema) {
            $this->_Schema = $Schema->fields();
        } elseif (is_array($Schema)) {
            $this->_Schema = $Schema;
        } else {
            throw new \Exception('Invalid schema of type ' . gettype($Schema) . '.', 500);
        }
        $this->_SchemaRules = null;
        return $this;
    }