salep
salep

Reputation: 1390

Symfony2 AppBundle.xml doesn't exist or it is not enabled

I'm trying to make the following command work but it gives me an error.

php app/console doctrine:mapping:import --force AppBundle xml

I couldn't understand what is causing it. How can I solve it?

  [InvalidArgumentException]                                                                       
  Bundle "AppBundle.xml" does not exist or it is not enabled. Maybe you forgot to add it in the r  
  egisterBundles() method of your AppKernel.php file? 

Here's my AppKernel.php file.

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
          new FOS\UserBundle\FOSUserBundle(),
          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 AppBundle\AppBundle(),
        );

        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
            $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($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
    }
}

Upvotes: 0

Views: 810

Answers (2)

Francesco Abeni
Francesco Abeni

Reputation: 4265

The syntax is correct. As @Leogout said, try using the quotes around the bundle name, and make sure there's not dot (.) between "AppBundle" and "xml".

Upvotes: 1

Leogout
Leogout

Reputation: 1247

In the doctrine repository, thez add quotes ("") like this :

php app/console doctrine:mapping:import --force "AppBundle" xml

But in the Symfony documentation, they don't.

Can you try with them ?

Upvotes: 0

Related Questions