Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Duplicate
-
Affects Version/s: 2.0.1
-
Fix Version/s: None
-
Component/s: Platforms, Schema Managers
-
Labels:None
-
Environment:Ubuntu 10.10 64-bit running Apache, MySQL.
Description
At my dev. site I run
$validator = new \Doctrine\ORM\Tools\SchemaValidator($em);
$errors = $validator->validateMapping();
$inSync = $validator->schemaInSyncWithMetadata();
in my bootstrap. After adding B. Eberlei's excellent Versionable behavior from his DoctrineExtensions (https://github.com/beberlei/DoctrineExtensions) on one of my classes, the schema would not validate any more. I tracked this down (hopefully correctly) to being a problem with the Doctrine\Schema\MySqlSchemaManager's call to getDoctrineTypeMapping($dbType) which relies on Doctrine\DBAL\Platforms\MySqlPlatform::initializeDoctrineTypeMappings().
When this getDoctrineTypeMapping($dbType) is executed with a $dbType == 'longtext' --> from SQL = "DESCRIBE dc_versionable_resource", the value 'text' is returned based on the mappings set in Doctrine\DBAL\Platforms\MySqlPlatform::initializeDoctrineTypeMappings()
This in turn leads to MySqlSchemaManager::_getPortableTableColumnDefinition() returning:
new Column($tableColumn['field'], \Doctrine\DBAL\Types\Type::getType($type), $options); which at that time equals:
new Column('versioned_data',
\Doctrine\DBAL\Types\Type::getType('text'),
array(
'unsigned' => 0
'fixed' => 0
'notnull' => 1
'autoincrement'=> 0
)
);
Seems like a bit of an ambiguity as CLOBS (mapping-type = array) is represented as LONGTEXT and so are text fields.
A solution might be to be less restrict on comparison in \Doctrine\ORM\Tools\SchemaValidator::schemaInSyncWithMetadata() allowing Doctrine\DBAL\Types\TextType to pass as Doctrine\DBAL\Types\ArrayType... but, its a bit dirty - I know :-/
Issue Links
- duplicates
-
DBAL-42
Use column comments for further Doctrine Type Inference
-
Activity
| Field | Original Value | New Value |
|---|---|---|
| Description |
At my dev. site I run $validator = new \Doctrine\ORM\Tools\SchemaValidator($em); $errors = $validator->validateMapping(); $inSync = $validator->schemaInSyncWithMetadata(); in my bootstrap. After adding B. Eberlei's excellent Versionable behavior from his DoctrineExtensions (https://github.com/beberlei/DoctrineExtensions) on one of my classes, the schema would not validate any more. I tracked this down (hopefully correctly) to being a problem with the Doctrine\Schema\MySqlSchemaManager's call to getDoctrineTypeMapping($dbType) which relies on Doctrine\DBAL\Platforms\MySqlPlatform::initializeDoctrineTypeMappings(). When this getDoctrineTypeMapping($dbType) is executed with a $dbType == 'longtext' --> from SQL = "DESCRIBE dc_versionable_resource", the value 'text' is returned based on the mappings set in Doctrine\DBAL\Platforms\MySqlPlatform::initializeDoctrineTypeMappings() This in turn leads to MySqlSchemaManager::_getPortableTableColumnDefinition() returning: new Column($tableColumn['field'], \Doctrine\DBAL\Types\Type::getType($type), $options); which at that time equals: new Column('versioned_data', \Doctrine\DBAL\Types\Type::getType('text'), array( 'unsigned' => 0 'fixed' => 0 'notnull' => 1 'autoincrement'=> 0 ) ); Seems like a bit of an ambiguity as CLOBS (mapping-type = array) is represented as LONGTEXT and so may text fields. A solution might be to be less restrict on comparison in \Doctrine\ORM\Tools\SchemaValidator::schemaInSyncWithMetadata() allowing At my dev. site I run $validator = new \Doctrine\ORM\Tools\SchemaValidator($em); $errors = $validator->validateMapping(); $inSync = $validator->schemaInSyncWithMetadata(); in my bootstrap. After adding B. Eberlei's excellent Versionable behavior from his DoctrineExtensions (https://github.com/beberlei/DoctrineExtensions) on one of my classes, the schema would not validate any more. I tracked this down (hopefully correctly) to being a problem with the Doctrine\Schema\MySqlSchemaManager's call to getDoctrineTypeMapping($dbType) which relies on Doctrine\DBAL\Platforms\MySqlPlatform::initializeDoctrineTypeMappings(). When this getDoctrineTypeMapping($dbType) is executed with a $dbType == 'longtext' --> from SQL = "DESCRIBE dc_versionable_resource", the value 'text' is returned based on the mappings set in Doctrine\DBAL\Platforms\MySqlPlatform::initializeDoctrineTypeMappings() This in turn leads to MySqlSchemaManager::_getPortableTableColumnDefinition() returning: new Column($tableColumn['field'], \Doctrine\DBAL\Types\Type::getType($type), $options); which at that time equals: new Column('versioned_data', \Doctrine\DBAL\Types\Type::getType('text'), array( 'unsigned' => 0 'fixed' => 0 'notnull' => 1 'autoincrement'=> 0 ) ); Seems like a bit of an ambiguity as CLOBS (mapping-type = array) is represented as LONGTEXT and so may text fields. A solution might be to be less restrict on comparison in \Doctrine\ORM\Tools\SchemaValidator::schemaInSyncWithMetadata() allowing Doctrine\DBAL\Types\TextType to pass as Doctrine\DBAL\Types\ArrayType... but, its a bit dirty - I know :-/ |
At my dev. site I run $validator = new \Doctrine\ORM\Tools\SchemaValidator($em); $errors = $validator->validateMapping(); $inSync = $validator->schemaInSyncWithMetadata(); in my bootstrap. After adding B. Eberlei's excellent Versionable behavior from his DoctrineExtensions (https://github.com/beberlei/DoctrineExtensions) on one of my classes, the schema would not validate any more. I tracked this down (hopefully correctly) to being a problem with the Doctrine\Schema\MySqlSchemaManager's call to getDoctrineTypeMapping($dbType) which relies on Doctrine\DBAL\Platforms\MySqlPlatform::initializeDoctrineTypeMappings(). When this getDoctrineTypeMapping($dbType) is executed with a $dbType == 'longtext' --> from SQL = "DESCRIBE dc_versionable_resource", the value 'text' is returned based on the mappings set in Doctrine\DBAL\Platforms\MySqlPlatform::initializeDoctrineTypeMappings() This in turn leads to MySqlSchemaManager::_getPortableTableColumnDefinition() returning: new Column($tableColumn['field'], \Doctrine\DBAL\Types\Type::getType($type), $options); which at that time equals: new Column('versioned_data', \Doctrine\DBAL\Types\Type::getType('text'), array( 'unsigned' => 0 'fixed' => 0 'notnull' => 1 'autoincrement'=> 0 ) ); Seems like a bit of an ambiguity as CLOBS (mapping-type = array) is represented as LONGTEXT and so are text fields. A solution might be to be less restrict on comparison in \Doctrine\ORM\Tools\SchemaValidator::schemaInSyncWithMetadata() allowing Doctrine\DBAL\Types\TextType to pass as Doctrine\DBAL\Types\ArrayType... but, its a bit dirty - I know :-/ |
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Resolution | Fixed [ 1 ] |
| Resolution | Fixed [ 1 ] | |
| Status | Resolved [ 5 ] | Reopened [ 4 ] |
| Status | Reopened [ 4 ] | Resolved [ 5 ] |
| Resolution | Duplicate [ 3 ] |
| Workflow | jira [ 12376 ] | jira-feedback2 [ 17697 ] |
| Workflow | jira-feedback2 [ 17697 ] | jira-feedback3 [ 20052 ] |