當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Database::fetchArray方法代碼示例

本文整理匯總了PHP中core\Database::fetchArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP Database::fetchArray方法的具體用法?PHP Database::fetchArray怎麽用?PHP Database::fetchArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在core\Database的用法示例。


在下文中一共展示了Database::fetchArray方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: TaskInstance

<?php

/*! HeadlessWorker.php | Takes care of headless process ahead. */
require_once '.private/scripts/Initialize.php';
use core\Database;
use core\Log;
use framework\Bayeux;
use framework\Configuration as conf;
use framework\Service;
use models\WorkInstance;
use models\TaskInstance;
$taskInstance = new TaskInstance();
// Consumes Headless tasks ahead.
$tasks = Database::fetchArray('SELECT `nextTask` FROM `WorkInstance`
  WHERE `nextTask` IN (SELECT `uuid` FROM `TaskInstance` WHERE `type` = \'Headless\')
    AND `state` = \'Open\';');
$tasks = array_map(compose('core\\Utility::unpackUuid', prop('nextTask')), $tasks);
if ($tasks) {
    Log::debug(sprintf('%d headless tasks found!', count($tasks)), $tasks);
}
$serviceOptions = array('resolver' => new framework\Resolver());
$serviceOptions['resolver']->registerResolver(new resolvers\WebServiceResolver(array('prefix' => conf::get('web::resolvers.service.prefix', '/service'))));
foreach ($tasks as $taskUuid) {
    // renew response object for each call
    $serviceOptions['response'] = new framework\Response(array('autoOutput' => false));
    Service::call('_/WorkInstance', 'process', array($taskUuid), $serviceOptions);
    // todo: send bayeux update message to notify related users about the task update.
}
開發者ID:Victopia,項目名稱:prefw,代碼行數:28,代碼來源:HeadlessWorker.php


注:本文中的core\Database::fetchArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。