This post is going to be a short and quick. Recently I have been working a lot with symfony and every time i face some issue turns out there is very simple solution but sometimes it doesn’t strikes as obvious solution, until we find a solution on slackoverflow or github. In this post I am going to give one such solution.
What exactly is the problem ?
I lot a project because of disk crash and cloned back from git. and downloaded my
.env file from production server. I did
composer install which gave me all that I need, simple right ? Well I was happy and started making changes and here i came to creating entity. We all know simplest way is to use
php bin/console make:entity. That’s what I did but, boom, console is red with an error.
$ php bin/console make:entity
There are no commands defined in the “make” namespace.
You may be looking for a command provided by the "MakerBundle" which is currently not installed. Try running "composer require symfony/maker-bundle --dev".
So what did i do wrong ? I tried
composer update but no use. I checked my
composer.json and it was there. I checked vendor directory and it was there as well. So why it doesn’t work ?
Simple solution, which was obvious but I missed like lot of other people, as I found out when googling.
Some command namespaces are simply not available when you are running in production mode. Solution is to use your local
.env file so the environment variable
APP_ENV is set to
APP_ENV=dev. Then clear your cache
php bin/console cache:clear --env=dev and it’ll all be fine and namespaces which are limited to
dev will be available for use.