Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 62d28f9

Browse filesBrowse files
committed
[DoctrineBridge][PropertyInfo] Treat Doctrine decimal type as string
1 parent 1e91ed7 commit 62d28f9
Copy full SHA for 62d28f9

File tree

3 files changed

+15
-1
lines changed
Filter options

3 files changed

+15
-1
lines changed

‎src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,12 @@ private function getPhpType($doctrineType)
178178
return Type::BUILTIN_TYPE_INT;
179179

180180
case DBALType::FLOAT:
181-
case DBALType::DECIMAL:
182181
return Type::BUILTIN_TYPE_FLOAT;
183182

184183
case DBALType::STRING:
185184
case DBALType::TEXT:
186185
case DBALType::GUID:
186+
case DBALType::DECIMAL:
187187
return Type::BUILTIN_TYPE_STRING;
188188

189189
case DBALType::BOOLEAN:

‎src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ public function testGetProperties()
4949
'time',
5050
'json',
5151
'simpleArray',
52+
'float',
53+
'decimal',
5254
'bool',
5355
'binary',
5456
'customFoo',
@@ -73,6 +75,8 @@ public function typesProvider()
7375
return array(
7476
array('id', array(new Type(Type::BUILTIN_TYPE_INT))),
7577
array('guid', array(new Type(Type::BUILTIN_TYPE_STRING))),
78+
array('float', array(new Type(Type::BUILTIN_TYPE_FLOAT))),
79+
array('decimal', array(new Type(Type::BUILTIN_TYPE_STRING))),
7680
array('bool', array(new Type(Type::BUILTIN_TYPE_BOOL))),
7781
array('binary', array(new Type(Type::BUILTIN_TYPE_RESOURCE))),
7882
array('json', array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true))),

‎src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ class DoctrineDummy
6565
*/
6666
private $simpleArray;
6767

68+
/**
69+
* @Column(type="float")
70+
*/
71+
private $float;
72+
73+
/**
74+
* @Column(type="decimal", precision=10, scale=2)
75+
*/
76+
private $decimal;
77+
6878
/**
6979
* @Column(type="boolean")
7080
*/

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.