我正在使用 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 .
应用内核.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');
}
}
自动加载.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;
安装后我在控制台得到了什么
使用包信息加载作曲家存储库更新依赖项(包括 require-dev)-更新 twig/extensions dev-master (5c2d515 => 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'),
);