public function addField($name, $attrs)
    {
        if (is_string($attrs)) {
            $attrs = ['type' => $attrs];
        }
        $attrs = array_intersect_key($attrs, $this->_fieldDefaults);
        $this->_fields[$name] = $attrs + $this->_fieldDefaults;

        return $this;
    }
public function addField($name, $attrs)
    {
        if (is_string($attrs)) {
            $attrs = ['type' => $attrs];
        }
        $attrs = array_intersect_key($attrs, $this->_fieldDefaults);
        $this->_fields[$name] = $attrs + $this->_fieldDefaults;

        return $this;
    }
public function addField ( $ name , $ attrs ) { if ( is_string ( $ attrs ) ) { $ attrs = [ 'type' => $ attrs ] ; } $ attrs = array_intersect_key ( $ attrs , $ this -> _fieldDefaults ) ; $ this -> _fields [ $ name ] = $ attrs + $ this -> _fieldDefaults ; return $ this ; }
Adds a field to the schema.

@param string $name The field name.
@param string|array $attrs The attributes for the field, or the type
as a string.
@return $this
Adds a field to the schema .