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.

Camelize column names in models.

There's any configuration to camelize column names in models? Example: make the column bar_baz in table foo be accessed like this:

$myFoo = new Foo();
echo $myFoo->barBaz;


No configuration, but you could overwrite __get() in a base model class, then have all your models extend that class

That wouldn't break the default implementation of __get()? I believe there's some crazy magic methods in there like findFirstByFoo(). I'm asking about a configuration because I believe that I've seen something similar somewhere (In the same place where you set that save() should throw an exception instead of returning false) but now I can't remeber where I read about that, surely not in the docs.

@cvsguimaraes, is columnMap what you need?

    public function columnMap()
        //Keys are the real names in the table and
        //the values their names in the application
        return array(
            'id' => 'code',
            'the_name' => 'theName',
            'the_type' => 'theType',
            'the_year' => 'theYear'

Found ya!!

But the options descriptions don't tell me much, I'll test these settings as soon I get to work again...

Still no clue of what 'columnRenaming' actully does... It just disables columnMap()?

I'll try to implement the the magic getter solution...