RainLab\Builder\Classes\TableMigrationCodeGenerator::formatLengthParameters PHP Метод

formatLengthParameters() защищенный Метод

protected formatLengthParameters ( $column, $method )
    protected function formatLengthParameters($column, $method)
    {
        $length = $column->getLength();
        $precision = $column->getPrecision();
        $scale = $column->getScale();
        if (!strlen($length) && !strlen($precision)) {
            return null;
        }
        if ($method == MigrationColumnType::TYPE_STRING) {
            if (!strlen($length)) {
                return null;
            }
            return ', ' . $length;
        }
        if ($method == MigrationColumnType::TYPE_DECIMAL || $method == MigrationColumnType::TYPE_DOUBLE) {
            if (!strlen($precision)) {
                return null;
            }
            if (strlen($scale)) {
                return ', ' . $precision . ', ' . $scale;
            }
            return ', ' . $precision;
        }
    }