Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #219 - route prefix ignored #424

Merged
merged 2 commits into from
Apr 7, 2013

Conversation

intel352
Copy link
Contributor

@intel352 intel352 commented Apr 7, 2013

Don't have much time, so can't donate a test as well, but I've verified that this fixes the missing prefix issue. Tested against yml prefix as well as class annotation prefix, with method @get annotation routes.

Fixes #219

@@ -192,7 +192,7 @@ public function read(RestRouteCollection $collection, \ReflectionMethod $method,
$annoRequirements['_method'] = $requirements['_method'];
}

$pattern = $annotation->getPattern() ?: $pattern;
$pattern = $annotation->getPattern() ? $this->routePrefix . '/' . ltrim($annotation->getPattern(), '/') : $pattern;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than join routePrefix to the pattern w/ a slash, how about this? $this->routePrefix . $annotation->getPattern()
That could possibly allow a prefix to be specified, and then joined to a pattern, without a slash (which is actually something I'd personally like in my own code). So rather than forcing a convention of a slash between prefix & pattern, it would boil down to how the prefix & pattern are defined in the developed app.

I'm thinking I like that approach better, and simplifies the code.

lsmith77 added a commit that referenced this pull request Apr 7, 2013
Fixes #219 - route prefix ignored
@lsmith77 lsmith77 merged commit 4fbb47c into FriendsOfSymfony:master Apr 7, 2013
@intel352 intel352 deleted the patch-1 branch April 7, 2013 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FOS\RestBundle\Controller\Annotations\Route ignores route prefix
2 participants