0

在我开始使用 Composer 之前,我的 Symfony2 设置一切都很好。

我确实使用 Composer 安装了 Symfony2,但随后手动添加了包——包括我自己创建的包。

然后,我需要添加一些使用 Composer 似乎更容易的东西。后来我发现在终端中有很多乱七八糟的东西,当我在浏览器中运行时,我在 AppKernel.php 中收到一个错误,说不存在任何捆绑包 - 包括:

FatalErrorException: Error: Class 'Acme\DemoBundle\AcmeDemoBundle' not found in /path/app/AppKernel.php line 39

我是 100% 的文件夹存在,除了运行各种 Composer 命令之外没有任何改变。

Composer 没有引用这些包。

我该如何解决这个问题?我猜我要么告诉 Composer 清除(像以前一样),要么我让 Composer 理解捆绑包。

我猜它与引导文件有关。我相信 Composer 会在更新后创建一个,但这是我苦苦挣扎的地方。

--

作曲家.json:

{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
    "psr-0": { "": "src/" }
},
"require": {
    "php": ">=5.3.3",
    "symfony/symfony": "2.2.*",
    "doctrine/orm": "~2.2,>=2.2.3",
    "doctrine/doctrine-bundle": "1.2.*",
    "twig/extensions": "1.0.*",
    "symfony/assetic-bundle": "2.1.*",
    "symfony/swiftmailer-bundle": "2.2.*",
    "symfony/monolog-bundle": "2.2.*",
    "sensio/distribution-bundle": "2.2.*",
    "sensio/framework-extra-bundle": "2.2.*",
    "sensio/generator-bundle": "2.2.*",
    "jms/security-extra-bundle": "1.4.*",
    "jms/di-extra-bundle": "1.3.*"
},
"scripts": {
    "post-install-cmd": [
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    ],
    "post-update-cmd": [
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    ]
},
"config": {
    "bin-dir": "bin"
},
"minimum-stability": "alpha",
"extra": {
    "symfony-web-dir": "web",
    "symfony-app-dir": "app",
    "branch-alias": {
        "dev-master": "2.2-dev"
    }
}

}

4

1 回答 1

1

我想你没有更新app/autoload.php文件。检查标准分发的来源:https ://github.com/symfony/symfony-standard/blob/master/app/autoload.php

您需要包含vendor/autoload.php由作曲家生成的。

于 2013-09-06T21:19:54.847 回答