本文整理汇总了PHP中AdminAction::getErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminAction::getErrors方法的具体用法?PHP AdminAction::getErrors怎么用?PHP AdminAction::getErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AdminAction
的用法示例。
在下文中一共展示了AdminAction::getErrors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addActionNotes
/**
* add action notes
*
* @author youzhao.zxw<swustnjtu@gmail.com>
* @param string $tableName target table name
* @param string $action edit action
* @param array $newRecordAttributes new record attributes
* @param array $oldRecordAttributs old record attributes
* @return array add action notes result
*/
public static function addActionNotes($tableName, $action, $newRecordAttributes, $oldRecordAttributs)
{
$infoAction = new AdminAction();
$infoAction->action_type = $action;
$infoAction->target_table = $tableName;
$infoAction->target_id = $newRecordAttributes['id'];
if (!$infoAction->save()) {
$resultInfo['status'] = CommonService::$ApiResult['FAIL'];
$resultInfo['detail'] = $infoAction->getErrors();
return $resultInfo;
} else {
if (!empty($oldRecordAttributs)) {
$diffAttributeArr = self::compareRecord($oldRecordAttributs, $newRecordAttributes);
foreach ($diffAttributeArr as $diffInfo) {
$actionHistory = new AdminHistory();
$actionHistory->action_field = $diffInfo[0];
$actionHistory->adminaction_id = $infoAction->id;
$actionHistory->old_value = $diffInfo[1];
$actionHistory->new_value = $diffInfo[2];
if (!$actionHistory->save()) {
$resultInfo['status'] = CommonService::$ApiResult['FAIL'];
$resultInfo['detail'] = $actionHistory->getErrors();
return $resultInfo;
}
}
}
}
$resultInfo['status'] = CommonService::$ApiResult['SUCCESS'];
$resultInfo['detail'] = array('id' => $infoAction->id);
return $resultInfo;
}