Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Unknown column type "uniqueidentifier" requested. #24

Open
borschtel1 opened this issue Feb 5, 2016 · 0 comments
Open

Unknown column type "uniqueidentifier" requested. #24

borschtel1 opened this issue Feb 5, 2016 · 0 comments

Comments

@borschtel1
Copy link

I installed the MssqlBundle (master-dev) and when I try to update the database schema (php bin/console doctrine:schema:update --force) I will get the following error:

[Doctrine\DBAL\DBALException] Unknown column type "uniqueidentifier" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the known types with \Doctrine\DBAL\Types\Type::getTypesMap() . If this error occurs during database introspection then you might have forgot to register all database types for a Doctrine Type. Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement Type#getMappe dDatabaseTypes(). If the type name is empty you might have a problem with the cache or forgot some mapping information.

The problem is in "vendor/realestateconz/mssql-bundle/Realestate/MssqlBundle/Platforms/DblibPlatform.php" in this function:

`
protected function initializeDoctrineTypeMappings()
{
parent::initializeDoctrineTypeMappings();

    // add uniqueidentifier
    $this->doctrineTypeMapping['uniqueidentifier'] = 'uniqueidentifier';
    // use the geography type
    $this->doctrineTypeMapping['geography'] = 'geography';
    // define this column type as a string so it works properly for now
    $this->doctrineTypeMapping['hierarchyid'] = 'string';
}`

When you dump "$this->doctrineTypeMapping" right before "$this->doctrineTypeMapping['uniqueidentifier'] = 'uniqueidentifier';" you will see that there is already a mapping for "uniqueidentifier", but it is different: "uniqueidentifier" => "guid".

I think the GuidType is new to Doctrine. Do you have to remove this line and update your bundle?

Here my composer.json:
"require": { "doctrine/common": "^2.6", "doctrine/doctrine-bundle": "^1.6", "doctrine/doctrine-cache-bundle": "^1.2", "doctrine/orm": "^2.5", "friendsofsymfony/rest-bundle": "dev-master", "hautelook/templated-uri-router": "~1.0", "incenteev/composer-parameter-handler": "^2.0", "jms/serializer-bundle": "^1.1", "nelmio/api-doc-bundle": "^2.11", "php": ">=5.5.9", "realestateconz/mssql-bundle": "master-dev", "sensio/distribution-bundle": "^5.0", "sensio/framework-extra-bundle": "^3.0.2", "sensio/generator-bundle": "^3.0", "symfony/console": "^3.0", "symfony/monolog-bundle": "^2.8", "symfony/symfony": "2.8.*", "symfony/swiftmailer-bundle": "^2.3", "symfony/validator": "^3.0" },

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant