database field vs getter

  • My table has a field called ‘name’

  • My model has a function called getName() {return "X";}

I want the database field ‘name’ to be only accessible through the getName() function…

However when I create a new model

and call $model->name

Then the database field is returned

and the getName() is not called…

What am I missing here ?

Hi,

could you show code of getName() function?