在AppKernel中找不到StofDoctrineExtensionsBundle

时间:2013-05-21 21:04:00

标签: symfony symfony-2.1

我正在使用Symfony2 v2.1.9而我在安装StofDoctrineExtensionBundle

时遇到问题
PHP Fatal error:  Class 'Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle' not found in C:/wamp/www/Symfony/app/AppKernel.php on line 23 .

AppKernel.php

<?php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;



class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            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 JMS\AopBundle\JMSAopBundle(),
            new JMS\DiExtraBundle\JMSDiExtraBundle($this),
            new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),


            new FOS\UserBundle\FOSUserBundle(),
             new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),

        );

        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            $bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
            $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(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
    }
}

autoload.php

<?php

use Doctrine\Common\Annotations\AnnotationRegistry;

$loader = require __DIR__.'/../vendor/autoload.php';

// intl
if (!function_exists('intl_get_error_code')) {
    require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';

    $loader->add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs');

}


AnnotationRegistry::registerLoader(array($loader, 'loadClass'));

return $loader;

安装后我在控制台获得的内容

使用包信息加载composer存储库     更新依赖项(包括require-dev)        - 更新twig / extensions dev-master(5c2d515 =&gt; v1.0.0)         签出v1.0.0

供应商/作曲家/ autoload_namespaces.php

<?php

// autoload_namespaces.php generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    'WhiteOctober\\PagerfantaBundle' => array($vendorDir . '/white-october/pagerfanta-bundle'),
    'Twig_Extensions_' => array($vendorDir . '/twig/extensions/lib'),
    'Twig_' => array($vendorDir . '/twig/twig/lib'),
    'Symfony\\Bundle\\SwiftmailerBundle' => array($vendorDir . '/symfony/swiftmailer-bundle'),
    'Symfony\\Bundle\\MonologBundle' => array($vendorDir . '/symfony/monolog-bundle'),
    'Symfony\\Bundle\\AsseticBundle' => array($vendorDir . '/symfony/assetic-bundle'),
    'Symfony' => array($vendorDir . '/symfony/symfony/src'),
    'SessionHandlerInterface' => array($vendorDir . '/symfony/symfony/src/Symfony/Component/HttpFoundation/Resources/stubs'),
    'Sensio\\Bundle\\GeneratorBundle' => array($vendorDir . '/sensio/generator-bundle'),
    'Sensio\\Bundle\\FrameworkExtraBundle' => array($vendorDir . '/sensio/framework-extra-bundle'),
    'Sensio\\Bundle\\DistributionBundle' => array($vendorDir . '/sensio/distribution-bundle'),
    'Pagerfanta\\' => array($vendorDir . '/pagerfanta/pagerfanta/src'),
    'Monolog' => array($vendorDir . '/monolog/monolog/src'),
    'Metadata\\' => array($vendorDir . '/jms/metadata/src'),
    'JMS\\SecurityExtraBundle' => array($vendorDir . '/jms/security-extra-bundle'),
    'JMS\\DiExtraBundle' => array($vendorDir . '/jms/di-extra-bundle'),
    'JMS\\AopBundle' => array($vendorDir . '/jms/aop-bundle'),
    'FOS\\UserBundle' => array($vendorDir . '/friendsofsymfony/user-bundle'),
    'Doctrine\\ORM' => array($vendorDir . '/doctrine/orm/lib'),
    'Doctrine\\DBAL' => array($vendorDir . '/doctrine/dbal/lib'),
    'Doctrine\\Common' => array($vendorDir . '/doctrine/common/lib'),
    'Doctrine\\Bundle\\DoctrineBundle' => array($vendorDir . '/doctrine/doctrine-bundle'),
    'CG\\' => array($vendorDir . '/jms/cg/src'),
    'Assetic' => array($vendorDir . '/kriswallsmith/assetic/src'),
    '' => array($baseDir . '/src'),
);

1 个答案:

答案 0 :(得分:2)

error: Class 'xxxBundle' not found in .../app/AppKernel.php

表示通常尚未安装捆绑包。对于没有经验的用户,安装指南缺少一个重点。向composer.json添加需求后,您必须运行更新命令:

php composer.phar update