protected function doUpdateObject($values) { if (isset($values['file']) && $values['file'] instanceof sfValidatedFile) { $validatedFile = $values['file']; } else { $validatedFile = null; } unset($values['file']); if ($this->object->exists() && $values['dm_media_folder_id'] != $this->object->dm_media_folder_id) { $moveToFolderId = $values['dm_media_folder_id']; $values['dm_media_folder_id'] = $this->object->dm_media_folder_id; } parent::doUpdateObject($values); if ($validatedFile) { $values = $this->handleValidatedFile($validatedFile, $values); } if (isset($moveToFolderId)) { $this->object->move(dmDb::table('DmMediaFolder')->find($moveToFolderId)); } }