Commit 702967b6 authored by Davi Koscianski Vidal's avatar Davi Koscianski Vidal Committed by lucasvanlierop

Applying requested fixes

parent 3b086813
...@@ -2245,7 +2245,7 @@ abstract class AbstractPlatform ...@@ -2245,7 +2245,7 @@ abstract class AbstractPlatform
} elseif ((string)$field['type'] == 'Date' && $field['default'] == $this->getCurrentDateSQL()) { } elseif ((string)$field['type'] == 'Date' && $field['default'] == $this->getCurrentDateSQL()) {
$default = " DEFAULT ".$this->getCurrentDateSQL(); $default = " DEFAULT ".$this->getCurrentDateSQL();
} elseif ((string) $field['type'] == 'Boolean') { } elseif ((string) $field['type'] == 'Boolean') {
$default = " DEFAULT '" . $this->convertBoolToSqlLiteral($field['default']) . "'"; $default = " DEFAULT '" . $this->convertBooleans($field['default']) . "'";
} }
} }
} }
...@@ -2604,9 +2604,9 @@ abstract class AbstractPlatform ...@@ -2604,9 +2604,9 @@ abstract class AbstractPlatform
* @param mixed $item * @param mixed $item
* @return mixed * @return mixed
*/ */
public function convertBoolToDbValue($item) public function convertBooleansToDbValue($item)
{ {
return self::convertBooleans($item); return $this->convertBooleans($item);
} }
/** /**
......
...@@ -725,7 +725,11 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -725,7 +725,11 @@ class PostgreSqlPlatform extends AbstractPlatform
if (is_bool($value) || is_numeric($value)) { if (is_bool($value) || is_numeric($value)) {
$item[$key] = $value ? 1 : 0; $item[$key] = $value ? 1 : 0;
} elseif (is_string($value)) { } elseif (is_string($value)) {
$item[$key] = (trim(strtolower($value)) === 'false'); if (trim(strtolower($item)) === 'false') {
$item[$key] = 0;
} else {
$item[$key] = 1;
}
} }
} }
} else { } else {
......
...@@ -61,8 +61,6 @@ class DBAL630Test extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -61,8 +61,6 @@ class DBAL630Test extends \Doctrine\Tests\DbalFunctionalTestCase
public function testBooleanConversionBoolParamEmulatedPrepares() public function testBooleanConversionBoolParamEmulatedPrepares()
{ {
// $this->markTestIncomplete('There is something missing here, on some machines it fails on some it passes.');
$this->_conn->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); $this->_conn->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
$this->_conn->getWrappedConnection()->setAttribute(PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, true); $this->_conn->getWrappedConnection()->setAttribute(PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, true);
......
...@@ -295,8 +295,8 @@ abstract class AbstractPostgreSqlPlatformTestCase extends AbstractPlatformTestCa ...@@ -295,8 +295,8 @@ abstract class AbstractPostgreSqlPlatformTestCase extends AbstractPlatformTestCa
{ {
$platform = $this->createPlatform(); $platform = $this->createPlatform();
$this->assertEquals('true', $platform->convertBoolToSqlLiteral(true)); $this->assertEquals('true', $platform->convertBooleans(true));
$this->assertEquals('false', $platform->convertBoolToSqlLiteral(false)); $this->assertEquals('false', $platform->convertBooleans(false));
} }
/** /**
...@@ -307,8 +307,8 @@ abstract class AbstractPostgreSqlPlatformTestCase extends AbstractPlatformTestCa ...@@ -307,8 +307,8 @@ abstract class AbstractPostgreSqlPlatformTestCase extends AbstractPlatformTestCa
$platform = $this->createPlatform(); $platform = $this->createPlatform();
$platform->setUseBooleanTrueFalseStrings(false); $platform->setUseBooleanTrueFalseStrings(false);
$this->assertEquals('1', $platform->convertBoolToSqlLiteral(true)); $this->assertEquals('1', $platform->convertBooleans(true));
$this->assertEquals('0', $platform->convertBoolToSqlLiteral(false)); $this->assertEquals('0', $platform->convertBooleans(false));
} }
/** /**
......
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