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.

Columns to camelCase


I'm using lower_case for table column naming, but i want to use camelCase inside my PHP scripts.

I wrote this in an own Model which extends \Phalcon\Mvc\Model:

public function columnMap()
    $columns = $this->getModelsMetaData()->getAttributes($this);
    $map = [];
    foreach ($columns as $column) $map[$column] = lcfirst(\Phalcon\Text::camelize($column));
    return $map;

It works, but does Phalcon cache column mapping? Or is there a better way to do this?

edited Aug '15

Phalcon devtools will generate a hard coded array column map too.