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.

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 $myflower->flowerid;

After the upgrade, this property is null.

Does any one have any idea why?



99.6k
Accepted
answer

Try to remove flower_id property maybe ?

It works!

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

Thanks