Using Own Magic Get Method

Is it possible to use your own magic __get() method inside a model (ActiveRecord in my case)?

I got about 10 fields in a table that needs the same formatting before outputting. Normally i would do this in my afterFind() method (or creating a getXxxx() method), but it seems a bit stupid to do this the same 10 times in a row. I don’t want them to be formatted before they’re going in the database, only on retreiving.

I already tried this (because i want that the other get methods (like relations and stuff) still be working too:

public function __get($name)




But i get this error:

Calling unknown method: frontend\models\ModelName::___get()


You have three ‘_’ :))

Lol :D, you’re right thanks! It works now.