-1
如何將服務注入當前用戶對象?Symfony:將服務注入用戶對象
使用當前用戶對象我的意思是這樣的:
//in controller
$user = $this->get('security.token_storage')->getToken()->getUser();
//later I want to do this in the user class:
function getData() {
$data = $this->getSomeData();//normal function
$data += $this->getMyService()->getSomeMoreData();//invoke service function
}