// In any configuration file or piece of code that executes before the event
use Cake\Event\EventManager;
EventManager::instance()->on(
'Model.Order.afterPlace',
$aCallback
);
??
How to create Event class in plugin, and then use?
EvOne.php // yeah im lazy
use Cake\Event\EventListenerInterface;
class EvOne implements EventListenerInterface
{
public function implementedEvents()
{
return [
'Model.Order.someEvent' => 'updateBuyStatistic',
];
}
public function updateBuyStatistic($event)
{
dd(1);
// Code to update statistics
}
}
this part in book: ‘Model.Order.afterPlace’, $aCallback
// In any configuration file or piece of code that executes before the event
use Cake\Event\EventManager;
EventManager::instance()->on(
'Model.Order.afterPlace',
$aCallback
);