本文整理汇总了PHP中sfWebRequest::setError方法的典型用法代码示例。如果您正苦于以下问题:PHP sfWebRequest::setError方法的具体用法?PHP sfWebRequest::setError怎么用?PHP sfWebRequest::setError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfWebRequest
的用法示例。
在下文中一共展示了sfWebRequest::setError方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeDeleteAsset
/**
* 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());
}