有一些字段的表格:
protected function configureFormFields(FormMapper $formMapper)
{
$isNew = !$this->getRequest()->get($this->getIdParameter());
$formMapper
->add('title')
->add('file', 'file', array('required' => $isNew))
;
}
有没有更好的方法使字段只对新对象是必需的?