Symfony 2.2 compatibility

Modified pull request for the new 2.2 branch