Symfony2: Getting Easier - Interactive Generators

Some people keep thinking that Symfony2 requires a lot of upfront configuration... even more than symfony1. It took me a while to understand why people would think so as there is nothing to configure in Symfony2 if you are using the Symfony Standard Edition, except the database settings if you need one (and this can be done from the browser).
But recently, I saw the light: people are talking about creating new bundles, new Doctrine entities, new CRUD controllers, ... symfony1 has generators for all those things, but until now, Symfony2 was not very good at generating code. Well, that's "fixed" now, thanks to the new GeneratorBundle. The bundle is included by default in Symfony SE (as of 2.0.0 RC1 which will be released on June 24th) and it knows how to generate bundles, forms, Doctrine entities, and simple CRUD controllers to get you started even faster.
The generators are even better than the ones in symfony1 as you can use them interactively; answer some questions and Symfony2 takes care of everything for you:
This screencast requires a more recent version of the Adobe Flash Player to display. Please update your version of the Adobe Flash Player.
The code is quite new and probably comes with a lot of bugs. Let's enhance it in the coming weeks!
Help the Symfony project!
As with any Open-Source project, contributing code or documentation is the most common way to help, but we also have a wide range of sponsoring opportunities.
Comments
Comments are closed.
To ensure that comments stay relevant, they are closed for old posts.
All that was missing from SF2. SF2 feels so much more 'right', but I've kept with SF1.4 for most tasks because it was just that much quicker to work with.
It generates tests for entities and controllers?
Is it possible to not use it interactively, but to pass all parameters in the command?
Also when working with Symfony CLI I recommend checking out my bash script to make that bit easier: http://vvv.tobiassjosten.net/symfony/symfony2-cli-bash-script
Great news! 2 days left :D
Your Generator Bundle looks great, good job Fabien !! I will testing it...
Generated code is a great way to standardize the code in Symfony1 and sure it will be true for Symfony2 too.
Thank you very much!
Thanks a lot
I'm a Symfony2 newcomer, and i guess this makes my life easier.
Great screencast and great job !
I have an idea, which could further increase the attractiveness of Symfony2. How about a a web interface to these generators? You already have awesome profiler.
But I still miss an admin generator. Will be one?
I personally don't usually like the "wizard" approach, whether command line or web-based, because I always answer something wrong the first time. I like to reuse configuration from other projects/machines, use version control, and search and replace. For all those reasons, I prefer file-based configuration (I love schema.yml and generator.yml). But it looks like that's all still possible so cool.
saludos,
Bien hecho muchachos!
1 question, though: how does the gen:doctrine:entity relate to doctrine:generate:entitites?
Will this command be replaced or is this new command an extra tool to generate yaml files (for instance) that can be used for Entity generation with doctrine:generate:entities?
Can you make all the options configurable instead of interactive?
There is any command to "generate all"?
A nice feature will be generator profile, that including generator options and templates (except probably those parts generated by doctrine), specially view templates.
Anyone else experiencing this?
You probably already know this, but you've wet everyone's appetite with anticipation for RC2, in the hopes that perhaps there might be some more surprises.
(sortable columns, pagination, filtering, ...)
But even if not, still, thanks very much for all you do for the community.
make most practical work more easier just a command line.
so we can list those most practical work, then make generator to automake .
1) SCHEMA DEFINITION
2) HTML + CRUD
3) JSON + CRUD
4) USER + AUTHENTICATION + AUTHORIZATION
5) AJAX CRUD
6) ADVACNED FORM(NESTED,DYNAMIC FORM FIELDS) BUILDER
7) .....
WE NEED MORE PEOPLE WISDOM.
RC1 upgraded , bundle generate OK!
Tried to follow the video to generate a bundle but twig threw a fatal error during the process.
I believe your local is different than RC1 and those changes did not make it into the RC1, check it out when you have time.
I get this error:
[Twig_Error_Loader]
Unable to find template "C:/wamp/www/Symfony/src/MyAp/FilmothequeBundle/Controller/DefaultController.php" (looked into: /).
Thanks for such an elegant MVC framework...i really got attached with the developmental works and portfolio included in Website about "Symfony".
regard's
Anishchapagain@gmail.com
This saves a LOT of coding and created everything exactly as I would have done it the hard way. I even created the database first when I realized that there's no need to do that, because this will generate everything!
Note: The validation messages that should appear after we submit the form don't show up on Chrome (latest version) and Firefox (latest version), they only show correctly on Internet Explorer.
All files gets created right but I think a configuration on routing.yml or config.yml may be missing on Symfony2 RC4. Does someone gets the same error?
No route found for "GET /post/"
Importing the bundle routing resource: FAILED
The command was not able to configure your everything automatically.
You must do the following changes manually.
Bundle UdmFutBundle is already imported.
In the end I got "No route found for "GET /post/"
Using windows and Symfony2 Standard RC2
I'm checked router list by using "router:debug" command but nothings about "Post" action in routing list.
Check my screenshot.
In the end I got "No route found for "GET /post/"
I using windows and Symfony2 Standard RC2
I'm checked router list by using "router:debug" command but nothing about "Post" action in routing list.
Check my screenshot
http://www.freeimagehosting.net/uploads/8ad5fe380f.jpg
Does anybody have find a solution for that matter : "The command was not able to configure your everything automatically.
You must do the following changes manually. " ?
I use the RC4.
Thanks a lot.
byby