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.

Problem with table columns with underscore


I'm trying to execute a SQL query:

    $query = $this->modelsManager->createQuery('SELECT Usuarios.xid,, UsuariosInfo.num_doc FROM Usuarios, UsuariosInfo');
    $users  = $query->execute();
    $this->view->usrs = new StdClass;
    $this->view->usrs = $users;

But I got this error:

Column 'num_doc' doesn't belong to the model or alias 'UsuariosInfo', when executing: SELECT Usuarios.xid,, UsuariosInfo.num_doc FROM Usuarios, UsuariosInfo

I have tried CamelCase:

$query = $this->modelsManager->createQuery('SELECT Usuarios.xid,, UsuariosInfo.NumDoc FROM Usuarios, UsuariosInfo');

But it doesn't work. What am I am doing wrong?


By the way, num_doc is a new column on my table. I have used the webtools to re-generate ALL models based on ALL tables. But I don't know why something is not updated.

I noticed this because another column with underscore works!


I apologyze, but I have deleted all files in /app/models/ and re-generate from scratch!

I realize that columnMap() function was not bee updated! That was the issue.

This ugly and radical action solved my problem, I will mark this comment as the "answer". If exist a best way to do it, please post it!

Thank you!