You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Resources/doc/5-automatic-route-generation_single-restful-controller.md
+26-23Lines changed: 26 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -283,47 +283,50 @@ use FOS\RestBundle\Controller\Annotations\Route;
283
283
}
284
284
```
285
285
286
-
### Change pluralization in generated routes
286
+
### Changing pluralization in generated routes
287
287
288
-
For everyone who wants to change pluralization in generated routes, you can do this by replacing "fos_rest.service.inflector" service with your implementation of "fos_rest.inflector.doctrine" service by creating new class that implements "FOS\RestBundle\Util\Inflector\InflectorInterface", than define service of this class with name e.g. "my_fos_rest.inflector.doctrine" and simply set parameter in config.yml.
288
+
If you want to change pluralization in generated routes, you can do this by replacing
289
+
"fos_rest.service.inflector" service with your own implementation of "fos_rest.inflector".
290
+
Create a new class that implements "FOS\RestBundle\Util\Inflector\InflectorInterface" and define a service of this
291
+
class with name e.g. "my_fos_rest.inflector" and set the parameter in config.yml.
289
292
290
-
The example below will remove pluralization by implementing the interface and returning the "$word" instead of executing method ```Inflector::pluralize($word);```
293
+
The example below will remove pluralization by implementing the interface and returning the "$word"
294
+
instead of executing method ```Inflector::pluralize($word);```
291
295
292
-
Define your service in config.yml
293
-
```
294
-
services:
295
-
yournamespace.yourbundle.util.inflector.doctrine:
296
-
class: YourNamespace\YourBundle\Util\Inflector
297
-
```
298
-
299
-
Tell fos_rest to use your own service as inflector, also in config.yml
**Tell fos_rest to use your own service as inflector, also in config.yml**
325
+
```
326
+
fos_rest:
327
+
service:
328
+
inflector: acme.hellobundle.util.inflector
329
+
```
330
+
328
331
## That was it!
329
332
[Return to the index](index.md) or continue reading about [Automatic route generation: multiple RESTful controllers](6-automatic-route-generation_multiple-restful-controllers.md).
0 commit comments