3

我在 Windows 上使用 symfony,并尝试按照官方文档中的说明配置 FOSUserBundle

当我运行时,php app/console doctrine:schema:update --force我收到此消息:

Class 'FOS\UserBundle\FOSUserBundle' not found in app/AppKernel.php line 24;

我按照我的方式配置了 AppKernel.php:

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

    return $bundles;
}

我的FOSUserBundle.php文件位于vendor/friendsofsymfony/user-bundle/FOS/UserBundle

4

2 回答 2

1

我认为您还需要在自动加载 ex. 中注册一个命名空间:

$loader->registerNamespaces(array(
        //all the rest
        'FOS' => $vendor_dir . '/bundles',
));

它应该由作曲家在这里完成。所以运行php composer update。如果您使用缓存,APC请记住重新启动apache. 但请记住,APC 是从 bootstrap.php.cache 加载的,女巫是由php composer update.

于 2012-11-09T08:36:20.560 回答
0

我有同样的问题。我发现 FOSUserBundle 没有正确安装。您应该删除 /vendor/friendsofsymfony/ 目录,然后使用以下命令运行更新包:

php composer.phar update friendsofsymfony/user-bundle

这对我有用。我希望它可以帮助遇到同样问题的其他人。

于 2014-04-07T21:16:53.217 回答