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

How to suggest/request update to docs?

I would like to suggest ammending the documentation for "Public properties vs. Setters/Getters" ( https://docs.phalcon.io/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



145.0k
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.