简体   繁体   English

HWIOAuthBundle 在 AppKernel 中注册,但仍未找到

[英]HWIOAuthBundle registered in AppKernel, but still not found

my bundle is registered , but I still get this error in 'AppKernel.php' at this line: new HWI\\Bundle\\OAuthBundle\\HWIOAuthBundle() My error:我的包已注册,但我仍然在'AppKernel.php'中的这一行收到此错误: new HWI\\Bundle\\OAuthBundle\\HWIOAuthBundle()我的错误:

ClassNotFoundException in AppKernel.php line 13: Attempted to load class "HWIOAuthBundle" from namespace "HWI\\Bundle\\OAuthBundle". AppKernel.php 第 13 行中的 ClassNotFoundException:尝试从命名空间“HWI\\Bundle\\OAuthBundle”加载类“HWIOAuthBundle”。 Did you forget a "use" statement for another namespace?您是否忘记了另一个命名空间的“use”语句?

I also done: composer require hwi/oauth-bundle .Where could be my mistake?我也做了: composer require hwi/oauth-bundle 。我的错误在哪里?

    use Symfony\Component\HttpKernel\Kernel;
    use Symfony\Component\Config\Loader\LoaderInterface;
    use HWI\Bundle\OAuthBundle;

    class AppKernel extends Kernel
    {
        public function registerBundles()
        {
            $bundles = array(

                new HWI\Bundle\OAuthBundle\HWIOAuthBundle(),
                new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
                new Symfony\Bundle\SecurityBundle\SecurityBundle(),
                new Symfony\Bundle\TwigBundle\TwigBundle(),
                new Symfony\Bundle\MonologBundle\MonologBundle(),
                new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
                new Symfony\Bundle\AsseticBundle\AsseticBundle(),
                new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
                new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
                new AppBundle\AppBundle(),
                new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(),
            );

            if (in_array($this->getEnvironment(), array('dev', 'test'), true)) {
                $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
                $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
                $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
                $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
            }

            return $bundles;
        }

        public function registerContainerConfiguration(LoaderInterface $loader)
        {
            $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
        }
    }

My composer.json file:我的composer.json文件:

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-4": { "": "src/" }
    },
    "require": {
        "php": ">=5.3.9",
        "symfony/symfony": "2.7.*",
        "doctrine/orm": "^2.4.8",
        "doctrine/doctrine-bundle": "~1.4",
        "symfony/assetic-bundle": "~2.3",
        "symfony/swiftmailer-bundle": "~2.3",
        "symfony/monolog-bundle": "~2.4",
        "sensio/distribution-bundle": "~4.0",
        "sensio/framework-extra-bundle": "^3.0.2",
        "incenteev/composer-parameter-handler": "~2.0",
        "hwi/oauth-bundle": "^0.5.3",
        "sensio/generator-bundle": "^3.1"
    },
    "require-dev": {
        "symfony/phpunit-bridge": "~2.7"
    },
    "scripts": {
        "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ],
        "post-update-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "symfony-assets-install": "relative",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "2.7-dev"
        }
    }
}

To be sure that this is not a cache problem, can you follow this process please?为确保这不是缓存问题,您能否按照此流程进行操作?

  • Remove /vendor directory删除 /vendor 目录
  • Remove /app/cache content删除 /app/cache 内容
  • Remove /app/bootstrap.php.cache删除 /app/bootstrap.php.cache
  • Remove composer.lock删除 composer.lock
  • Run command composer self-update && composer update -vvv运行命令 composer self-update && composer update -vvv

Thanks for your feedback.感谢您的反馈意见。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Symfony 3:致命错误:第21行的AppKernel.php中找不到类'HWI \\ Bundle \\ OAuthBundle \\ HWIOAuthBundle' - Symfony 3: Fatal error: Class 'HWI\Bundle\OAuthBundle\HWIOAuthBundle' not found in AppKernel.php on line 21 类在AppKernel.php中找不到 - Class Not found in AppKernel.php 致命错误:AppKernel.php中找不到类 - Fatal error: Class not found in AppKernel.php 更新到Symfony 3.0时找不到类“ Appkernel” - Class 'Appkernel' not found when updating to Symfony 3.0 Facebook登录-HWIOauthBundle-如果找到用户,则更新FacebookID - Facebook Login - HWIOauthBundle - Update FacebookID if user found Symfony2:Web服务器上找不到AppKernel中包含的类 - Symfony2: class included in AppKernel can not be found on webserver Symfony3:致命错误:在 .\\bin\\console 中找不到“AppKernel”类 - Symfony3: Fatal error: Class 'AppKernel' not found in .\bin\console symfony2:找不到AppKernel中包含的FOSElasticaBundle类 - symfony2: FOSElasticaBundle class included in AppKernel can not be found Symfony部署PHP致命错误:在AppKernel.php中找不到类 - Symfony deploy PHP fatal error: Class not found in AppKernel.php 使用带有FOSUserBundle的HWIOAuthBundle时出现“无法找到用户名”错误 - “Username could not be found” error when using HWIOAuthBundle with FOSUserBundle
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM