Archived
1
0
Fork 0

app/config/services.php: adding "eventsManager"

This commit is contained in:
Henrik Hautakoski 2018-04-01 19:35:09 +02:00
parent aab77e9608
commit b2ca9e3fba

View file

@ -30,7 +30,8 @@ use Httpcb\Auth,
Httpcb\Menu;
use App\Listener\AclListener,
App\Listener\DispatchListener;
App\Listener\DispatchListener,
App\Listener\ActivityLog;
/**
* The FactoryDefault Dependency Injector automatically register the right services providing a full stack framework
@ -216,6 +217,17 @@ $di->setShared('db', function () use ($di, $config) {
return $db;
});
$di->setShared('eventsManager', function () {
$activityLog = new ActivityLog();
$eventsManager = new Phalcon\Events\Manager();
$eventsManager->attach('user', $activityLog);
$eventsManager->attach('auth', $activityLog);
return $eventsManager;
});
/**
* If the configuration specify the use of metadata adapter use it or use memory otherwise
*/