Upgrade to Symfony 3.0?

Video not working?

It looks like your browser may not support the H264 codec. If you're using Linux, try a different browser or try installing the gstreamer0.10-ffmpeg gstreamer0.10-plugins-good packages.

Thanks! This saves us from needing to use Flash or encode videos in multiple formats. And that let's us get back to making more videos :). But as always, please feel free to message us.

Upgrade to Symfony 3.0?

Now that we are upgraded to Symfony 2.2 it’s time to start preparing your application to work with 3.0!

On each release of Symfony, some functionality is deprecated and scheduled to be removed entirely later. For the first time, a few things have been deprecated and scheduled to be removed in Symfony 3.0.

To see them, check out the Symfony 3.0 CHANGELOG - through any of the 2.x releases, you can check out this file and find out how to be ahead of the game when it comes to future-compatability.

Routing Method and Scheme Changes

There’s not a lot in here yet, but there are a few really important things about routing! First, let’s update our route to use the _method and _scheme requirements:

fragments:
    pattern: /fragments
    defaults:
        _controller: EventBundle:NewFeatures:testFragmentsMobile
    host:    foo.%base_host%
    requirements:
        _method: GET|POST
        _scheme: https

All of this works before Symfony 2.2, and it says that this route should only match if the HTTP method is GET or POST and should force the user to use HTTPs.

As of 2.2, this syntax is deprecated, but won’t be removed until 3.0. Let’s update our routes to be Symfony3-compatible:

fragments:
    pattern: /fragments
    defaults:
        _controller: EventBundle:NewFeatures:testFragmentsMobile
    host:    foo.%base_host%
    methods: [GET, POST]
    schemes: https

Pattern to Path Routing Change

This will work today, tomorrow, and even for any Symfony3 version. Actually, there’s one more change that’s much more important than this: pattern has changed to path:

fragments:
    path: /fragments
    defaults:
        _controller: EventBundle:NewFeatures:testFragmentsMobile
    host:    foo.%base_host%
    methods: [GET, POST]
    schemes: https

This is all just a syntax change, and if you get in the habit of using the new way, you might just save yourself some heartache later when Symfony 3.0 is the greatest thing since sliced bread.

Time to go run and tell your friends that you’ve upgraded to Symfony 3.0! Ok, you haven’t actually of course, but if your friends aren’t programmers they won’t know what you’re talking about anyways.

Leave a comment!