Symfony World blog is not maintained anymore. Check new sys.exit() programming blog.

NetBeans code templates for Symfony

Scene from "The Smurfs" by Pierre Culliford (intruduced in 1958)

This short tutorial shows how to add code templates into the NetBeans IDE. It's based on version 6.8 of NetBeans including PHP support.


why using code templates?

Code templates fasten up the work of a programmer, when many templates are configured. You may define a combination of few keys to make the IDE insert a big piece of code for you. Tired of copy-pasting all the time? If so, code templates are just for you!


Go into the 'Tools' menu and choose 'Options':






Choose 'Editor' section and 'Code templates' tab:






Now you're ready to define your custom code templates. The abbreviation is the combination of keys you shall type to make the IDE insert your code (which is present in 'expanded text'). In the example above, you shall type the phrase 'sfexe' and then press tab to get action method template. Easy, isn't it? I hope you'll to find it useful!

4 comments:

  1. Absolutely good, thanks!

    ReplyDelete
  2. Does anyone have any good Symfony templates to share?

    ReplyDelete
  3. http://www.symfony-zone.com/wordpress/2010/04/16/netbeans-settingsfile-for-symfony/

    ReplyDelete
  4. Try this:

    public function execute${Action}(sfWebRequest $request)
    {
    // code to insert
    }

    ReplyDelete