Upgrading From 1.x To 2.0 ========================= * The `RedirectView` and `RouteRedirectView` classes were removed. Use `View::createRedirect()` and `View::createRouteRedirect()` instead. **Note**: the default status code for a route redirect has changed from HTTP_CREATED (201) to HTTP_FOUND (302). * The `FOS\RestBundle\Util\ViolationFormatter` class and the `FOS\RestBundle\Util\ViolationFormatterInterface` were removed. Catch specialized exception classes instead of checking specific exception messages. * The `ViolationFormatterInterface` argument of the constructor of the `ParamFetcher` class was removed. * The SensioFrameworkExtraBundle view annotations must be enabled to use the `ViewResponseListener`: ```yml # app/config/config.yml sensio_framework_extra: view: annotations: true ``` * dropped support for the legacy `Symfony\Component\Validator\ValidatorInterface` * removed `FOS\RestBundle\Util\Codes` in favor of `Symfony\Component\HttpFoundation\Response` constants * compatibility with Symfony <2.7, JMS Serializer/SerializerBundle <1.0 and SensioFrameworkExtraBundle <3.0 was dropped * constructor signature of DisableCSRFExtension was changed * constructor signatures of most of the classes which used the container were changed * removed `callback_filter` configuration option for the `jsonp_handler` * removed `fos_rest.format_listener.media_type` configuration option. Use the versioning section instead: ```yml # config.yml versioning: true ``` * the `exception_wrapper_handler` config option was removed. Use normalizers instead. Before: ```yml # config.yml fos_rest: view: exception_wrapper_handler: AppBundle\ExceptionWrapperHandler ``` ```php namespace AppBundle; class ExceptionWrapperHandler implements ExceptionWrapperHandlerInterface { public function wrap($data) { return new ExceptionWrapper(array('status_code' => 'foo')); } } ``` After (if you use the Symfony serializer): ```yml # services.yml services: app_bundle.exception_normalizer: class: AppBundle\Normalizer\ExceptionNormalizer tags: - { name: serializer.normalizer } ``` ```php namespace AppBundle\Normalizer; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; class ExceptionNormalizer implements NormalizerInterface { public function normalize($object, $format = null, array $context = array()) { return array('status_code' => 'foo'); } public function supportsNormalization($data, $format = null) { return $data instanceof \My\Exception; } } ``` * removed all `.class` parameters, instead overwriting services via explicit Bundle configuration is preferred * renamed `AbstractScalarParam::$array` to `AbstractScalarParam::$map` Before: ```php namespace AppBundle\Controller; class MyController { /** * @RequestParam(name="foo", array=true) */ public function myAction() { // ... } } ``` After: ```php namespace AppBundle\Controller; class MyController { /** * @RequestParam(name="foo", map=true) */ public function myAction() { // ... } } ``` * added `ControllerTrait` for developers that prefer to use DI for their controllers instead of extending ``FOSRestController`` * when having an action called ``lockUserAction``, then it will have to use the http method ``LOCK`` (RFC-2518) instead of ``PATCH``. The following methods are affected by this change: * `COPY` * `LOCK` * `MKCOL` * `MOVE` * `PROPFIND` * `PROPPATCH` * `UNLOCK` * removed the ability of the `AccessDeniedListener` to render a response. Use the FOSRestBundle or the twig exception controller in complement. Before: ```yml # config.yml fos_rest: access_denied_listener: true ``` After: ```yml # config.yml fos_rest: access_denied_listener: true exception: true # Activates the FOSRestBundle exception controller ``` * changed the priority of `RequestBodyParamConverter` to `-50` * made silent the `RequestBodyParamConverter` when a parameter is optional and it can't resolve it * removed the `format_negotiator` option `exception_fallback_format`; you can match the `ExceptionController` thanks to the `attributes` option instead Before: ```yml # config.yml fos_rest: format_listener: rules: - { path: ^/, fallback_format: html, exception_fallback_format: json } ``` After: ```yml # config.yml fos_rest: format_listener: rules: # instead of the the twig controller it can also be 'fos_rest.exception.controller:showAction' if the TwigBundle # is not enabled or a custom exception controller that you configured in fos_rest.exception.exception_controller - { path: ^/, fallback_format: json, attributes: { _controller: 'fos_rest.exception.twig_controller:showAction' } } - { path: ^/, fallback_format: html } ``` * `View::setSerializationContext` and `View::getSerializationContext` have been removed. Use `View::setContext` and `View::getContext` together with the new Context class instead. Before: ```php use JMS\Serializer\SerializationContext; $view = new View(); $context = new SerializationContext(); $view->setSerializationContext($context); $context = $view->getSerializationContext(); ``` After: ```php use FOS\RestBundle\Context\Context; $view = new View(); $context = new Context(); $view->setContext($context); $context = $view->getContext(); ```
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
.github | Folder | 0755 |
|
|
Context | Folder | 0755 |
|
|
Controller | Folder | 0755 |
|
|
Decoder | Folder | 0755 |
|
|
DependencyInjection | Folder | 0755 |
|
|
ErrorRenderer | Folder | 0755 |
|
|
EventListener | Folder | 0755 |
|
|
Exception | Folder | 0755 |
|
|
Form | Folder | 0755 |
|
|
Inflector | Folder | 0755 |
|
|
Negotiation | Folder | 0755 |
|
|
Normalizer | Folder | 0755 |
|
|
Request | Folder | 0755 |
|
|
Resources | Folder | 0755 |
|
|
Response | Folder | 0755 |
|
|
Routing | Folder | 0755 |
|
|
Serializer | Folder | 0755 |
|
|
Tests | Folder | 0755 |
|
|
Util | Folder | 0755 |
|
|
Validator | Folder | 0755 |
|
|
Version | Folder | 0755 |
|
|
View | Folder | 0755 |
|
|
.gitignore | File | 70 B | 0644 |
|
.php_cs | File | 589 B | 0644 |
|
.styleci.yml | File | 61 B | 0644 |
|
.travis.yml | File | 1.07 KB | 0644 |
|
CHANGELOG.md | File | 16.53 KB | 0644 |
|
FOSRestBundle.php | File | 2.02 KB | 0644 |
|
LICENSE | File | 1.08 KB | 0644 |
|
README.md | File | 2.11 KB | 0644 |
|
UPGRADING-2.0.md | File | 5.82 KB | 0644 |
|
UPGRADING-2.1.md | File | 413 B | 0644 |
|
UPGRADING-2.8.md | File | 6.04 KB | 0644 |
|
UPGRADING-3.0.md | File | 7.02 KB | 0644 |
|
composer.json | File | 3.3 KB | 0644 |
|
phpunit | File | 399 B | 0644 |
|
phpunit.xml.dist | File | 716 B | 0644 |
|