Php HWIOAuthBundle已在AppKernel中注册,但仍未找到
我的捆绑包已注册,但在Php HWIOAuthBundle已在AppKernel中注册,但仍未找到,php,symfony,hwioauthbundle,Php,Symfony,Hwioauthbundle,我的捆绑包已注册,但在'AppKernel.php' 在这一行:new HWI\Bundle\OAuthBundle\HWIOAuthBundle() 我的错误: AppKernel.php第13行中的ClassNotFoundException:尝试加载 从命名空间“HWI\Bundle\OAuthBundle”中初始化“HWIOAuthBundle”。做 您忘记了另一个名称空间的“use”语句了吗 我还做了:composer需要hwi/oauth bundle。我的错误在哪里 use
'AppKernel.php'
在这一行:new HWI\Bundle\OAuthBundle\HWIOAuthBundle()
我的错误:
AppKernel.php第13行中的ClassNotFoundException:尝试加载
从命名空间“HWI\Bundle\OAuthBundle”中初始化“HWIOAuthBundle”。做
您忘记了另一个名称空间的“use”语句了吗
我还做了:composer需要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');
}
}
我的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"
}
}
}
为确保这不是缓存问题,请遵循此过程
- 删除/供应商目录
- 删除/app/cache内容
- 删除/app/bootstrap.php.cache
- 删除composer.lock
- 运行命令编写器自我更新&&composer更新-vvv
感谢您的反馈。尝试删除
使用HWI\Bundle\OAuthBundle
并将新建HWI\Bundle\OAuthBundle\HWIOAuthBundle(),
移到末尾,而不是前面。然后在AppKernel.php第24行中的另一行ClassNotFoundException中执行一个cache:clearStill-same,相同的错误:
您确定要安装吗?您的供应商中是否有hwi
目录?是的,我的供应商文件夹供应商/hwi/oauth bundle
中有hwi
目录,以及所有其他目录和HWIOAuthBundle.php
文件。很奇怪,在我的机器上测试一个类似的配置就可以了。也许测试一个“composer dump autoload”或一个好的旧缓存clean?现在我丢失了我的bootstrap.php.cache):无法打开流:没有这样的文件或目录
你能复制你的composer.json吗?对于构建bootstrap.php.cache,只需注释new HWI\Bundle\OAuthBundle\HWIOAuthBundle(),但它不会解决您的问题。这可能是项目级别或composer.jsonal级别的配置问题。因此,您可以删除AppKernel.php中的“use HWI\Bundle\OAuthBundle;”