/** * delete asset * @param sfWebRequest $request */ public function executeDeleteAsset(sfWebRequest $request) { $this->forward404Unless($request->isMethod(sfRequest::DELETE), 'method not allowed'); $asset = $this->assetProvider->retrieveByPk($request->getParameter('id')); $this->forward404Unless($asset, 'asset not found'); try { $asset->delete(); $this->dispatcher->notify(new sfEvent($this, 'admin.delete_object', array('object' => $asset))); $this->getUser()->setFlash('notice', 'The file has been deleted'); } catch (PropelException $e) { $request->setError('delete', 'Impossible to delete asset, probably due to related records'); return $this->forward('sfAsset', 'edit'); } return $this->redirectToPath('@sf_asset_library_dir?dir=' . $asset->getFolderPath()); }