/app/AppKernel.php 中的奏鸣曲\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle'
Posted
技术标签:
【中文标题】/app/AppKernel.php 中的奏鸣曲\\DoctrineORMAdminBundle\\SonataDoctrineORMAdminBundle\'【英文标题】:Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle' in /app/AppKernel.php/app/AppKernel.php 中的奏鸣曲\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle' 【发布时间】:2016-11-09 17:10:45 【问题描述】:我是 Symfony 的新手。 尝试安装奏鸣曲管理包。 形式: http://symfony.com/doc/current/bundles/SonataAdminBundle/getting_started/installation.html
但是我遇到了一个错误 在 /home/ubuntu/workspace/app/AppKernel.php 中找不到 Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle'
我的AppKernel.php的代码是
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
public function registerBundles()
$bundles = [
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 Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
// These are the other bundles the SonataAdminBundle relies on
new Sonata\CoreBundle\SonataCoreBundle(),
new Sonata\BlockBundle\SonataBlockBundle(),
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
// And finally, the storage and SonataAdminBundle
new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
new Sonata\AdminBundle\SonataAdminBundle(),
];
if (in_array($this->getEnvironment(), ['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 getRootDir()
return __DIR__;
public function getCacheDir()
return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
public function getLogDir()
return dirname(__DIR__).'/var/logs';
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/" ,
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
,
"autoload-dev":
"psr-4": "Tests\\": "tests/"
,
"require":
"php": ">=5.5.9",
"symfony/symfony": "3.1.*",
"doctrine/orm": "^2.5",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-cache-bundle": "^1.2",
"symfony/swiftmailer-bundle": "^2.3",
"symfony/monolog-bundle": "^2.8",
"symfony/polyfill-apcu": "^1.0",
"sensio/distribution-bundle": "^5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "^2.0",
"sonata-project/admin-bundle": "^3.4"
,
"require-dev":
"sensio/generator-bundle": "^3.0",
"symfony/phpunit-bridge": "^3.0"
,
"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":
"platform":
"php": "5.5.9"
,
"extra":
"symfony-app-dir": "app",
"symfony-bin-dir": "bin",
"symfony-var-dir": "var",
"symfony-web-dir": "web",
"symfony-tests-dir": "tests",
"symfony-assets-install": "relative",
"incenteev-parameters":
"file": "app/config/parameters.yml"
,
"branch-alias":
"dev-master": "3.1-dev"
提前致谢:
【问题讨论】:
您的作曲家更新没有错误?这个捆绑包是否在您的供应商文件夹中? 是的,它在供应商文件夹中 【参考方案1】:我认为你错过了在作曲家中要求捆绑...
试运行
php composer.phar require sonata-project/doctrine-orm-admin-bundle
和作曲家安装/更新
来自 sonata-admin 文档:
SonataAdminBundle 与存储无关,这意味着它可以与多种存储机制一起使用。根据您在项目中使用的,您需要安装以下捆绑包之一。在相应的链接中,您可以找到每个链接的简单安装说明:
更多:https://sonata-project.org/bundles/admin/master/doc/reference/installation.html
祝你好运
【讨论】:
感谢 Edu 的回答,但是当我运行该推荐以安装教义-orm-admin-bundle 时,它给了我错误 **尝试注册两个具有相同名称的捆绑包“SecurityBundle”** 【参考方案2】:对我来说,正如错误所说的那样,行
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
在 AppKernel.php 中重复了两次
【讨论】:
以上是关于/app/AppKernel.php 中的奏鸣曲\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle'的主要内容,如果未能解决你的问题,请参考以下文章
PHP 致命错误:在第 47 行的 /var/www/znata.com/app/AppKernel.php 中找不到类 'Application\Sonata\MediaBundle\Applica