bshaffer / sfHadoriThemePlugin

symfony admin generator with a beautiful theme and clean generated code.
MIT License
21 stars 6 forks source link

isNew() is not respected for forms #26

Closed tdmedia closed 12 years ago

tdmedia commented 12 years ago

If I have the following in my form class:


    if ($this->isNew()) 
    {
        // don't need to show status if creating new test
        $this->useFields(array('user_id', 'test_id'));
    }
    else
    {
      // show status only when editing an existing test
      $this->useFields(array('user_id', 'test_id', 'status'));
    }

The isNew condition is always used and I only get two fields even when editing an existing record.

bshaffer commented 12 years ago

Aha, this is true. There is only one _form.php partial, for both new and edit, and unfortunately it's not sophisticated enough to determine the logic you have there. I would override _form.php and put the logic there as well.