通过将我的应用从Sf5切换到Sf6,我有属性问题的注解:
[Semantical Error] The annotation "@Security" in method App\Controller\MyController::delete() was never imported. Did you maybe forget to add a "use" statement for this annotation? in {"path":"..\/..\/src\/Controller\/","namespace":"App\\Controller"} (which is being imported from "/var/www/config/routes/attributes.yaml"). Make sure there is a loader supporting the "attribute" type.
1条答案
按热度按时间axzmvihb1#
第一步是将
config/routes.yaml
移动到config/routes/attributes.yaml
,并更新控制器路径(添加 ../),如www.example.com所述https://symfony.com/doc/current/routing.html#creating-routes-as-attributes第二步是将安全注解转换为属性。我使用rector将routes注解转换为属性,但我没有找到安全规则,所以做如下操作:
我用的是vim(neovim)rexeg
我删除了FrameworkExtraBundle上的use:
并删除了已弃用的FrameworkExtraBundle:
composer remove sensio/framework-extra-bundle
错误就消失了