基于https://github.com/DamienHarper/DoctrineAuditBundle我正在尝试为我的 Zend Expressive 应用程序开发审计模块。但我不知道如何在审计逻辑中获取用户数据(id)。
我看到这$user
是作为请求属性传递的
vendor/zendframework/zend-expressive-authentication/src/AuthenticationMiddleware.php
,但这并不能通过
$container->get(\Psr\Http\Message\ServerRequestInterface::class)->getAttribute(\Zend\Expressive\Authentication\UserInterface::class);