Symfony2 tutorial - creating a package
I'm new to symfony2, but not symfony. I am currently doing a tutorial on how to create a logo . It works fine so far, but am I a bit stuck with generating the package?
The tutorial states that to run the following command
php app/console generate:bundle --namespace=Blogger/BlogBundle --format=yml
Once done, it should add link / generate code to the package in
- app /AppKernel.php
- app / config / routing.yml
However, he didn't add anything? ... Am I a little confused? The console outputs the following, but no links to the code in the package were 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]:
source to share
From generate:bundle --help
If you want to disable any user interaction, use -no interaction, but don't forget to pass all the required parameters:
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 will create a BlogBundle in the Acme application.
source to share
If I understand what is going on correctly, you should continue with the process. This is step by step where you answer the questions. Keep answering all questions and then the console will tell you when it created the package.
Note: The value in [...] is the default if you just press enter when the console asks for something.
source to share
Old command:
php app/console generate:bundle --namespace=Blogger/BlogBundle --format=yml --no-interaction
In the new version of Symfony 3.1.4 "application / console" no longer works. Instead add "bin / console" to the above command
So the New command would be
php bin/console generate:bundle --namespace=Blogger/BlogBundle --format=yml --no-interaction
source to share