📅  最后修改于: 2022-03-11 14:53:42.495000             🧑  作者: Mango
em = $em;
$this->security = $security;
}
public function onTerminate() {
$user = $this->security->getUser();
if (!$user->isActiveNow()) {
$user->setLastActivityAt(new \DateTime());
$this->em->flush($user);
}
}
public static function getSubscribedEvents() {
return [
// must be registered before (i.e. with a higher priority than) the default Locale listener
KernelEvents::TERMINATE => [['onTerminate', 20]],
];
}
}