Skip to content

Commit 6fbeb89

Browse files
committed
Merge remote-tracking branch 'upstream/master' into request-param-optional-origin-name
2 parents 7789cf2 + 37bd3e1 commit 6fbeb89

File tree

4 files changed

+91
-4
lines changed

4 files changed

+91
-4
lines changed

Controller/ExceptionController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@ protected function getExceptionMessage($exception)
173173
$exceptionMap = $this->container->getParameter('fos_rest.exception.messages');
174174
$showExceptionMessage = $this->isSubclassOf($exception, $exceptionMap);
175175

176-
return $showExceptionMessage || $this->container->get('kernel')->isDebug() ? $exception->getMessage() : '';
176+
return $showExceptionMessage || $this->container->get('kernel')->isDebug()
177+
? $exception->getMessage()
178+
: Response::$statusTexts[$this->getStatusCode($exception)];
177179
}
178180

179181
/**
@@ -186,7 +188,7 @@ protected function getExceptionMessage($exception)
186188
protected function getStatusCode($exception)
187189
{
188190
$exceptionMap = $this->container->getParameter('fos_rest.exception.codes');
189-
$isExceptionMappedToStatusCode = $this->isSubclassOf($exception, $exceptionMap);;
191+
$isExceptionMappedToStatusCode = $this->isSubclassOf($exception, $exceptionMap);
190192

191193
return ($isExceptionMappedToStatusCode) ? $isExceptionMappedToStatusCode : $exception->getStatusCode();
192194
}

EventListener/ParamFetcherListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function onKernelController(FilterControllerEvent $event)
5959
if ($this->setParamsAsAttributes) {
6060
$params = $paramFetcher->all();
6161
foreach ($params as $name => $param) {
62-
if ($request->attributes->has($name) and null !== $request->attributes->get($name)) {
62+
if ($request->attributes->has($name) && null !== $request->attributes->get($name)) {
6363
$msg = sprintf("ParamFetcher parameter conflicts with a path parameter '$name' for route '%s'", $request->attributes->get('_route'));
6464
throw new \InvalidArgumentException($msg);
6565
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
Full default annotations
2+
==========================
3+
4+
### Param fetcher
5+
6+
#### QueryParam
7+
8+
```php
9+
use FOS\RestBundle\Controller\Annotations\QueryParam;
10+
11+
/**
12+
* @QueryParam(
13+
* name="",
14+
* requirements="",
15+
* default=null,
16+
* description="",
17+
* strict=false,
18+
* array=false,
19+
* nullable=false
20+
* )
21+
*/
22+
```
23+
24+
#### RequestParam
25+
26+
```php
27+
use FOS\RestBundle\Controller\Annotations\RequestParam;
28+
29+
/**
30+
* @RequestParam(
31+
* name="",
32+
* requirements="",
33+
* default=null,
34+
* description="",
35+
* strict=true,
36+
* array=false,
37+
* nullable=false
38+
* )
39+
*/
40+
```
41+
42+
### View
43+
44+
```php
45+
use FOS\RestBundle\Controller\Annotations\View;
46+
47+
/**
48+
* @View(
49+
* templateVar="",
50+
* statusCode=null,
51+
* serializerGroups={},
52+
* populateDefaultVars=true,
53+
* serializerEnableMaxDepthChecks=false
54+
* )
55+
*/
56+
```
57+
58+
### Routing
59+
60+
#### Route prefix
61+
62+
```php
63+
use FOS\RestBundle\Controller\Annotations\Prefix;
64+
65+
/**
66+
* @Prefix("")
67+
*/
68+
```
69+
70+
#### Route name prefix
71+
72+
```php
73+
use FOS\RestBundle\Controller\Annotations\NamePrefix;
74+
75+
/**
76+
* @NamePrefix("")
77+
*/
78+
```
79+
80+
#### Route
81+
82+
RestBundle extends the [@Route](http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/routing.html) annotation from Symfony.
83+
84+
@Delete @Get @Head @Link @Patch @Post @Put @Unlink have the same options as @Route

Resources/doc/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ FOSRestBundle provides several tools to assist in building REST applications:
2323
- [Manual definition of routes](7-manual-route-definition.md)
2424

2525
### Config reference
26-
Check out the [configuration reference](configuration-reference.md) for a reference on the available configuration options.
2726

27+
- [Configuration reference](configuration-reference.md) for a reference on the available configuration options
28+
- [Annotations reference](annotations-reference.md) for a reference on on the available configurations through annotations
2829

2930
### Example application(s)
3031

0 commit comments

Comments
 (0)