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.

Column 'storage' is not part of column map

Hey guys,

like the topic said, I've got a problem with a Model.

I developed my Site on my localhost with MAMP and everything just works as expected. Now I uploaded all files to my webhost and ex-/imported my database. And now on my webserver I get this error:

Column 'storage' is not part of the column map

And I don't know why, because I didn't change anything on my code or database. If I take a look into the Modelfile where this error comes from, everything is ok:

/**
 * Independent Column Mapping.
 */
public function columnMap()
{
    return array(
    'id' => 'id', 
    'name' => 'name', 
    'description' => 'description', 
    'att' => 'att', 
    'hp' => 'hp', 
    'shield' => 'shield', 
    'speed' => 'speed', 
    'storage' => 'storage',
    'sprit' => 'sprit', 
    'metal' => 'metal', 
    'silicium' => 'silicium'
    );
}

I already restarted my apache and nginx, but the problem is still there.

Hope someone can help me to fix this.

Fuhunter



85.4k

What models meta-data adapter are you using?

Also, you can freely remove that column map from your model if you aren't renaming any column.



9.5k
Accepted
answer
edited Sep '14

I'm using

    use Phalcon\Mvc\Model\Metadata\Memory as MetaDataAdapter;

    /**
     * If the configuration specify the use of metadata adapter use it or use memory otherwise
     */
    $di->set('modelsMetadata', function () {
    return new MetaDataAdapter();
    });

I commented column map out. Still the same error..

EDIT:

Found out that this request produces the error, but I don't know why.

        $ships = Ships::find(array(
            'id > 10'
            /*'cache' => array(
                'key' => 'attships',
                'lifetime' => 86400
                )*/
            ))->toArray();


25.7k
edited Jun '15

Isn't this a bug? I experienced the same thing today.

It is maybe a caching problem. Strange behaviour. Sometimes it fixes it self. Sometimes you try it few hours later and everything works, or you generate the model again



25.7k

I'm glad I found this post. I needed a sanity check.