We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

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;

edited Dec '14

For apc https://php.net/manual/ru/function.apc-clear-cache.php

What plugin or module gives this output: ?


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.