We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Model data type casting

Hello everyone ! I spend some time looking for well solution to automaticlly cast data fetched from database and I didn't find out any elegant solution so I creat this thread. My question is: How I can implement type casting for model to ensure it always will be casted and to make this improvmed transparent? I don't want to rewrite whole application to use $model->getAge() instead of already using $model->age. I know PDO don't cast data itself (sic!) and comments in model classes are not ORM annotations.



2.8k
Accepted
answer