3
votes

I have a Symfony 3.4 project and I have found below messages in profiler:

  1. “Sensio\Bundle\FrameworkExtraBundle\Configuration\Route” annotation is deprecated since version 5.2. Use “Symfony\Component\Routing\Annotation\Route”
  2. “Sensio\Bundle\FrameworkExtraBundle\Configuration\Method” annotation is deprecated since version 5.2. Use “Symfony\Component\Routing\Annotation\Route”
  3. “sensio_framework_extra.router.annotations” configuration is deprecated since version 5.2. Set it to false and use the “Symfony\Component\Routing\Annotation\Route”

I have spent some time on looking for a solution, but found nothing really helpful. Some findings here or here.

3
You didn't specify a question ... what do you want to reach?Jim Panse
Oh yes. I forgot to add "How to fix ...." I have it in my notepad and forgot to copy and paste. FixedStrabek

3 Answers

10
votes

Here is a solution I have found. This post helped me a lot with a tweak in no. 3 In no. 3 instead of adding config/packages/framework_extra.yaml, I have added that setting to my config.yml.

10
votes

Replace this:

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;

class UserController
    {
    /**
     * @Route("/users")
     * @Method("GET")
     */
    public action index()
        {}

With this:

use Symfony\Component\Routing\Annotation\Route;
class UserController
    {
    /**
     * @Route(path="/users", methods={"GET"})
     */

H/T this guy -> https://medium.com/@nebkam/symfony-deprecated-route-and-method-annotations-4d5e1d34556a

0
votes
Sensio\Bundle\FrameworkExtraBundle\Configuration\Route
Sensio\Bundle\FrameworkExtraBundle\Configuration\Method

is deprecated source

Use Symfony\Component\Routing\Annotation\Route

Symfony core annotation use