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 ?