Hello,
I have a question regarding models and column mapping in phalcon. Usually we define models as following:
class Test extends \Phalcon\Mvc\Model
{
public $id;
public $customerName;
public function getSourse()
{
return 'tablename';
}
}
But currently i have tables, where column names are not suitable for phalcon (for example, some of them are named with uppercase first letter), so i decided to use columnMap() method. When using this method, should i define public properties for my model, and if i should - should they represent application model column names, or database column names?
e.g. i have a table with columns "id" and "CustomerName". to make phalcon support native methods like Model::findFirstByCustomerName() without implementing this method in model, i need to have property customerName starting from lowecase letter. So, i would use the following method to describe this:
public function columnMap()
{
return [
'Id' => 'id',
'CustomerName' => 'customerName',
];
}
After using this method, should i define any public properties? if i should, they will be "id" and "customerName" (column names in application) or "Id" and "CustomerName", as they are named in mysql table?
P.S. Also found this topic about case sensitivity... perhaps it is better solution? https://languagelink.ru/centers/novoslobodskaya.php