本文整理汇总了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.
}