0

我正在尝试在 Symfony2 上安装 JMSSerializerBundle。我在这里按照 Composer 的说明进行操作。

当我尝试实际使用 JMSSerializerBundle 时,我得到了这个:

Fatal error: Class 'JMS\SerializerBundle\JMSSerializerBundle' not found in /home/jason/pressbox/app/AppKernel.php on line 25

这是我的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\DoctrineBundle\DoctrineBundle(),
            new Symfony\Bundle\AsseticBundle\AsseticBundle(),
            new Symfony\Bundle\DoctrineMigrationsBundle\DoctrineMigrationsBundle(),
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
            new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
            new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
            new VNN\PressboxBundle\VNNPressboxBundle(),
            new VNN\SecurityBundle\VNNSecurityBundle(),
            new VNN\CoreBundle\VNNCoreBundle(),
            new JMS\SerializerBundle\JMSSerializerBundle($this),
        );

        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');
    }
}

我错过了什么?我需要做什么才能让它工作?

4

2 回答 2

1

您是否在 deps 文件中添加了 JMSSerializerBundle 并运行了 php bin\vendors install?

于 2012-06-26T03:17:35.283 回答
0

如果您手动安装了 bundle,请尝试找出 bundle 文件确实位于 vendor/../JMS/SerializerBundle 而不是 vendor/../JMS/SerializerBundle/JMSSerializerBundle。

(我也遇到了同样的错误,但像我说的那样通过修复它来解决它)

于 2015-03-11T15:34:00.880 回答