Commit 7c241a57 authored by Benjamin Eberlei's avatar Benjamin Eberlei

DBAL-121 - Do not convert decimals to float

parent 693953dd
...@@ -40,6 +40,6 @@ class DecimalType extends Type ...@@ -40,6 +40,6 @@ class DecimalType extends Type
public function convertToPHPValue($value, AbstractPlatform $platform) public function convertToPHPValue($value, AbstractPlatform $platform)
{ {
return (null === $value) ? null : (double) $value; return (null === $value) ? null : $value;
} }
} }
\ No newline at end of file
...@@ -60,7 +60,7 @@ class TypeConversionTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -60,7 +60,7 @@ class TypeConversionTest extends \Doctrine\Tests\DbalFunctionalTestCase
array('array', array('foo' => 'bar'), 'array'), array('array', array('foo' => 'bar'), 'array'),
array('object', $obj, 'object'), array('object', $obj, 'object'),
array('float', 1.5, 'float'), array('float', 1.5, 'float'),
array('decimal', 1.55, 'float'), array('decimal', 1.55, 'string'),
); );
} }
......
...@@ -21,7 +21,7 @@ class DecimalTest extends \Doctrine\Tests\DbalTestCase ...@@ -21,7 +21,7 @@ class DecimalTest extends \Doctrine\Tests\DbalTestCase
public function testDecimalConvertsToPHPValue() public function testDecimalConvertsToPHPValue()
{ {
$this->assertType('float', $this->_type->convertToPHPValue('5.5', $this->_platform)); $this->assertInternalType('string', $this->_type->convertToPHPValue('5.5', $this->_platform));
} }
public function testDecimalNullConvertsToPHPValue() public function testDecimalNullConvertsToPHPValue()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment