Skip to content

Latest commit

 

History

History
179 lines (128 loc) · 8.4 KB

UPGRADING.md

File metadata and controls

179 lines (128 loc) · 8.4 KB

Upgrading

This document will be updated to list important BC breaks and behavioral changes.

upgrading to 2.0.0

  • 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\Codes in favor of Symfony\Component\HttpFoundation\Response

  • compatibility with Symfony <2.7, JMS Serializer/SerializerBundle <1.0 and SensioFrameworkExtraBundle <3.0 was dropped

  • RedirectView and RouteRedirectView view 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).

  • 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

  • exception_wrapper_handler is now the name of a service and not the name of a class

  • removed all .class parameters, instead overwriting services via explicit Bundle configuration is preferred

  • renamed AbstractScalarParam::$array to AbstractScalarParam::$map

  • 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.

  • 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

  • View::setSerializationContext and View::getSerializationContext have been removed. Use View::setContext and View::getContext together with the new Context class instead.

upgrading from 1.5.*

  • Dropped support for Symfony 2.2 (which includes dropping support for "pattern" in favor of only supporting "path" in routes), see FriendsOfSymfony#952
  • Dropped support for SensioFrameworkExtraBundle 2.x, see FriendsOfSymfony#952 (support for SensioFrameworkExtraBundle was added back in version 1.6.1 of the FOSRestBundle)

upgrading from 1.4.*

upgrading from 1.3.*

upgrading from 1.0.0-RC1

  • The Bundle no longer depends on "friendsofsymfony/rest" and as a result several class names have changed. Specifically FOS\Rest\Util\Codes is now FOS\RestBundle\Util\Codes and also the sub-namespace for the decoders has changed from FOS\Rest\Decoder to FOS\RestBundle\Decoder. In practice it should be sufficient to simply search replace FOS\Rest\ with ``FOS\RestBundle`.
  • The XmlDecoder now has a dependency on "symfony/serializer"

upgrading from 0.13.1

upgrading from 0.12.0

  • Route parameters cannot be set via setData anymore, please use a dedicated function setRouteParameters from now on

upgrading from 0.11.0

  • now requires JMSSerializerBundle 0.12
  • refactored the View class to drop the serializer specific methods in favor of setSerializationContext()
  • default version/groups will now only be applied if no SerializationContext was explicitly set on the View

upgrading from 0.10.0

  • now requires JMSSerializerBundle 1.0 (later renamed to 0.11) which is not compatible with Symfony2.0

upgrading from 0.9.0

  • the view response listener is now disabled by default. See enable view listener for how to enable it.
  • JMSSerializerBundle is now an optional dependency and therefore needs to be added explicitly

upgrading from 0.7.0

  • renamed "query" fetcher to "param" fetcher, this affects the configuration as well as the name of interfaces and request attributes
  • ViewHandler now only calls "createView()" in a single form instance set as "form" in the data array
  • removed "serializer_version" config option on favor of "serializer: ['version': ..]"

upgrading from 0.6.0

  • renamed [get|set]Objects*() to [get|set]Serializer*()
  • renamed the "objects_version: XXX" configuration option to "serializer: [version: XXX]"
  • moved serializer configuration code from ViewHandler::createResponse() to ViewHandler::getSerializer()
  • made ViewHandler::getSerializer() protected again

19 April 2012

  • Change route fallback action to PATCH instead of POST

Automatically generated routes will now fall back to the PATCH instead of the POST method.

More information in the docs, at this issue and this PR.

upgrading from 0.5.0_old_serializer

  • The ViewInterface is gone so you might have to change your controller config if you refer to the fos_rest.view service.

  • The View class is now split into a View (simple data container) and a ViewHandler (contains the actual rendering logic).

    The following code would need to be changed:

     public function indexAction($name = null)
     {
         $view = $this->container->get('fos_rest.view');
    
         if (!$name) {
             $view->setResourceRoute('_welcome');
         } else {
             $view->setParameters(array('name' => $name));
             $view->setTemplate(new TemplateReference('LiipHelloBundle', 'Hello', 'index'));
         }
    
         return $view->handle();
     }
    

    To the following code:

     public function indexAction($name = null)
     {
         if (!$name) {
             $view = \FOS\RestBundle\View\RouteRedirectView::create('_welcome');
         } else {
             $view = \FOS\RestBundle\View\View::create(array('name' => $name))
                 ->setTemplate(new TemplateReference('LiipHelloBundle', 'Hello', 'index'));
             ;
         }
    
         return $this->container->get('fos_rest.view_handler')->handle($view);
     }
    
  • The custom Serializer class was removed instead JMSSerializerBundle is now used, which replaces the concept of normalizers/encoders with the concept of visitors and handler