Code snippets for symfony 1.x

Navigation

Refine Tags

Snippets tagged "generators"

admin generator getAllColumns except

My First snippet ever AND, my first contribution to the programming world... hope you like it ;)

This snippet is for those of you who, just like me, have 30 fields in one class and doesnt want to write them all down in the admin generator and erase the ones you don't want.

if you want to display all field except one, here's how:

generator:
  class:              sfPropelAdminGenerator
  param:
    model_class:      users
    theme:            default
    list:
      sort:           [updated_at, desc]
      hide:           [the_fields_i_dont_want]
 

Notice the "HIDE" option.

If you want to display all fields AND you want to add a partial, it gets a little tricky (and ugly, but it does the trick until something better is created)

generator:
  class:              sfPropelAdminGenerator
  param:
    model_class:      users
    theme:            default
    list:
      sort:           [updated_at, desc]
      display:        [_my_partial, <?php echo implode(', ',JobPeer::getFieldNames(BasePeer::TYPE_FIELDNAME)) ?>]
      max_per_page:   20
 

Notice the "DISPLAY" option ... I know, it's ugly to have php in a yml file ...

You can also combien the two and get all columns and hide the ones you don't want .

P.S. I should have wrote this earlier but this snippet wouldn't exists if it weren't for pookey from #symfony (irc). THanks again man ;)

by Mob[st]er2 on 2008-01-10, tagged admin  display  generator  generators  hide