I am trying to inject the currently logged in user into a service. My goal is to extend some twig functionality to output it based on user preferences. In this example I wan
services.yml
my_service: class: ... arguments: - "@=service('security.token_storage').getToken().getUser()"
Service.php
protected $currentUser; public function __construct($user) { $this->currentUser = $user; }
http://symfony.com/doc/current/book/service_container.html#using-the-expression-language