Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBAL-178: Unknown column type requested #1340

Closed
doctrinebot opened this issue Nov 2, 2011 · 10 comments
Closed

DBAL-178: Unknown column type requested #1340

doctrinebot opened this issue Nov 2, 2011 · 10 comments
Assignees
Milestone

Comments

@doctrinebot
Copy link

Jira issue originally created by user fmaz008:

When I run doctrine:schema:create, doctrine throw the following exception:
[Doctrine\DBAL\DBALException]
Unknown column type requested.

( Note: their is 2 spaces between type and requested )

The problem with this error message is how much it's unspecific. Event with -v, I still have no clue about that type is wrong, and what file is concerned.
So basically, I have to manually look at all my mapping files, one by one.

Also note that doctrine:mapping:info return all OK.

@doctrinebot
Copy link
Author

Comment created by dswindle:

Ironically, this same issue has recently started happening for me as well. It just started randomly over the weekend. Same exact issue (with 2 spaces between type and requested). For me, it happens when using Doctrine\ORM\EntityManager->find() on a valid entity.

#0 /doctrine-2.1.2/Doctrine/DBAL/DBALException.php(81): Doctrine\DBAL\DBALException::unknownColumnType()
#1 /doctrine-2.1.2/Doctrine/DBAL/Types/Type.php(140): Doctrine\DBAL\DBALException::unknownColumnType()
#2 /doctrine-2.1.2/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php(84): Doctrine\DBAL\Types\Type::getType()
#3 /doctrine-2.1.2/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php(43): Doctrine\ORM\Internal\Hydration\SimpleObjectHydrator->_hydrateRow()
#4 /doctrine-2.1.2/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php(99): Doctrine\ORM\Internal\Hydration\SimpleObjectHydrator->_hydrateAll()
#5 /doctrine-2.1.2/Doctrine/ORM/Persisters/BasicEntityPersister.php(581): Doctrine\ORM\Internal\Hydration\AbstractHydrator->hydrateAll()
#6 /doctrine-2.1.2/Doctrine/ORM/EntityRepository.php(130): Doctrine\ORM\Persisters\BasicEntityPersister->load()
#7 /doctrine-2.1.2/Doctrine/ORM/EntityManager.php(350): Doctrine\ORM\EntityRepository->find()

@doctrinebot
Copy link
Author

Comment created by gediminasm:

hi, seems like doctrine does not clean cache fully.

in my case I'm using APC cache
run: in php _apc_clear_cache('user');_

it should work fine now

PS.:
running cache clearing commands, does not help.

doctrine:cache:clear-metadata         Clears all metadata cache for a entity manager
doctrine:cache:clear-query            Clears all query cache for a entity manager
doctrine:cache:clear-result           Clears result cache for a entity manager

@doctrinebot
Copy link
Author

Comment created by fmaz008:

Hi,

@Gediminas : I don't have the error anymore so I can't test, but it's nice if there's a solution to fix it.

However, this error is problematic as it's anti-verbose.
There's is no indication of a cache problem in the error message. It try to point out to a field, and that field is not even displayed in the error.
I hope someone will be able to fix the error so that's it become a useful error, like by following some sort of guideline:

http://www.useit.com/alertbox/20010624.html

I don't want to troll or anything, but as I'Ve started using doctrine2 with symfony2, the MAJOR problem I've encountered what bad error message that was leaving me lost. Often I had -v, find the file where the error occurred, look at the code, understand by myself what's wrong and attempt to fix it. This is counter-productive and really show that the exception message doesn't follow most error message guide line. For sure, we're not end-users, but we're "programmer-user" that use the system, and this "title" come with a knowledge that is not the same as we could expect of a core-developer, for example.

I hope this message was constructive.

@doctrinebot
Copy link
Author

Comment created by @beberlei:

Improved this error message alot and also changed some regarding reverse engineering of custom types (where this error often occured):

You can now implement Type#getMappedDatabaseTypes(AbstractPlatform $platform); on your custom type and return a list of database types that this doctrine type maps to.

@doctrinebot
Copy link
Author

Issue was closed with resolution "Fixed"

@doctrinebot
Copy link
Author

Comment created by almogbaku:

this bug is still happening to me.. but its works as excepted within schema:create and throw error on schema:update or schema:drop

I using doctrine with symfony

@zaiddabaeen
Copy link

Issue still persists on Symfony3 with Doctrine 2.5.

Uncaught PHP Exception Doctrine\DBAL\DBALException: "Unknown column type "" 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#getMappedDatabaseTypes(). If the type name is empty you might have a problem with the cache or forgot some mapping information." at /var/www/mypoject/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php line 228

@ameshkin
Copy link

ameshkin commented Jan 6, 2018

same here. Im very new to this silex setup that uses this code

@Ocramius
Copy link
Member

Ocramius commented Jan 6, 2018

Please report it again with a test case: we can't really help otherwise.

@github-actions
Copy link

github-actions bot commented Aug 3, 2022

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants