-
The
RedirectViewandRouteRedirectview classes were removed. UseView::createRedirect()andView::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\ViolationFormatterclass and theFOS\RestBundle\Util\ViolationFormatterInterfacewere removed. Catch specialized exception classes instead of checking specific exception messages. -
The
ViolationFormatterInterfaceargument of the constructor of theParamFetcherclass was removed. -
The SensioFrameworkExtraBundle view annotations must be enabled to use the
ViewResponseListener:# app/config/config.yml sensio_framework_extra: view: annotations: true
-
dropped support for the legacy
Symfony\Component\Validator\ValidatorInterface -
removed
FOS\RestBundle\Util\Codesin favor ofSymfony\Component\HttpFoundation\Responseconstants -
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_filterconfiguration option for thejsonp_handler -
removed
fos_rest.format_listener.media_typeconfiguration option. Use the versioning section instead:# config.yml versioning: true
-
the
exception_wrapper_handlerconfig option was removed. Use normalizers instead.Before:
# config.yml fos_rest: view: exception_wrapper_handler: AppBundle\ExceptionWrapperHandler
namespace AppBundle; class ExceptionWrapperHandler implements ExceptionWrapperHandlerInterface { public function wrap($data) { return new ExceptionWrapper(array('status_code' => 'foo')); } }
After (if you use the Symfony serializer):
# services.yml services: app_bundle.exception_normalizer: class: AppBundle\Normalizer\ExceptionNormalizer tags: - { name: serializer.normalizer }
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
.classparameters, instead overwriting services via explicit Bundle configuration is preferred -
renamed
AbstractScalarParam::$arraytoAbstractScalarParam::$mapBefore:
namespace AppBundle\Controller; class MyController { /** * @RequestParam(name="foo", array=true) */ public function myAction() { // ... } }
After:
namespace AppBundle\Controller; class MyController { /** * @RequestParam(name="foo", map=true) */ public function myAction() { // ... } }
-
added
ControllerTraitfor developers that prefer to use DI for their controllers instead of extendingFOSRestController -
when having an action called
lockUserAction, then it will have to use the http methodLOCK(RFC-2518) instead ofPATCH. The following methods are affected by this change:COPYLOCKMKCOLMOVEPROPFINDPROPPATCHUNLOCK
-
removed the ability of the
AccessDeniedListenerto render a response. Use the FOSRestBundle or the twig exception controller in complement.Before:
# config.yml fos_rest: access_denied_listener: true
After:
# config.yml fos_rest: access_denied_listener: true exception: true # Activates the FOSRestBundle exception controller
-
changed the priority of
RequestBodyParamConverterto-50 -
made silent the
RequestBodyParamConverterwhen a parameter is optional and it can't resolve it -
removed the
format_negotiatoroptionexception_fallback_format; you can match theExceptionControllerthanks to theattributesoption insteadBefore:
# config.yml fos_rest: format_listener: rules: - { path: ^/, fallback_format: html, exception_fallback_format: json }
After:
# config.yml fos_rest: format_listener: rules: - { path: ^/, fallback_format: json, attributes: { _controller: FOS\RestBundle\Controller\ExceptionController } } - { path: ^/, fallback_format: html } }
-
View::setSerializationContextandView::getSerializationContexthave been removed. UseView::setContextandView::getContexttogether with the new Context class instead.Before:
use JMS\Serializer\SerializationContext; $view = new View(); $context = new SerializationContext(); $view->setSerializationContext($context); $context = $view->getSerializationContext();
After:
use FOS\RestBundle\Context\Context; $view = new View(); $context = new Context(); $view->setContext($context); $context = $view->getContext();