Commit 0ceb3479 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge pull request #258 from pkruithof/master

Guid type requires SQL typehint comment
parents 853b9653 1f972085
......@@ -2573,6 +2573,16 @@ abstract class AbstractPlatform
return false;
}
/**
* Does this platform have native guid type.
*
* @return boolean
*/
public function hasNativeGuidType()
{
return false;
}
public function getIdentityColumnNullInsertSQL()
{
return "";
......
......@@ -155,6 +155,14 @@ class PostgreSqlPlatform extends AbstractPlatform
return true;
}
/**
* {@inheritDoc}
*/
public function hasNativeGuidType()
{
return true;
}
public function getListDatabasesSQL()
{
return 'SELECT datname FROM pg_database';
......
......@@ -106,6 +106,14 @@ class SQLServerPlatform extends AbstractPlatform
return false;
}
/**
* {@inheritDoc}
*/
public function hasNativeGuidType()
{
return true;
}
/**
* {@inheritDoc}
*/
......
......@@ -38,5 +38,10 @@ class GuidType extends StringType
{
return Type::GUID;
}
public function requiresSQLCommentHint(AbstractPlatform $platform)
{
return !$platform->hasNativeGuidType();
}
}
......@@ -27,5 +27,16 @@ class GuidTest extends \Doctrine\Tests\DbalTestCase
{
$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