Skip to content

Commit 60bcc0a

Browse files
Merge branch '2.8' into 3.1
* 2.8: Fix version constraint Fixed bad merge [DoctrineBridge][PropertyInfo] Treat Doctrine decimal type as string Make ReflectionExtractor compatible with ReflectionType changes in PHP 7.1
2 parents 330f007 + da7330b commit 60bcc0a

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

PropertyInfo/DoctrineExtractor.php

Lines 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:

Tests/PropertyInfo/DoctrineExtractorTest.php

Lines 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))),

Tests/PropertyInfo/Fixtures/DoctrineDummy.php

Lines 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)