I am trying to convert in a route the username to a user. Unfortunately the paramconverter searches always for the id.
I have already tried it with several settings, my current settings look like this:
/*
* @ParamConverter("username", class="StregoUserBundle:User")
* @Rest\View(serializerEnableMaxDepthChecks=true, serializerGroups={"Default","user"})
* @param User $user username
*/
public function getUserAction(User $username){
$return = array('user' => $user);
return $return;
}
The route itself is automatically defined by the FOSRestBundle and looks like this:
get_user GET ANY ANY /api/users/{username}.{_format}
What can I do that the user is found via the user name?