symfony2 tutorial - generate bundle
Solution 1
You can use this without interaction . then it won't ask you anything
php app/console generate:bundle --namespace=Blogger/BlogBundle --format=yml --no-interaction
Solution 2
From generate:bundle --help
If you want to disable any user interaction, use --no-interaction but don't forget to pass all needed options:
php app/console generate:bundle --namespace=Acme/BlogBundle --dir=src [--bundle-name=...] --no-interaction
I have bash functions for these long commands.
genbundle () {
php app/console generate:bundle --namespace=$1/$2Bundle --bundle-name=$2Bundle --dir=src/ --format=yml
}
You can use it like this: "genbundle Acme Blog", It'll create a BlogBundle in the Acme app.
Solution 3
If I understood what's going on correctly, you have to go on the process. It's step-by-step where you answer the questions. Keep answering everything asked, and then the console will tell when it created the bundle.
Note: the value in [...] are the default value if you just press enter when the console asks you something.
Robbo_UK
Updated on June 04, 2022Comments
-
Robbo_UK almost 2 years
I am new to symfony2 but not to symfony. I am currently doing the symblog tutorial. Its going ok so far however I have come a little stuck on the generate bundle?
The tutorial says to run the following command
php app/console generate:bundle --namespace=Blogger/BlogBundle --format=yml
After completing that it should add reference/generate code to the bundle in the
- app/AppKernel.php
- app/config/routing.yml
However it has not added anything?... I'm a bit confused? The console outputs the following but the code references to the bundle have not been generated in the files
Welcome to the Symfony2 bundle generator Your application code must be written in bundles. This command helps you generate them easily. Each bundle is hosted under a namespace (like Acme/Bundle/BlogBundle). The namespace should begin with a "vendor" name like your company name, your project name, or your client name, followed by one or more optional category sub-namespaces, and it should end with the bundle name itself (which must have Bundle as a suffix). See http://symfony.com/doc/current/cookbook/bundles/best_practices.html#index-1 for more details on bundle naming conventions. Use / instead of \ for the namespace delimiter to avoid any problem. Bundle namespace [Blogger/BlogBundle]:
-
Robbo_UK about 11 yearsThis is the best answer. very concise. The tutorial should have this command line.