0
php.INFO: The "_method" requirement is deprecated since version 2.2 and will be removed in 3.0. Use the setMethods() method instead. 
{"type":16384,"file":"/martin/home/www/test/vendor/symfony/symfony/src/Symfony/Component/Routing/Route.php","line":652,"level":28928}

php -v PHP 5.5.9-1ubuntu4.21

Symfony version 2.8.18

Does someone get this also ? I'm trying to optimize the dev logging and get as few lines as possible.

Martin Fasani
  • 825
  • 7
  • 20

1 Answers1

1

You are getting this as a pre-caution before you decide to upgrade to Symfony 3. Since this is deprecated, you can (should) change your routing from something like:

$route = new Route();
$route->setPattern('/article/{id}');
$route->setRequirement('_method', 'POST|PUT');
$route->setRequirement('_scheme', 'https');

To:

$route = new Route();
$route->setPath('/article/{id}');
$route->setMethods(array('POST', 'PUT'));
$route->setSchemes('https');

Notice specially the change of setRequirement('_method', ... to setMethods() (what the dev log is suggesting basically).

You can find more info here: https://github.com/symfony/symfony/blob/master/UPGRADE-3.0.md

Sawant
  • 4,321
  • 1
  • 27
  • 30
  • Thanks for your reply. I just wanted to mention that I'm not using Routes like this in the code any way, only annotations like * @Method("POST") in some controller actions. – Martin Fasani Mar 09 '17 at 13:21
  • So it's probably under bundle that is still using _method. I suppose you could try searching the entire vendor directory for _method and then if you do find it see of that particular bundles has a 2.8 update. – Cerad Mar 09 '17 at 14:21
  • @MartinFasani You may not be doing it like this yourself. But that is what is creating that log. As Cerad mentioned, it may be in another bundle. – Sawant Mar 10 '17 at 13:32