当前位置: 首页>>代码示例>>PHP>>正文


PHP Q::contains方法代码示例

本文整理汇总了PHP中Q::contains方法的典型用法代码示例。如果您正苦于以下问题:PHP Q::contains方法的具体用法?PHP Q::contains怎么用?PHP Q::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Q的用法示例。


在下文中一共展示了Q::contains方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: maintainers

 /**
  * メンテナ一覧
  * @request integer $page ページ番号
  * @request string $q 検索クエリ
  * @context OpenpearMaintainer[] $object_list メンテナ一覧
  * @context Paginator $paginator ページネータ
  */
 public function maintainers()
 {
     $paginator = new Paginator(20, $this->in_vars('page', 1));
     $query = $this->in_vars('q') == null ? null : Q::contains('name,fullname,profile,url,location', explode(' ', $this->in_vars('q')));
     $this->vars('object_list', C(OpenpearMaintainer)->find_all($paginator, Q::order('name'), $query));
     $paginator->vars('q', $this->in_vars('q'));
     $this->vars('paginator', $paginator);
 }
开发者ID:nequal,项目名称:Openpear,代码行数:15,代码来源:OpenpearNoLogin.php

示例2: where_match

 protected function where_match(Q $q, array $self_columns)
 {
     $query = new Q();
     foreach ($q->arArg1() as $cond) {
         if (strpos($cond, "=") !== false) {
             list($column, $value) = explode("=", $cond);
             $not = substr($value, 0, 1) == "!";
             $value = $not ? strlen($value) > 1 ? substr($value, 1) : "" : $value;
             if ($value === "") {
                 $query->add($not ? Q::neq($column, "") : Q::eq($column, ""));
             } else {
                 $query->add($not ? Q::contains($column, $value, $q->param() | Q::NOT) : Q::contains($column, $value, $q->param()));
             }
         } else {
             $columns = array();
             foreach ($self_columns as $column) {
                 $columns[] = $column->name();
             }
             $query->add(Q::contains(implode(",", $columns), explode(" ", $cond), $q->param()));
         }
     }
     return $query;
 }
开发者ID:hisaboh,项目名称:w2t,代码行数:23,代码来源:DbController.php

示例3: where_sql

 protected function where_sql(\ebi\Dao $dao, &$from, \ebi\Q $q, array $self_columns, $require_where = null, $alias = true)
 {
     if ($q->is_block()) {
         $vars = $and_block_sql = $or_block_sql = [];
         $where_sql = '';
         foreach ($q->ar_and_block() as $qa) {
             list($where, $var) = $this->where_sql($dao, $from, $qa, $self_columns, null, $alias);
             if (!empty($where)) {
                 $and_block_sql[] = $where;
                 $vars = array_merge($vars, $var);
             }
         }
         if (!empty($and_block_sql)) {
             $where_sql .= ' (' . implode(' and ', $and_block_sql) . ') ';
         }
         foreach ($q->ar_or_block() as $or_block) {
             list($where, $var) = $this->where_sql($dao, $from, $or_block, $self_columns, null, $alias);
             if (!empty($where)) {
                 $or_block_sql[] = $where;
                 $vars = array_merge($vars, $var);
             }
         }
         if (!empty($or_block_sql)) {
             $where_sql .= (empty($where_sql) ? '' : ' and ') . ' (' . implode(' or ', $or_block_sql) . ') ';
         }
         if (empty($where_sql)) {
             $where_sql = $require_where;
         } else {
             if (!empty($require_where)) {
                 $where_sql = '(' . $require_where . ') and (' . $where_sql . ')';
             }
         }
         return [$where_sql, $vars];
     }
     if ($q->type() == Q::MATCH && sizeof($q->ar_arg1()) > 0) {
         $query = new \ebi\Q();
         $target = $q->ar_arg2();
         $ob = $columns = [];
         foreach ($self_columns as $column) {
             if (empty($target) || in_array($column->name(), $target)) {
                 $columns[$column->name()] = $dao->prop_anon($column->name(), 'type');
             }
         }
         foreach ($columns as $cn => $ct) {
             $and = [];
             foreach ($q->ar_arg1() as $cond) {
                 $op = null;
                 if (substr($cond, 0, 1) == '-') {
                     $cond = substr($cond, 1);
                     $op = Q::NOT;
                 }
                 switch ($ct) {
                     case 'number':
                     case 'serial':
                     case 'integer':
                     case 'timestamp':
                     case 'date':
                     case 'time':
                     case 'intdate':
                         $and[] = Q::eq($cn, $cond, $op);
                         break;
                     case 'string':
                     case 'email':
                     case 'alnum':
                         $and[] = Q::contains($cn, $cond, $op);
                         break;
                     case 'boolean':
                     case 'mixed':
                     default:
                 }
             }
             if (!empty($and)) {
                 $ob[] = call_user_func_array(['\\ebi\\Q', 'b'], $and);
             }
         }
         $query->add(call_user_func_array(['\\ebi\\Q', 'ob'], $ob));
         return $this->where_sql($dao, $from, $query, $self_columns, null, $alias);
     }
     $and = $vars = [];
     foreach ($q->ar_arg2() as $base_value) {
         $or = [];
         foreach ($q->ar_arg1() as $column_str) {
             $value = $base_value;
             $column = $this->get_column($column_str, $self_columns);
             $column_alias = $this->column_alias_sql($column, $q, $alias);
             $is_add_value = true;
             switch ($q->type()) {
                 case Q::EQ:
                     if ($value === null) {
                         $is_add_value = false;
                         $column_alias .= ' is null';
                         break;
                     }
                     $column_alias .= ' = ' . ($value instanceof \ebi\Daq ? '(' . $value->unique_sql() . ')' : '?');
                     break;
                 case Q::NEQ:
                     if ($value === null) {
                         $is_add_value = false;
                         $column_alias .= ' is not null';
                         break;
//.........这里部分代码省略.........
开发者ID:tokushima,项目名称:ebi,代码行数:101,代码来源:DbConnector.php


注:本文中的Q::contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。