在Symfony2上安装FOSJsRoutingBundle [英] FOSJsRoutingBundle installation on Symfony2

查看:57
本文介绍了在Symfony2上安装FOSJsRoutingBundle的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试通过阅读此链接上的本教程来安装FOSJsRoutingBundle: https://github.com/FriendsOfSymfony/FOSJsRoutingBundle/blob/master/Resources/doc/index.md
,但是每当我运行此命令

I have tried to install FOSJsRoutingBundle through reading this tutorial on this link: https://github.com/FriendsOfSymfony/FOSJsRoutingBundle/blob/master/Resources/doc/index.md but whenever I run this command

$ php app/console assets:install --symlink web  

显示以下错误消息列表:

the following list of errors messages is displayed:


PHP致命错误:类'FOS\JsRoutingBundle\FOSJsRoutingBundle'not在第19行的C:wamp\www\calendar\app\AppKernel.php中找到

PHP Fatal error: Class 'FOS\JsRoutingBundle\FOSJsRoutingBundle' not found in C:\wamp\www\calendar\app\AppKernel.php on line 19

PHP堆栈跟踪:

PHP 1. {main}()C:\wamp\www\calendar\app\console:0

PHP 2. Symfony\Component\Console\ Application-> run()
C:wamp\www\calendar\app\控制台:27

PHP 3. Symfony\捆绑\FrameworkBundle\控制台\ \应用程序-> doRun()
C:\wam p\www\calendar\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:121

PHP 4. Symfony\Component\ \HttpKernel\Kernel-> boot()
C:\wamp\www\calendar\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\ \Application.php:70

PHP 5. Symfony\组件\HttpKernel\内核-> initializeBundles()
C:\wamp\www\calendar\app\ \bootstrap.php.cache:2269

PHP 6. AppKernel-> registerBundles()C:\wamp\www\calendar\app\bootstrap.php.cache:2439

PHP Stack trace:
PHP 1. {main}() C:\wamp\www\calendar\app\console:0
PHP 2. Symfony\Component\Console\Application->run() C:\wamp\www\calendar\app\console:27
PHP 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() C:\wamp\www\calendar\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:121
PHP 4. Symfony\Component\HttpKernel\Kernel->boot() C:\wamp\www\calendar\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:70
PHP 5. Symfony\Component\HttpKernel\Kernel->initializeBundles() C:\wamp\www\calendar\app\bootstrap.php.cache:2269
PHP 6. AppKernel->registerBundles() C:\wamp\www\calendar\app\bootstrap.php.cache:2439

我不知道为什么它表明未声明类'FOS\JsRoutingBundle\FOSJsRoutingBundle'尽管声明了该类在文件app / AppKernel.php中,您会在下面注意到:

I don't know why it indicates that the class 'FOS\JsRoutingBundle\FOSJsRoutingBundle' not found is not found despite that class is declared at the file app/AppKernel.php as you can notice below:

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

那么,如何解决这个问题?

So, how can I resolve this problem?

推荐答案

添加以下行:

new FOS\JsRoutingBundle\FOSJsRoutingBundle(),

到您的应用/AppKernel.php 文件。

这篇关于在Symfony2上安装FOSJsRoutingBundle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆