I'm new in Symfony, I try to use Dependency injection to get User in a service (i think)
services.yaml :
App\Service\Test\RESTAuthenticatedService:
         calls:
             - method: getTrigramme
               arguments:
                   - '@security.token_storage'
In my RESTAuthenticatedService.php :
namespace App\Service\Test; .... class RESTAuthenticatedService extends AbstractController { protected $session; private $user; .... public function getTrigramme(){ $user = $this->token_storage->getToken()->getUser();
ERROR : 
Notice: Undefined property: App\Service\Test\PrestataireService::$token_storage
Can you help me please ?
Ok, first thanks everyone now I try what you said and i have this error :
Too few arguments to function App\Service\Test\ClientService::__construct(), 0 passed in D:\www\Interface_SAT\src\Controller\RecherchePrestataires.php on line 60 and exactly 2 expected
In my Controller RecherchePrestataires.php I have :
.....
public function rechercher(Request $request) {
....
    $recherchePresta = new PrestataireService();
In the file class PrestataireService I just have :
class PrestataireService extends ClientService { 
In ClientService :
    use Symfony\Component\HttpFoundation\Session\SessionInterface;
    use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
class ClientService extends RESTAuthenticatedService
{
    public $user;
    public function __construct(SessionInterface $session, TokenStorageInterface $tokenStorage)
    {
        parent::__construct($session, $tokenStorage);
        $this->setSession($session);
    }
And in RESTAuthenticatedService : I've done :
public function __construct(SessionInterface $session, TokenStorageInterface $tokenStorage)
    {
        $this->token_storage = $tokenStorage;
Sorry , but i try so many things.
 
    