I see many events (beforeUpdate, beforeSave etc) but I want to convert a value to real boolean right after its "find" or "findFirst"-ed. How can I do it?
Class Model { public $bool; function afterFetch(){ if php >= 5.5. $this->bool = boolval($this->bool); else $this->bool = (bool) $this->bool }
If i understand you right, a user had same issue few days ago. Check this topic and the accepted answer: https://forum.phalcon.io/discussion/9095/model-describe
Tell us if that helped you.
@kisb2 Izo's solution is cleaner then mine;
@izopi4a thanks for sharing, i kinda missed that from the docs, really usefull!
yea, right. Actually I was browsing at https://docs.phalcon.io/en/latest/reference/models.html#events-and-events-manager but "afterFetch" is not in that "Events and Events Manager" table
UPDATE: but it wont effect the resultset if I convert it to array (->toArray();)
show me you db connection, the whole piece of the pie :D . Without the password ofcourse