Jira issue originally created by user mjh_ca:
MySQL BLOB datatype appears to be breaking ClassMetadataExporter. Very new to Doctrine so hopefully I've isolated this correctly.
CREATE TABLE foo (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
// ... setup entitymanager ....
$cme = new \Doctrine\ORM\Tools\Export\ClassMetadataExporter();
$sm = $em->getConnection()->getSchemaManager();
$metadatas = $cme->getMetadatasForMappingSources();
$exporter = $cme->getExporter('annotation', '/path/to/annotations');
php -f doctrine Orm:convert-mapping --from-database --to=annotation --dest C:\www\app\models
Fatal error: Uncaught exception 'Doctrine\Common\DoctrineException' with message 'Unknown column type' in C:\www\app\lib\Doctrine\Common\DoctrineException.php:112
#0 [internal function]: Doctrine\Common\DoctrineException::**callStatic('unknownColumnTy...', Array)
#1 C:\www\app\lib\Doctrine\DBAL\Types\Type.php(125): Doctrine\Common\DoctrineException::unknownColumnType('blob')
#2 C:\www\app\lib\Doctrine\DBAL\Schema\MySqlSchemaManager.php(262): Doctrine\DBAL\Types\Type::getType('blob')
#3 C:\www\app\lib\Doctrine\DBAL\Schema\AbstractSchemaManager.php(802): Doctrine\DBAL\Schema\MySqlSchemaManager->_getPortableTableColumnDefinition(Array)
#4 C:\www\app\lib\Doctrine\DBAL\Schema\AbstractSchemaManager.php(221): Doctrine\DBAL\Schema\AbstractSchemaManager->_getPortableTableColumnList(Array)
#5 C:\www\app in C:\www\app\lib\Doctrine\Common\DoctrineException.php on line 112
Comment created by @beberlei:
You did isolate it correctly, we haven't gotten around to support BLOBs yet, because they are very complex to handle across different database vendors.
We probably should address this asap though for beta 2.
Comment created by romanb:
Unless I am missing something it should be easy to work around this by creating a custom type (that will, of course, be mysql-specific).
@Roman: I think the problem with custom types currently is that you cannot register them in Platform, giving you almost no chance to use custom types
Comment created by shurakai:
@Benjamin: Where exactly is the problem? DBAL\Types\Type supports adding custom types...
Mark as New Feature.
Blobs are so fundamentally different even across different PDO drivers that we might not implement them in Core, there is no common denominator we can abstract completely.
Comment created by extesy:
Please consider implementing this in Doctrine 2.1, my database uses blobs for storing some binary data therefore I can't use doctrine for schema updates anymore - it won't even product the migration sql script.
See http://www.doctrine-project.org/docs/orm/2.0/en/reference/basic-mapping.html#custom-mapping-types how to implement a blob type yourself.
We should look into creating binary streams for blobs using the data wrapper http://php.net/manual/en/wrappers.data.php for vendors that return strings. I have to look into it in detail though.
Implemented BLOB support
Issue was closed with resolution "Fixed"