protected function alter_query(Query $query, array $conditions) { if (isset($conditions['nid'])) { $query->where('nid = ?', (int) $conditions['nid']); } $query->where('status != "spam" && status != "pending"'); return $query->order('created'); }
protected function scope_ordered(Query $query, $direction = -1) { return $query->order('created ' . ($direction < 0 ? 'DESC' : 1)); }
/** * Changes the order of the query with "weight, create". * * @param Query $query * * @return Query */ protected function scope_ordered(Query $query, $direction = 1) { $direction = $direction < 0 ? 'DESC' : 'ASC'; return $query->order("weight {$direction}, created_at {$direction}"); }
/** * Orders the records according to their popularity. */ public function alter_query_with_order(Query $query, $order_direction) { return $query->order("(SELECT COUNT(vtid) FROM {self}__nodes WHERE vtid = term.vtid) " . ($order_direction < 0 ? 'DESC' : 'ASC')); }
public function alter_query_with_order(Query $query, $order_direction) { return $query->order("(SELECT COUNT(uid) FROM {prefix}users_logins WHERE uid = user.uid) " . ($order_direction < 0 ? 'desc' : 'asc')); }
/** * Orders the records according to the `author` column. */ public function alter_query_with_order(Query $query, $order_direction) { return $query->order('`author` ' . ($order_direction < 0 ? 'DESC' : 'ASC')); }
public function alter_query_with_order(Query $query, $order_direction) { $keys = array_keys($this->resolved_user_names); if ($order_direction < 0) { $keys = array_reverse($keys); } return $query->order($this->id, $keys); }
/** * Alters the query with an order. * * The {@link $column_name} property is used. * * @param Query $query * @param int $order_direction "DESC" if inferior to 0, "ASC" otherwise. * * @return Query */ public function alter_query_with_order(Query $query, $order_direction) { return $query->order("`{$this->column_name}` " . ($order_direction < 0 ? 'DESC' : 'ASC')); }