Made code compatible for Symfony 2.3