本文整理汇总了PHP中Q::order方法的典型用法代码示例。如果您正苦于以下问题:PHP Q::order方法的具体用法?PHP Q::order怎么用?PHP Q::order使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q
的用法示例。
在下文中一共展示了Q::order方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: models_json
public function models_json()
{
usleep(500000);
$object_list = C(ChatMessage)->find_all(Q::gt('id', $this->inVars('since_id', 0)), Q::order('-id'));
echo self::models_to_jsonp(array_reverse($object_list), $this->inVars('callback', 'callback'));
exit;
}
示例2: edit
/**
* ページ編集
*/
public function edit($name)
{
$this->vars('name', $name);
try {
$current = C(WikiPage)->find_get(Q::eq('name', $name), Q::order('-version'));
} catch (Exception $e) {
}
if ($this->is_post()) {
try {
$page = new WikiPage();
$page->cp($this->vars());
if (isset($current)) {
$page->version($current->version() + 1);
}
$page->save();
C($page)->commit();
$this->redirect_method('model', $name);
} catch (Exception $e) {
$this->vars('page', $page);
$this->vars('body', $page->body());
}
} else {
if (isset($current)) {
$this->vars('page', $current);
$this->vars('body', $current->body());
} else {
$default = new WikiPage();
$default->name($name);
$this->vars('page', $default);
$this->vars('body', '*' . $name);
}
}
}
示例3: last_activity
public function last_activity()
{
try {
return C(OpenpearTimeline)->find_get(Q::eq('maintainer_id', $this->id()), Q::order('-created'))->created();
} catch (Exception $e) {
return $this->created();
}
}
示例4: models
public function models()
{
$paginator = new Paginator(50, $this->inVars('page', 1));
$object_list = C(ChatMessage)->find_all(Q::order('-id'), $paginator);
$this->vars('object_list', array_reverse($object_list));
$since_id = 0;
foreach ($object_list as $object) {
$since_id = $object->id() > $since_id ? $object->id() : $since_id;
}
$this->vars('since_id', $since_id);
return $this;
}
示例5: get_by_maintainer
public static function get_by_maintainer(OpenpearMaintainer $maintainer, $limit = 20)
{
try {
$favorites = C(OpenpearFavorite)->find_all(Q::eq('maintainer_id', $maintainer->id()));
$charges = C(OpenpearCharge)->find_all(Q::eq('maintainer_id', $maintainer->id()));
$ids = array();
foreach ($favorites as $f) {
$ids[] = $f->package_id();
}
foreach ($charges as $c) {
$ids[] = $c->package_id();
}
return C(OpenpearTimeline)->find_all(new Paginator($limit), Q::in('package_id', array_unique($ids)), Q::order('-id'));
} catch (Exception $e) {
return array();
}
}
示例6: find
/**
* 検索を実行する
* @return self
*/
public static function find()
{
$args = func_get_args();
$dao = new static();
$query = new \ebi\Q();
$query->add($dao->__find_conds__());
if (!empty($args)) {
call_user_func_array([$query, 'add'], $args);
}
$paginator = $query->paginator();
if ($paginator instanceof \ebi\Paginator) {
if ($query->is_order_by()) {
$paginator->order($query->in_order_by(0)->ar_arg1(), $query->in_order_by(0)->type() == Q::ORDER_ASC);
} else {
if ($paginator->has_order()) {
$query->add(Q::order($paginator->order()));
}
}
$paginator->total(call_user_func_array([get_called_class(), 'find_count'], $args));
if ($paginator->total() == 0) {
return [];
}
}
return static::get_statement_iterator($dao, $query);
}
示例7: find_page
public function find_page($query, Paginator $paginator, $order, $porder = null)
{
return C($this)->find_all($paginator, Q::match($query), Q::select_order($order, $porder), Q::order($this->__page_order__()));
}
示例8: message_sent
/**
* 送信したメッセージ
*/
public function message_sent()
{
$user = $this->user();
$paginator = new Paginator(20, $this->in_vars('page', 1));
$this->vars('object_list', C(OpenpearMessage)->find_all($paginator, Q::eq('maintainer_from_id', $user->id()), Q::order('-id')));
$this->vars('paginator', $paginator);
}
示例9: atom
public function atom()
{
Atom::convert(module_const('sitename', 'Planet'), url(), C(PlanetEntry)->find_all(new Paginator(20), Q::order('-updated')))->output();
}
示例10: package_tags
public function package_tags()
{
// setting package tags
if (empty($this->package_tags)) {
try {
$this->package_tags = C(OpenpearPackageTag)->find_all(Q::eq('package_id', $this->id()), Q::order('-prime'));
} catch (Exception $e) {
}
}
return $this->package_tags;
}
示例11: declare
<?php
declare (ticks=1);
require dirname(__FILE__) . '/__settings__.php';
import('core.Log');
import('core.Request');
Log::disable_display();
import('Chat.ChatServer');
header('application/x-javascript');
$req = new Request();
$object_list = C(ChatMessage)->find_all(Q::gt('id', $req->inVars('since_id', 0)), Q::order('-id'));
if (count($object_list) > 0) {
echo ChatServer::models_to_jsonp(array_reverse($object_list), $req->inVars('callback', 'callback'));
exit;
}
$server = new ChatServer();
pcntl_signal(SIGTERM, array(&$server, 'models_json'));
pcntl_signal(SIGHUP, array(&$server, 'models_json'));
pcntl_signal(SIGUSR1, array(&$server, 'models_json'));
sleep(def('chat@timeout'));
示例12: fetch_queues
public static function fetch_queues($type, $limit = 5)
{
return C(OpenpearQueue)->find_all(new Paginator($limit), Q::lt('locked', time()), Q::eq('type', $type), Q::order('updated'));
}
示例13: timeline_atom_maintainer
/**
* メンテナのタイムラインをAtomフィードで出力
* @param string $maintainer_name メンテナのアカウント名
*/
public function timeline_atom_maintainer($maintainer_name)
{
// TODO 仕様の確認
$maintainer = C(OpenpearMaintainer)->find_get(Q::eq('name', $maintainer_name));
Atom::convert('Openpear Maintainer Timelines: ' . $maintainer->name(), url('timelines.atom'), C(OpenpearTimeline)->find_all(new Paginator(20), Q::eq('maintainer_id', $maintainer->id()), Q::order('-created')))->output();
}
示例14: dirname
<?php
require_once dirname(__DIR__) . '/__settings__.php';
try {
$queue = C(OpenpearNewprojectQueue)->find_get(Q::lt('trial_count', 5), Q::order('id'));
$queue->create();
} catch (Exception $e) {
# pass
}