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.

How to suggest/request update to docs?

I would like to suggest ammending the documentation for "Public properties vs. Setters/Getters" ( https://docs.phalconphp.com/en/latest/reference/models.html )

It should mention the fact that phalcon expects the getters for underscored_field_name to be changed to camelcase as in getUnderscoredFieldName() and NOT getUnderscored_field_name().

It would also be ideal to include a property for which the example can show this detail.

So, changes to docs. Do they go here? Or do they go elsewhere? Am I in the right place? Should I be talking to someoneone else?

Thank you, -Renic



114.4k
Accepted
answer

Thanks Wojciech - pull request created.

Also you know there is columnMap ? Right ? I don't like underscore field myself in php code and i always use columnmap to camelcase them and store underscore in base.

That is a better option - thanks again.

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

There is code for columnMap, so you don't need to put it yourself in each model. you can create abstractmodel for example with this.