[symfony-users] Removing a field from a form in an action

2010-09-08 Thread torok84
Hi, I have a form to select some search options. I have a field that I wanto to show only if the user is logged in. I want to do something like this: if(!$this-getUser()-hasAttribute('user')) unset($this-form-widgetSchema['mine']); that doesn't work because widgetSchema is protected.

AW: [symfony-users] Removing a field from a form in an action

2010-09-08 Thread Christopher Schnell
hi, you could do something nasty like if(!$this-getUser()-hasAttribute('user')) $tempSchema=$this-form-getWidgetSchema(); unset($tempSchema ['mine']; $this-form-setWidgetSchema($tempSchema); } but this wouldn't be testable. better solution is