Add Binary MySQL type to doctrine for parsing old Phrasea Tables

This commit is contained in:
Romain Neutron
2012-02-23 17:54:10 +01:00
parent a5d0e3ec42
commit 01f2ef028a
2 changed files with 44 additions and 0 deletions

View File

@@ -273,10 +273,16 @@ class Doctrine extends ServiceAbstract implements ServiceInterface
Type::addType('varbinary', 'Types\VarBinary');
}
if (!Type::hasType('binary'))
{
Type::addType('binary', 'Types\Binary');
}
$platform->registerDoctrineTypeMapping('enum', 'enum');
$platform->registerDoctrineTypeMapping('blob', 'blob');
$platform->registerDoctrineTypeMapping('longblob', 'longblob');
$platform->registerDoctrineTypeMapping('varbinary', 'varbinary');
$platform->registerDoctrineTypeMapping('binary', 'binary');
return;
}

View File

@@ -0,0 +1,38 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
namespace Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Platforms\AbstractPlatform;
class Binary extends Type
{
const BINARY = 'binary';
public function getName()
{
return static::BINARY;
}
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
return $platform->getDoctrineTypeMapping('BINARY');
}
}