Skip to content

Instantly share code, notes, and snippets.

@raul782
Last active December 10, 2015 22:38
Show Gist options
  • Save raul782/4503180 to your computer and use it in GitHub Desktop.
Save raul782/4503180 to your computer and use it in GitHub Desktop.
Sql2005SpanishPlatform for Doctrine
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="sql2005.platform_service.class">Org\Bundle\BackendBundle\Doctrine\DBAL\Platforms\SQLServer2005SpanishPlatform</parameter>
</parameters>
<services>
<service id="sql2005.platform" class="%sql2005.platform_service.class%" />
</services>
</container>
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Org\Bundle\BackendBundle\Doctrine\DBAL\Platforms;
/**
* Platform to ensure compatibility of Doctrine with SQLServer2005 version and
* higher.
*
* Differences to SQL Server 2008 are:
*
* - DATETIME2 datatype does not exist, only DATETIME which has a precision of
* 3. This is not supported by PHP DateTime, so we are emulating it by
* setting .000 manually.
* - Starting with SQLServer2005 VARCHAR(MAX), VARBINARY(MAX) and
* NVARCHAR(max) replace the old TEXT, NTEXT and IMAGE types. See
* {@link http://www.sql-server-helper.com/faq/sql-server-2005-varchar-max-p01.aspx}
* for more information.
*/
use Doctrine\DBAL\Platforms\SQLServer2005Platform;
class SQLServer2005SpanishPlatform extends SQLServer2005Platform
{
/**
* {@inheritDoc}
*/
public function getDateTimeFormatString()
{
return 'd/m/Y H:i:s.000';
}
/**
* {@inheritDoc}
*/
public function getDateFormatString()
{
return 'd/m/Y H:i:s.000';
}
/**
* {@inheritDoc}
*/
public function getTimeFormatString()
{
return 'd/m/Y H:i:s.000';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment