Skip to content

Commit bc115d8

Browse files
authored
Fix for typecast decimal columns (#228)
1 parent e95071b commit bc115d8

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

tests/ColumnSchemaTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function testPhpTypeCast(): void
7474
$this->assertSame(str_repeat('x', 100), $charColPhpTypeCast);
7575
$this->assertSame(1.234, $floatColPhpTypeCast);
7676
$this->assertFalse($boolColPhpTypeCast);
77-
$this->assertSame('33.22', $numericColPhpTypeCast);
77+
$this->assertSame(33.22, $numericColPhpTypeCast);
7878
$this->assertSame([1, -2, null, 42], $intArrayColPhpType);
7979
$this->assertNull($textArray2ColPhpType);
8080
$this->assertSame([['a' => 1, 'b' => null, 'c' => [1, 3, 5]]], $jsonColPhpType);

tests/Provider/QueryBuilderProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ public function insertWithReturningPks(): array
360360
<<<SQL
361361
INSERT INTO {{%order_item}} ("order_id", "item_id", "quantity", "subtotal") VALUES (:qp0, :qp1, :qp2, :qp3) RETURNING "order_id", "item_id"
362362
SQL,
363-
[':qp0' => 1, ':qp1' => 1, ':qp2' => 1, ':qp3' => '1',],
363+
[':qp0' => 1, ':qp1' => 1, ':qp2' => 1, ':qp3' => 1.0,],
364364
],
365365
];
366366
}

tests/Provider/SchemaProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,15 @@ public function columns(): array
147147
'numeric_col' => [
148148
'type' => 'decimal',
149149
'dbType' => 'numeric',
150-
'phpType' => 'string',
150+
'phpType' => 'double',
151151
'primaryKey' => false,
152152
'allowNull' => true,
153153
'autoIncrement' => false,
154154
'enumValues' => null,
155155
'size' => null,
156156
'precision' => 5,
157157
'scale' => 2,
158-
'defaultValue' => '33.22',
158+
'defaultValue' => 33.22,
159159
],
160160
'time' => [
161161
'type' => 'timestamp',

0 commit comments

Comments
 (0)