Symfony3升级时的命名空间问题

时间:2015-12-19 16:48:58

标签: namespaces upgrade symfony

我目前正在尝试将我的Symfony2应用程序升级到Symfony3。我有SecurityController覆盖FOSUserBundle\SecurityController

namespace Acme\MyBundle\Controller;

use Symfony\Component\DependencyInjection\ContainerAware;

class SecurityController extends ContainerAware
{
    // ...
}

但我得到ClassNotFoundException

  

尝试加载类" ContainerAware"来自命名空间" Symfony \ Component \ DependencyInjection"。
  你忘记了"使用"另一个命名空间的语句?

我在upgrade notes中找不到任何更改。有人能指出我的方法来解决这个问题吗?

1 个答案:

答案 0 :(得分:5)

由于此PR的更改,ContainerAware已在2.8中弃用,并在3.0中删除,转而使用ContainerAwareTrait