Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Multiple @Route statements #324

Closed
alex88 opened this Issue · 5 comments

3 participants

@alex88

Hello guys,

I've tried this code

/**
 * @Rest\Route("/user/details", defaults={"_format" = "json"})
 * @Rest\Route("/user/info", defaults={"_format" = "json"})
 * @Rest\View
 * 
 * Returns the actual logged user informations
 *
 * @return User $user the logged user, serialized
 */
public function infoAction()
{
    $user = $this->getUser();
    return array('user' => $user);
}

and I've seen that only the first route is matched. Instead, the SensioFrameworkExtraBundle's Route annotation permits to include multiple route statements as stated here:

http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/routing.html

Is it something related to this bundle or just a my problem?

@lsmith77
Owner

i cannot reproduce the issue:
https://github.com/liip/LiipHelloBundle/blob/master/Controller/ExtraController.php#L13

gives me:

$ app/console router:debug | grep extra
_extra_noname                     ANY    ANY      /liip/extra.{_format}
_extra_name                       ANY    ANY      /liip/extra/{name}.{_format}
@alex88

Strange, don't worry, I've switched over the bundle to a custom controller.

@alex88 alex88 closed this
@intel352

This is indeed a valid issue. The FosRest @Route (and aliases) annotation will only generate for the first given route.
@lsmith77's link to Liip isn't relevant, as it's using the Sensio route annotation, not FosRest.

@lsmith77
Owner

can you create a failing test case?

@lsmith77 lsmith77 reopened this
@intel352

I'll see if I can get to it later this weekend, in a crunch atm :-)

@blongden blongden referenced this issue from a commit
@jmikola jmikola Do not clobber existing client definitions (closes #336 and #324)
While we could have used an abstract definition, its ID would likely conflict with the alias we set for the default client. Remove the abstract definition altogether and simply construct new definitions for each client. This resolves the previous issue where multiple clients would overwrite the constructor arguments of the previous definition.
74d993b
@lsmith77 lsmith77 closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.