Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

PDOException: SQLSTATE[42S22]: bug or just me?


I have spent some time trying to find this out, but can't find it in the docs, and google couldn't help so maybe something else?

I renamed one of my colums from type -> role in mysql, and then everything stoped. This is the message:

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'user.type' in 'field list'

Would be thankfull for some help, and would love to help others with the same problem!


The think the mapping of the table wont update, if phalcon does something like that?

In the straight sql you can see it uses type, and not the updated "role".

If i rename the table, and create a new model, everything works fine, but i can go back to the old name then.

Are u use cache for metadata?


Are u use cache for metadata?

Ahh, there you have it. Yes, i am using metadata, thought this only stored sessions...

Now i just have to find out how to update it.

$di['modelsMetadata']   =   function() {
    //Creat a metadata manager with apc
    $metaData   =   new \Phalcon\Mvc\Model\MetaData\Apc([
        'lifetime'  =>  86400,
        'prefix'    =>  'metaData'
    return $metaData;


The debuger, just add this on top of your index.php:

$debug = new Phalcon\Debug();

The simplest solution would be to just update the prefix in the cache setup.