forked from FriendsOfSymfony/FOSRestBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix route generator not ignoring body param converters (FriendsOfSymf…
…ony#1934) * fix route generator not ignoring body param converters When fetching a list of function parameters from a controller action for use as URL parameters, check for the @ParamConverter annotation. If a parameter has the annotation with the "fos_rest.request_body" converter, then ignore it and do not include it in the list of parameters (thus removing it from the URL). This allows automatic route generation and ParamConverter to co-exist, as otherwise a parameter that is expected to be derived from the body would also be included as a URL parameter, requiring the developer to manually specify the route. fixes FriendsOfSymfony#1198 * fix some small things after review * simplify FQN * fix cs * revert global namespace FQN simplification
- Loading branch information
Showing
3 changed files
with
59 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace FOS\RestBundle\Tests\Fixtures\Controller; | ||
|
||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; | ||
|
||
/** | ||
* @author Toni Van de Voorde <toni.vdv@gmail.com> | ||
*/ | ||
class ParamConverterController | ||
{ | ||
/** | ||
* @ParamConverter("something", converter="fos_rest.request_body") | ||
* | ||
* @param Something $something | ||
*/ | ||
public function postSomethingAction(Something $something) | ||
{ | ||
} | ||
} | ||
|
||
final class Something | ||
{ | ||
public $id; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters