We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

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

Hey,

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!



3.6k

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?



3.6k

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.

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


6.3k
Accepted
answer
edited Dec '14

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

What plugin or module gives this output: ?



3.6k

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

$debug = new Phalcon\Debug();
$debug->listen();

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