Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony there are no commands defined in the "make" namespace

Following the documentation found here I enter php bin/console make:entity Product in Terminal and get the following error:

[Symfony\Component\Console\Exception\CommandNotFoundException]
There are no commands defined in the "make" namespace.

like image 792
lola_the_coding_girl Avatar asked Dec 21 '17 01:12

lola_the_coding_girl


3 Answers

Maybe you were using the prod environment?

The website-skeleton puts the Maker Bundle in the require-dev section of your composer.json by default:

"require-dev": {
    ...
    "symfony/maker-bundle": "^1.0",
    ...
}

If you've set APP_ENV=prod in your .env file and ran bin/console it would ignore all dev requirements and thus wouldn't enable the Maker Bundle.

Simply enabling the dev environment again (APP_ENV=dev) would do the trick then.

like image 171
flu Avatar answered Nov 07 '22 09:11

flu


make is a command of doctrine component. Just add doctrine maker.

composer require doctrine maker

https://symfony.com/doc/current/doctrine.html#installing-doctrine

like image 20
sensorario Avatar answered Nov 07 '22 09:11

sensorario


You need Symfony 3.4 or higher. For Symfony 3.4 you will need to add it to the registerBundles function in config/AppKernerl():

            if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            // [...]
            $bundles[] = new \Symfony\Bundle\MakerBundle\MakerBundle();
        }

Bear in mind that the environment where it is installed is 'dev'.

like image 14
Marcos Labad Avatar answered Nov 07 '22 09:11

Marcos Labad