Commit 1f972085 authored by Peter Kruithof's avatar Peter Kruithof

Type hinting for guid type now depends on platform's native guid support

parent d6dba15f
...@@ -2573,6 +2573,16 @@ abstract class AbstractPlatform ...@@ -2573,6 +2573,16 @@ abstract class AbstractPlatform
return false; return false;
} }
/**
* Does this platform have native guid type.
*
* @return boolean
*/
public function hasNativeGuidType()
{
return false;
}
public function getIdentityColumnNullInsertSQL() public function getIdentityColumnNullInsertSQL()
{ {
return ""; return "";
......
...@@ -155,6 +155,14 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -155,6 +155,14 @@ class PostgreSqlPlatform extends AbstractPlatform
return true; return true;
} }
/**
* {@inheritDoc}
*/
public function hasNativeGuidType()
{
return true;
}
public function getListDatabasesSQL() public function getListDatabasesSQL()
{ {
return 'SELECT datname FROM pg_database'; return 'SELECT datname FROM pg_database';
......
...@@ -106,6 +106,14 @@ class SQLServerPlatform extends AbstractPlatform ...@@ -106,6 +106,14 @@ class SQLServerPlatform extends AbstractPlatform
return false; return false;
} }
/**
* {@inheritDoc}
*/
public function hasNativeGuidType()
{
return true;
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
......
...@@ -41,7 +41,7 @@ class GuidType extends StringType ...@@ -41,7 +41,7 @@ class GuidType extends StringType
public function requiresSQLCommentHint(AbstractPlatform $platform) public function requiresSQLCommentHint(AbstractPlatform $platform)
{ {
return true; return !$platform->hasNativeGuidType();
} }
} }
...@@ -27,5 +27,16 @@ class GuidTest extends \Doctrine\Tests\DbalTestCase ...@@ -27,5 +27,16 @@ class GuidTest extends \Doctrine\Tests\DbalTestCase
{ {
$this->assertNull($this->_type->convertToPHPValue(null, $this->_platform)); $this->assertNull($this->_type->convertToPHPValue(null, $this->_platform));
} }
}
public function testNativeGuidSupport()
{
$this->assertTrue($this->_type->requiresSQLCommentHint($this->_platform));
$mock = $this->getMock(get_class($this->_platform));
$mock->expects($this->any())
->method('hasNativeGuidType')
->will($this->returnValue(true));
$this->assertFalse($this->_type->requiresSQLCommentHint($mock));
}
}
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