Commit 38d2356e authored by Valeriy Pravoslavnyy's avatar Valeriy Pravoslavnyy Committed by valerio8787

Update SQLServer2008Platform.php

Added support of  maps a Doctrine datetimetz type to a MS SQL SERVER type datetimeoffset(6)
parent d3456743
......@@ -52,6 +52,14 @@ class SQLServer2008Platform extends SQLServer2005Platform
{
return 'TIME(0)';
}
/**
* {@inheritDoc}
*/
public function getDateTimeTzTypeDeclarationSQL(array $fieldDeclaration)
{
return 'DATETIMEOFFSET(6)';
}
/**
* {@inheritDoc}
......@@ -96,6 +104,7 @@ class SQLServer2008Platform extends SQLServer2005Platform
$this->doctrineTypeMapping['datetime2'] = 'datetime';
$this->doctrineTypeMapping['date'] = 'date';
$this->doctrineTypeMapping['time'] = 'time';
$this->doctrineTypeMapping['datetimeoffset'] = 'datetimetz';
}
/**
......
......@@ -957,7 +957,6 @@ class SQLServerPlatform extends AbstractPlatform
'real' => 'float',
'double' => 'float',
'double precision' => 'float',
'datetimeoffset' => 'datetimetz',
'smalldatetime' => 'datetime',
'datetime' => 'datetime',
'char' => 'string',
......
<?php
namespace Doctrine\Tests\DBAL\Platforms;
use Doctrine\DBAL\Platforms\SQLServer2008Platform;
use Doctrine\DBAL\Schema\Sequence;
class SQLServer2008PlatformTest extends SQLServerPlatformTest
{
public function createPlatform()
{
return new SQLServer2008Platform;
}
public function testGeneratesTypeDeclarationForDateTimeTz()
{
$this->assertEquals(
'DATETIMEOFFSET(6)',
$this->_platform->getDateTimeTzTypeDeclarationSQL(
array())
);
}
}
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