ClassNotFoundException Symfony UserBundle [英] ClassNotFoundException Symfony UserBundle

查看:112
本文介绍了ClassNotFoundException Symfony UserBundle的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发Symfony2上的网站,我想整合FOSUserBundle.我正在使用Doctrine ORM用户类.我遵循了安装步骤,但是我明白了错误:

I'm developping a website on Symfony2, I want to intergrate FOSUserBundle. I am using Doctrine ORM User class. I've followed the installation steps but I got this error:

ClassNotFoundException in AppKernel.php line 21:
Attempted to load class "FOSUserBundle" from namespace "FOS\UserBundle".
Did you forget a "use" statement for another namespace?

AppKernel.php:

AppKernel.php:

    public function registerBundles()
{
    $bundles = array(
        ...
        new FOS\UserBundle\FOSUserBundle(),
    );

它看起来正确放置:FOSUserBundle.php位于 \ vendor \ friendsofsymfony \ userbundle

It looks correctly placed: FOSUserBundle.php is located in \vendor\friendsofsymfony\userbundle

我认为名称空间是正确的:名称空间FOS \ UserBundle;

And the namespace is correct I think: namespace FOS\UserBundle;

其他文件:

#config.yml

#config.yml

fos_user:
    db_driver: orm
    firewall_name: main
    user_class: REMERA\PlatformBundle\Entity\User

#routing.yml

#routing.yml

fos_user:
    resource: "@FOSUserBundle/Resources/config/routing/all.xml"

#security.yml

#security.yml

security:
    encoders:
        FOS\UserBundle\Model\UserInterface: bcrypt

    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: ROLE_ADMIN

    providers:
        fos_userbundle:
            id: fos_user.user_provider.username

    firewalls:
        main:
            pattern: ^/
            form_login:
                provider: fos_userbundle
                csrf_provider: security.csrf.token_manager # Use form.csrf_provider instead for Symfony <2.4
            logout:       true
            anonymous:    true

    access_control:
        - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/, role: ROLE_ADMIN }

我已经尝试解决了几个小时,其他类似问题的答案也无法解决我的错误.我想念什么吗? 预先感谢.

I've been trying to solve this for hours, answers on other similar questions don't resolve my error. Am I missing something? Thanks in advance.

推荐答案

如何解决此问题:

首先尝试清除缓存.然后,如果仍无法正常工作,请删除作曲家,对作曲家进行要求,然后再次对作曲家进行更新. – 饮料

try to clear the cache first. Then if it is still not working, composer remove, composer require and composer update again. – Brewal

这篇关于ClassNotFoundException Symfony UserBundle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆