fix problem with custom type for doctrine dbal

This commit is contained in:
Taras Machyshyn
2013-12-20 18:34:34 +02:00
parent cd02f4fe7b
commit b738ffe7db
3 changed files with 16 additions and 2 deletions
@@ -14,6 +14,11 @@ class Password extends Type
return self::PASSWORD;
}
public static function getDbTypeName()
{
return 'VARCHAR';
}
public function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
return $platform->getVarcharTypeDeclarationSQL($fieldDeclaration);
@@ -137,7 +137,7 @@ class Schema
}
}
return $result;
return (bool) $result;
}
@@ -360,7 +360,16 @@ class Comparator
{
$changedProperties = array();
if ( $column1->getType() != $column2->getType() ) {
$changedProperties[] = 'type';
//espo: fix problem with executing query for custom types
$column1DbTypeName = method_exists($column1->getType(), 'getDbTypeName') ? $column1->getType()->getDbTypeName() : $column1->getType()->getName();
$column2DbTypeName = method_exists($column2->getType(), 'getDbTypeName') ? $column2->getType()->getDbTypeName() : $column2->getType()->getName();
if (strtolower($column1DbTypeName) != strtolower($column2DbTypeName)) {
$changedProperties[] = 'type';
}
//$changedProperties[] = 'type';
//END: espo
}
if ($column1->getNotnull() != $column2->getNotnull()) {