Yii2: MSSQL 2017 BIT Default value set to 1 but model default values return 0

Created on 4 Jan 2018  路  1Comment  路  Source: yiisoft/yii2

What steps will reproduce the problem?

When we call the method loadDefaultValues() from a Model the default value is always 0 even if in the table schema is set as 1 .

The problem is in the ColumnSchema::typecast() when we try to covert ((1)) to Integer it always converts it to 0 because of the parentheses.

    protected function typecast($value)
    {
           ...
            case 'integer':
                return (int) $value;
           ...
    }

Additional info

| Q | A
| ---------------- | ---
| Yii version | 2.0.13
| PHP version | 7.1
| Operating system | Windows Server

MSSQL bug

Most helpful comment

>All comments

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Locustv2 picture Locustv2  路  3Comments

psfpro picture psfpro  路  3Comments

schmunk42 picture schmunk42  路  3Comments

MUTOgen picture MUTOgen  路  3Comments

indicalabs picture indicalabs  路  3Comments