public function setup() { parent::setup(); $this->validatorSchema['folder_id']->setOption('required', true); if ($this->getOption('folder') instanceof sfAssetFolder) { $this->widgetSchema['folder_id'] = new sfWidgetFormInputHidden(); $defaults = $this->getDefaults(); $defaults['folder_id'] = $this->getOption('folder')->getId(); $this->setDefaults($defaults); } }
public function executeUpdate($request) { $this->sf_asset = $this->getsfAssetOrCreate(); $form = new sfAssetForm($this->sf_asset); if ($request->isMethod('POST')) { $form->bind($request->getParameter('sf_asset'), $request->getFiles('sf_asset')); if ($form->isValid()) { $form->save(); $this->getUser()->setFlash('notice', 'Your modifications have been saved'); return $this->redirect('sfAsset/edit?id=' . $this->sf_asset->getId()); } } }