Search code examples
symfonypropel

Inject custom form generator for symfony 2.0


When I am creating a form with propel:form:generate command, it executes FormGenerateCommand.php from propel bundle, How can I extend this bundle or make it to execute my custom form generator?


Solution

  • As far as I can see from the source code of that command, all of the methods that perform any action are private and so extending this class for your own command wouldn't be of much use.

    As you already have your own form generator by the sounds of it, you can just create your own command to execute it and specify a unique name for it (e.g. "my_propel:form:generate"). This doesn't have to be in a bundle that extends the PropelBundle; you could place this command either in the same bundle as your existing form generator or in a new bundle. For more information on creating your own console command, see this cookbook article: How to create a Console Command