I am trying to get all the event types using this code:
class News extends Phalcon\Mvc\Model
{
public function initialize()
{
$eventsManager = new \Phalcon\Events\Manager();
$eventsManager->attach('model', function($event, $robot) {
print_r($event->getType());
return true;
});
}
...
but it never gets triggered (on save, view, etc.). Am I doing something wrong?
In fact what I want is to have "on load" event where to change the properties of the model on every loaded record from db (for example if I have a field with json and want to convert it to an array). Is it possible?