Snippet: Symfony Forms - Setting the Form Formatter

By default Symfony displays forms in tables, with each new input being a table row. If you want to display your forms more semantically with fieldsets and lists, Symfony has a list formatter built in. You can tell an individual form to display as a list using the code below.

  < ?php
    // lib/form/MyModelForm.class.php
    public function configure() {
      $this->widgetSchema->setFormFormatterName('list');
    } 
?>

You can also create your own custom formatters. For detailed examples of how to do this see the following tutorials:

A Note on Snippets: When using frameworks such as Symfony it is often the simplest pieces of code which are the hardest to either find or remember. These snippets are placed here for my own reference and will hopefully be useful to others. If you find them useful or have any suggestions, please let me know.