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

Model columnMap

I have a table with several columns but I want to rename only a few, it generates an error if I do not rename all

Column 'fk_loja' doesn't make part of the column map

<?php
namespace App\ORM;

use Phalcon\Mvc\Model;

class Product extends Model
{
    public $id;

    public $name;

    public function initialize()
    {
        $this->setSource('produtos');
    }

    public function columnMap()
    {
        return [
            'id_produto' => 'id',
            'name' => 'produto',
            'fk_moeda' => 'fk_moeda',
        ];
    }
}

Retrieves the list of the model's columns and add to this array those that are not already there with index = value like fk_moeda .