2
登錄後,我想在我的類中創建當前用戶對象而不創建服務。 Becauase我已經創建了當前的用戶插件和幫手。沒有創建服務的類中的當前用戶對象服務
所以,如果我需要當前的用戶對象在我的課,那麼如何獲得當前的用戶對象。
即,
class CoreFunction
{
public static curentUserData()
{
// i want user object here
}
}
在Zend框架2,我只是用:
class CoreFunction
{
public static curentUserData() {
$authService = $this->getServiceLocator()
->get('Zend\Authentication\AuthenticationService')
->getIdentity();
}
}
我如何在Zend框架3這樣做呢?