Skip to content

Instantly share code, notes, and snippets.

@sergiors
Last active December 16, 2015 15:08
Show Gist options
  • Save sergiors/b4f26a7bc92f8c42ae8b to your computer and use it in GitHub Desktop.
Save sergiors/b4f26a7bc92f8c42ae8b to your computer and use it in GitHub Desktop.
<?php
namespace Inbep\Component\Doctrine\DBAL\Platforms\Keywords;
use Doctrine\DBAL\Platforms\Keywords\PostgreSQL92Keywords;
/**
* @author Sérgio Rafael Siqueira <[email protected]>
*/
class PostgreSQL92ContribKeywords extends PostgreSQL92Keywords
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'PostgreSQL92Contrib';
}
/**
* {@inheritdoc}
*
* @link http://www.postgresql.org/docs/9.2/static/citext.html
*/
protected function getKeywords()
{
return array_merge(parent::getKeywords(), [
'CITEXT'
]);
}
}
<?php
namespace Inbep\Component\Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Platforms\PostgreSQL92Platform;
/**
* @author Sérgio Rafael Siqueira <[email protected]>
*/
class PostgreSQL92ContribPlatform extends PostgreSQL92Platform
{
/**
* {@inheritdoc}
*/
public function getCitextTypeDeclarationSQL(array $field)
{
return 'CITEXT';
}
/**
* {@inheritdoc}
*/
protected function getReservedKeywordsClass()
{
return '\Inbep\Component\Doctrine\DBAL\Platforms\Keywords\PostgreSQL92ContribKeywords';
}
/**
* {@inheritdoc}
*/
protected function initializeDoctrineTypeMappings()
{
parent::initializeDoctrineTypeMappings();
$this->doctrineTypeMapping['citext'] = 'text';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment