简体   繁体   中英

Symfony2 - doctrine:generate:entity throws 'Bundle “AcmeBlogBundle” does not exist' error

I am trying to generate CRUD using command line in Symfony3 I am getting error as below

在此输入图像描述

I tried clearing cache using below command line

php bin/console cache:clear

Still I am getting this error.

You need to generate/create the bundle AcmeBlogBundle first and add the bundle to the kernel in app/AppKernel.php .

Otherwise Doctrine doesn't know about the alias AcmeBlogBundle: that is used to resolve the class to an entity. Doctrine can't resolve the alias to an existing namespace and doesn't know where to put the Entity class.

Run the following command to create ie the AcmeBlogBundle bundle.

app/console generate:bundle --namespace=Acme\Bundle\AcmeBlogBundle

Your AppKernel.php should now contain the line:

public function registerBundles()
{
    $bundles = array(
        // ...
        new Acme\Bundle\AcmeBlogBundle(),
    );

    // ...

   return $bundles;

Afterwards the error message will be gone and you'll be able to generate your Entity with:

app/console doctrine:generate:crud --entity=AcmeBlogBundle:Entity

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM