Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix : "Sensio\Bundle\FrameworkExtraBundle\Configuration\Route" is deprecated

Tags:

php

symfony

Symfony Version: 4.1

I have the following deprecation message when I run my tests with PHPUnit:

The annotation "Sensio \ Bundle \ FrameworkExtraBundle \ Configuration \ Route" is deprecated since version 5.2. Use "Symfony \ Component \ Routing \ Annotation \ Route" instead.

I want to clarify that I put in my framework.yaml:

sensio_framework_extra:
     router:
         annotations: false

I also want to clarify that I have no use Sensio \ Bundle \ FrameworkExtraBundle \ Configuration \ Route in my controllers.

I use FOSRestBundle and I get the impression that the problem comes from there, but I tried to fix the configuration provided in the FOSREST documentation.

Have you had this type of error and / or do you know where I should look?

like image 241
BibDev Avatar asked Jul 06 '18 10:07

BibDev


4 Answers

Actually it's not an error, but deprecation notice. Check for "sensio/framework-extra-bundle" in composer.json, it might be there.

But to remove deprecation message add the following lines to your config.yml file

sensio_framework_extra:
 router:
     annotations: false

See attached image.

enter image description here

like image 197
JuZer Avatar answered Nov 12 '22 03:11

JuZer


Sensio\Bundle\FrameworkExtraBundle\Configuration\Route is deprecated.

Use Symfony\Component\Routing\Annotation\Route

like image 43
Anshuman Srivastava Avatar answered Nov 12 '22 01:11

Anshuman Srivastava


The setting does not disable the warning, why would it?

You are still using the annotation, you should be aware. The trigger_error is unconditional, see: https://github.com/sensiolabs/SensioFrameworkExtraBundle/blob/master/Configuration/Route.php#L16

I would not worry too much about it. FOS REST will catch up.

like image 1
Padam87 Avatar answered Nov 12 '22 03:11

Padam87


Remove totaly the framework composer remove sensio/framework-extra-bundle dont fogret to delete the instance requirement from appKernel.php

like image 1
famas23 Avatar answered Nov 12 '22 01:11

famas23