I see... ok thanks for explaining. It might help people in a similar situation.
In that case, when you loop through the users in your view with volt's {% for user in users %}
, the afterFetch() will be called naturally on each iteration.
However, instead of using afterFetch(), I might suggest something like the following in your case. That way, you can leave the model untouched and not worry about changing the values back/altering the dirty state.
// model
public function getAuditName()
{
switch ($this->audit) {
case '1':
return 'Approve';
break;
case '2':
return 'Unapprove';
break;
case '3':
return 'commit';
break;
etc....
}
}
// view
{% for user in users %}
{{ user.getAuditName() }}
{% endfor %}
thanks for your reply, and in my model Users where have a field named 'audit' and it's value is Int (1,2,3....). But in my view(volt) I will show it as 1-Approve,2-Unapprove,3-commit.... so there will many description and I will change it sometime. so I dont want to define it in view, I want to define it in model so when I find a model it outo change as description as CI do.