本文整理汇总了PHP中Select::orWhere方法的典型用法代码示例。如果您正苦于以下问题:PHP Select::orWhere方法的具体用法?PHP Select::orWhere怎么用?PHP Select::orWhere使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Select
的用法示例。
在下文中一共展示了Select::orWhere方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _buildWhereClause
//.........这里部分代码省略.........
$select->where->greaterThanOrEqualTo('ct.montant_cotis', $this->_filters->contrib_min_amount);
}
if ($this->_filters->contrib_max_amount) {
$select->where->lessThanOrEqualTo('ct.montant_cotis', $this->_filters->contrib_max_amount);
}
}
if ($this->_filters->contributions_types) {
$select->where->in('ct.id_type_cotis', $this->_filters->contributions_types);
}
if ($this->_filters->payments_types) {
$select->where->in('ct.type_paiement_cotis', $this->_filters->payments_types);
}
if (count($this->_filters->contrib_dynamic) > 0 && !isset($this->_filters->contrib_dynamic['empty'])) {
foreach ($this->_filters->contrib_dynamic as $k => $cd) {
$qry = '';
$prefix = 'a.';
$field = null;
$qop = ' LIKE ';
if (is_array($cd)) {
//dynamic choice spotted!
$prefix = 'cdfc' . $k . '.';
$qry = 'dfc.field_form = \'contrib\' AND ' . 'dfc.field_id = ' . $k . ' AND ';
$field = 'id';
} else {
//dynamic field spotted!
$prefix = 'dfc.';
$qry = 'dfc.field_form = \'contrib\' AND ' . 'dfc.field_id = ' . $k . ' AND ';
$field = 'field_val';
}
if (is_array($cd)) {
$select->where->in($prefix . $field, $cd);
} else {
$qry .= 'LOWER(' . $prefix . $field . ') ' . $qop . ' ';
$select->where($qry . '%' . strtolower($cd) . '%');
}
}
}
if (count($this->_filters->free_search) > 0 && !isset($this->_filters->free_search['empty'])) {
foreach ($this->_filters->free_search as $fs) {
$fs['search'] = mb_strtolower($fs['search']);
$qop = null;
switch ($fs['qry_op']) {
case AdvancedMembersList::OP_EQUALS:
$qop = '=';
break;
case AdvancedMembersList::OP_CONTAINS:
$qop = 'LIKE';
$fs['search'] = '%' . $fs['search'] . '%';
break;
case AdvancedMembersList::OP_NOT_EQUALS:
$qop = '!=';
break;
case AdvancedMembersList::OP_NOT_CONTAINS:
$qop = 'NOT LIKE';
$fs['search'] = '%' . $fs['search'] . '%';
break;
case AdvancedMembersList::OP_STARTS_WITH:
$qop = 'LIKE';
$fs['search'] = $fs['search'] . '%';
break;
case AdvancedMembersList::OP_ENDS_WITH:
$qop = 'LIKE';
$fs['search'] = '%' . $fs['search'];
break;
default:
Analog::log('Unknown query operator: ' . $fs['qry_op'] . ' (will fallback to equals)', Analog::WARNING);
$qop = '=';
break;
}
$qry = '';
$prefix = 'a.';
if (strpos($fs['field'], 'dync_') === 0) {
//dynamic choice spotted!
$index = str_replace('dync_', '', $fs['field']);
$prefix = 'cdf' . $index . '.';
$qry = 'df.field_form = \'adh\' AND df.field_id = ' . str_replace('dync_', '', $fs['field']) . ' AND ';
$fs['field'] = 'val';
} elseif (strpos($fs['field'], 'dyn_') === 0) {
//dynamic field spotted!
$prefix = 'df.';
$qry = 'df.field_form = \'adh\' AND df.field_id = ' . str_replace('dyn_', '', $fs['field']) . ' AND ';
$fs['field'] = 'field_val';
}
if (!strncmp($fs['field'], 'bool_', strlen('bool_'))) {
$qry .= $prefix . $fs['field'] . $qop . ' ' . $fs['search'];
} else {
$qry .= 'LOWER(' . $prefix . $fs['field'] . ') ' . $qop . ' ' . $zdb->platform->quoteValue($fs['search']);
}
if ($fs['log_op'] === AdvancedMembersList::OP_AND) {
$select->where($qry);
} elseif ($fs['log_op'] === AdvancedMembersList::OP_OR) {
$select->orWhere($qry);
}
}
}
}
} catch (\Exception $e) {
Analog::log(__METHOD__ . ' | ' . $e->getMessage(), Analog::WARNING);
}
}