1
votes

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 Fatal error: Class 'FOS\JsRoutingBundle\FOSJsRoutingBundle' not found in C:\wamp\www\calendar\app\AppKernel.php on line 19

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

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?

2
Did you run composer.phar update ?Touki
yes I did, but when I run this command: $ php app/console assets:install --symlink web again, I see this error message: [Symfony\Component\Filesystem\Exception\IOException] Unable to create symlink due to error code 1314: 'A required privilege is not held by the client'. Do you have the required Administrator-rights?user3464972
Do you have the rights to create symlinks?A.L
in fact I don't know...how can I know that??? Thanks in advance.user3464972
According to the error in your comment above, you don't have the right. Can you try without the --symlink option? Is the problem in your question fixed?A.L

2 Answers

0
votes

Add this line:

new FOS\JsRoutingBundle\FOSJsRoutingBundle(),

to your app/AppKernel.php file.

-1
votes

It looks like you've taken out the new AppBundle\AppBundle(), line out.... put it at the end of all the bundles in your AppKernel like below:

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(),
        );
    );
);