本文整理汇总了PHP中Batch::retrieve方法的典型用法代码示例。如果您正苦于以下问题:PHP Batch::retrieve方法的具体用法?PHP Batch::retrieve怎么用?PHP Batch::retrieve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Batch
的用法示例。
在下文中一共展示了Batch::retrieve方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_process
public function action_process($id)
{
if (Request::$is_ajax && Batch::exists($id)) {
try {
// Retrieve batch from DB in the state we last left it :
$batch = Batch::retrieve($id);
// Process as many steps as possible during current request :
if ($batch->process() === Batch::FINISHED) {
//
// Batch finished. Delete batch from db.
$batch->delete();
$this->request->response = '0';
} else {
// Batch not finished. Store current state of batch in DB so that next time we restart execution from here.
$batch->store();
$this->request->response = '1';
}
} catch (Exception $e) {
if (isset($batch)) {
$batch->delete();
}
throw $e;
}
} else {
$this->request->status = 403;
}
}