本文整理汇总了PHP中Alert::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Alert::save方法的具体用法?PHP Alert::save怎么用?PHP Alert::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Alert
的用法示例。
在下文中一共展示了Alert::save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addAlert
public function addAlert()
{
$input = Input::all();
$alert = new Alert();
$alert->value = $input['value'];
$alert->condition = $input['condition'];
$alert->user_id = $input['user'];
$alert->owner_user_id = $input['user'];
$alert->save();
return Redirect::to('/alerts');
}
示例2: Alert
try {
if ($id) {
$alertTable = Doctrine_Core::getTable('Alert');
$result = $alertTable->find($id);
if ($result) {
echo "Found alert " . $result['Id'];
$alert = $result;
$alert['Active'] = $active;
} else {
//TODO: Passed in an Id, but didn't find it. Add error here.
}
} else {
$alert = new Alert();
$alert['Active'] = 0;
}
$alert['AlertFolderId'] = $folderId;
$alert['UserId'] = $user_id;
$alert['Label'] = $label;
$alert['Description'] = $description;
$alert['EmailAddresses'] = $emailaddresses;
$alert['AlertOn'] = $alerton;
$alert['AlertOnType'] = $alertontype;
$alert['AlertOnComparator'] = $alertoncomparator;
$alert['AlertOnValue'] = $alertonvalue;
$alert['AlertThreshold'] = $alertthreshold;
$alert->save();
} catch (Exception $e) {
error_log("[WPTMonitor] Failed while updating alert: for " . $user_id . " message: " . $e->getMessage());
}
header("Location: listAlerts.php");
exit;