What I got is nothing!! I thought it will print the params 333,666, and type shit!!!888
But
I have removed the data/cache/module-config-cache.application.config.cache.php file before I test.
I have been working on it for several days, and don’t know how to move.
Ah, you wrote your own event manager, but that is not necessary and not recommended in a laminas-mvc application. Use the event manager of the application which you can access in a controller via:
public function indexAction()
{
$this->getEventManager()->trigger('my_event');
}
I just wanna to trigger the custom event inside the db model xxxTable 's save() method, that means I thought I don’t need to pass the eventmanager from action to save() method.
I wanna to trigger the event right directly in db table’s save() method without any eventmanager param into this method.
I am trying to decouple, just new it inside the save() method, that’s what I did above. But it seems I am on the wrong direction.
In a Controller action, it is very easy to access the eventmanager via $this->getEventManager(),
However If I wanna to use in a xxxTable’s save method, should I have to pass the eventmanager into save method via a param?
It seems creating a custom eventManager is useless. Before I wanna to new a instance inside a model method and trigger in the same place. I thought this way can decouple and no need to pass eventManager as param.