-1

I try to execute a post request, but it shows me this error Argument 1 passed to x::addPhoto() must be an instance of y, string given, this argument in my case is the current authenticated user, i use this code to have it:

    $user= $this->get('security.context')->getToken()->getUser();

but this code does not give a user instance as result , it gives me a string, how to solve that please ?

anony
  • 185
  • 2
  • 14

1 Answers1

0

Solved, I had a problem of class mapping,

     $user= $this->get('security.context')->getToken()->getUser();

this code works in symfony 2.8, thank you for your responses

anony
  • 185
  • 2
  • 14