Commit 56f21931 authored by Padraig O'Sullivan's avatar Padraig O'Sullivan

Update fix for issue with bigint type to work for both postgresql and mysql.

parent 9c12f43c
......@@ -45,4 +45,22 @@ class BigIntType extends Type
{
return \PDO::PARAM_STR;
}
/**
* {@inheritdoc}
*/
public function convertToPHPValue($value, AbstractPlatform $platform)
{
if (null === $value) {
return $value;
}
/*
* PostgreSQL detects 32 vs 64 bit systems and casts correctly
* for bigint types.
*/
if ($platform->getName() === 'postgresql' && PHP_INT_SIZE !== 4) {
return (string) $value;
}
return $value;
}
}
......@@ -48,13 +48,12 @@ class TypeConversionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$obj = new \stdClass();
$obj->foo = "bar";
$obj->bar = "baz";
$bigIntExpectedPhpType = (PHP_INT_SIZE === 4) ? 'string' : 'int';
return array(
array('string', 'ABCDEFGaaaBBB', 'string'),
array('boolean', true, 'bool'),
array('boolean', false, 'bool'),
array('bigint', 12345678, $bigIntExpectedPhpType),
array('bigint', 12345678, 'string'),
array('smallint', 123, 'int'),
array('datetime', new \DateTime('2010-04-05 10:10:10'), 'DateTime'),
array('datetimetz', new \DateTime('2010-04-05 10:10:10'), 'DateTime'),
......
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