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

Phalcon3 - ColumnMap not working

Hello Everyone,

This morning I updated my local version of phalcon to Phalcon 3.0.0 and I noticed that the columnMap in my model is not working.

For example,

My table in database has the primary key named like "flower_id"

in my model I have a property named

class Flower extends Model
    {
           public $flower_id

          public function columnMap()
              {
                  return array(
                  'flower_id'  => 'id',
                  'name' => 'name',
              );
    }

so that way I can refer to that property as

$my_flower = Flower::findFirstById($id);

later in my code...

$id = $my_flower->id;

Insted of $my_flower->flower_id;

After the upgrade, this property is null.

Does any one have any idea why?



145.0k
Accepted
answer

Try to remove flower_id property maybe ?

It works!

I guess it makes sense. Old version didn't care about it.

Thanks