Symfony2上的FOSJsRoutingBundle安装

Symfony2上的FOSJsRoutingBundle安装,symfony,installation,bundle,Symfony,Installation,Bundle,通过阅读本教程中的以下链接,我尝试安装FOSJsRoutingBundle: 但是每当我运行这个命令 $ php app/console assets:install --symlink web 将显示以下错误消息列表: PHP致命错误:类“FOS\JsRoutingBundle\FOSJsRoutingBundle”不是 可在第19行的C:\wamp\www\calendar\app\AppKernel.php中找到 PHP堆栈跟踪: PHP1。{main}C:\wamp\www\cal

通过阅读本教程中的以下链接,我尝试安装FOSJsRoutingBundle: 但是每当我运行这个命令

$ php app/console assets:install --symlink web  
将显示以下错误消息列表:

PHP致命错误:类“FOS\JsRoutingBundle\FOSJsRoutingBundle”不是 可在第19行的C:\wamp\www\calendar\app\AppKernel.php中找到

PHP堆栈跟踪: PHP1。{main}C:\wamp\www\calendar\app\console:0 PHP2。Symfony\Component\Console\Application->run C:\wamp\www\calendar\app\console:27 PHP3。Symfony\Bundle\FrameworkBundle\Console\Application->doRun C:\wamp\www\calendar\vendor\symfony\symfony\src\symfony\Component\Console\Application.php:121 PHP4。Symfony\Component\HttpKernel\Kernel->boot C:\wamp\www\calendar\vendor\symfony\symfony\src\symfony\Bundle\FrameworkBundle\Console\Application.php:70 PHP5。Symfony\Component\HttpKernel\Kernel->initializeBundles C:\wamp\www\calendar\app\bootstrap.php.cache:2269 php6。AppKernel->registerBundles C:\wamp\www\calendar\app\bootstrap.php.cache:2439

我不知道为什么它表示找不到“FOS\JsRoutingBundle\FOSJsRoutingBundle”类,尽管该类是在app/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 FOS\JsRoutingBundle\FOSJsRoutingBundle(),
        );

        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');
    }
}
那么,我如何解决这个问题呢?

添加这一行:

new FOS\JsRoutingBundle\FOSJsRoutingBundle(),

到您的app/AppKernel.php文件。

看起来您已经取出了新的AppBundle\AppBundle,line out。。。。将其放在AppKernel中所有捆绑包的末尾,如下所示:

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 FOS\JsRoutingBundle\FOSJsRoutingBundle(),
            new AppBundle\AppBundle(),
        );
    );
);

是否运行了composer.phar更新?是的,但当我再次运行以下命令时:$php app/console assets:install-symlink web,我看到以下错误消息:[Symfony\Component\Filesystem\Exception\IOException]由于错误代码1314,无法创建符号链接:“客户端未持有所需的权限”。你有必要的管理员权限吗?你有创建符号链接的权限吗?事实上我不知道…我怎么知道???提前谢谢。根据你上面评论中的错误,你没有权利。您可以尝试不使用-symlink选项吗?你问题中的问题解决了吗?