lithium\data\source\Database::column PHP Method

column() public method

Generate a database-native column schema string
public column ( $field ) : string
return string SQL string
    public function column($field)
    {
        if (!isset($field['type'])) {
            $field['type'] = 'string';
        }
        if (!isset($field['name'])) {
            throw new InvalidArgumentException("Column name not defined.");
        }
        if (!isset($this->_columns[$field['type']])) {
            throw new UnexpectedValueException("Column type `{$field['type']}` does not exist.");
        }
        $field += $this->_columns[$field['type']] + array('name' => null, 'type' => null, 'length' => null, 'precision' => null, 'default' => null, 'null' => null);
        $isNumeric = preg_match('/^(integer|float|boolean)$/', $field['type']);
        if ($isNumeric && $field['default'] === '') {
            $field['default'] = null;
        }
        $field['use'] = strtolower($field['use']);
        return $this->_buildColumn($field);
    }