Generates conditions for where clause.

@return mixed[]
544159
private function getWhereClause(): array
    {
        $result = array_merge($this->getOwnerFields(), $this->getBelongTo(), $this->getPermissions());
        $result = array_merge($result, $this->getParentPermissions(), $this->getParentJoinsWhereClause());
        $result = array_merge_recursive($result, $this->getSupervisorWhereClause());

        return $result;
    }
439008
final private function getSqlKeyConditions() {
	
		$class		= get_called_class();
		$tableKey	= (array)$class::TABLE_KEY;
		$conds		= array();
		
			foreach ($tableKey as $field) {
				$conds[] = $this->db->escape($field) . ' = ?';
			}
		
		return $conds;

	}
1152675
public function buildConditions($conditions)
    {
        if (!is_array($conditions)) {
            if (null === $conditions) {
                return '';
            }
            return $conditions;
        } elseif ($conditions === array()) {
            return '';
        }

        $n = count($conditions);
        $operator = strtoupper($conditions[0]);
        if ($operator === 'AND' || $operator === 'OR') {
            $result = array();
            for ($i = 1; $i < $n; $i++) {
                $condition = $this->buildConditions($conditions[$i]);
                if ('' !== $condition) {
                    $result[] = '(' . $condition . ')';
                }
            }
            if ($result === array()) {
                return '';
            } else {
                return implode(' ' . $operator . ' ', $result);
            }
        }

        if (!isset($conditions[1], $conditions[2])) {
            return '';
        }

        $column = $this->db->quoteColumn($conditions[1]);
        $values = $conditions[2];
        if (!is_array($values)) {
            $values = array($values);
        }
        if ($operator === 'IN' || $operator === 'NOT IN') {
            if ($values === array()) {
                return $operator === 'IN' ? '0' : '';
            }
            foreach ($values as $k => $value) {
                $values[$k] = $this->db->quote($value);
            }

            return $column . ' ' . $operator . ' (' . implode(',', $values) . ')';
        } elseif ($operator === 'LIKE' || $operator === 'NOT LIKE' || $operator === 'OR LIKE' || $operator === 'OR NOT LIKE') {
            if ($values === array()) {
                return ($operator === 'LIKE' || $operator === 'OR LIKE') ? '0' : '';
            }
            if ($operator === 'LIKE' || $operator === 'NOT LIKE') {
                $andor = 'AND';
            } else {
                $andor = 'OR';
                $operator = $operator === 'OR LIKE' ? 'LIKE' : 'NOT LIKE';
            }

            $result = array();
            foreach ($values as $k => $value) {
                $result[] = $column . ' ' . $operator . ' ' . $this->db->quote($value);
            }

            return implode($andor, $result);
        } else {
            throw new Exception('Invalid operator "' . $operator . '"');
        }
    }
1054573
public function where()
    {
        $args = func_get_args();
        $cond = $this->condition();
        $cond = call_user_func_array(array($cond, 'where'), $args);
        return $cond;
    }
514317
protected function buildHavingConditions()
    {
        $join = ($this->havingType == 'AND') ? 'AND' : 'OR';
        $this->havingType = null;

        return $this->makeConditions('having', $join);
    }
519343
protected function initFilters()
    {
        $initColumnSearch = $this->initColumnSearch;
        foreach ($this->columns as $c) {
            if (isset($c['sqlFilter'])) {
                $where_condition = $this->generateSQLColumnFilter($this->toSQLColumn($c, 2), $c['sqlFilter']);
                if (!$this->setHaving($where_condition, $c)) {
                    $initColumnSearch[] = $this->generateSQLColumnFilter($this->toSQLColumn($c, 2), $c['sqlFilter']);
                }
            }
        }

        return implode(' AND ', $initColumnSearch);
    }
111582
public function generateSearchConditions()
    {
        $tabs = $this->generateRelations();		
                       
        $columns = [];
        if (($table = $this->getTableSchema()) === false) {
            $class = $this->modelClass;
            /* @var $model \yii\base\Model */
            $model = new $class();
            foreach ($model->attributes() as $attribute) {
                $columns[$attribute] = 'unknown';
            }
        } else {
            foreach ($table->columns as $column) {
                $columns[$column->name] = $column->type;
            }
        }

		$numConditions = [];
        $likeConditions = [];
        $hashConditions = [];
        $timeConditions = [];
        $nf = [];
        $hf = [];
        $tf = [];
        $lf = [];
        
        foreach ($tabs as $tab)
        {        
			if (!$tab)
			{
				foreach ($columns as $column => $type) {
					switch ($type) {
						case Schema::TYPE_SMALLINT:
						case Schema::TYPE_INTEGER:
						case Schema::TYPE_BIGINT:						
						case Schema::TYPE_FLOAT:
						case Schema::TYPE_DECIMAL:
						case Schema::TYPE_MONEY:
							$numConditions[] = "['{$column}'".($column == "id"?",\$this->tableName()":"")."]";
							break;
						case Schema::TYPE_BOOLEAN:
						case Schema::TYPE_DATE:
						case Schema::TYPE_TIME:
						case Schema::TYPE_DATETIME:
							$hashConditions[] = "'{$column}'".($tab?",'{{%{$tab}}}'":"")." => \$this->{$column},";
							break;
						case Schema::TYPE_TIMESTAMP:
							$timeConditions[] = "['{$column}'".($tab?",'{{%{$tab}}}'":"")."]";
							break;
						default:
							$likeConditions[] = "['{$column}'".($tab?",'{{%{$tab}}}'":"")."]";
							break;
					}
				}
			}
			else
			{
				$nf[] = "['id'".($tab?",'{{%{$tab}}}'":"")."]";	
				$hf[] = "'id'".($tab?",'{{%{$tab}}}'":"")." => \$this->".$tab."Id,";
				$tf[] = "['id'".($tab?",'{{%{$tab}}}'":"")."]";	
				$lf[] = "['id'".($tab?",'{{%{$tab}}}'":"")."]";	
			}
		}
		
        $conditions = [];
        if (!empty($hashConditions)) {
            $conditions[] = "\$query->andFilterWhere([\n"
                . str_repeat(' ', 12) . implode("\n" . str_repeat(' ', 12), $hashConditions)."\n"
                . str_repeat(' ', 12) .'/*'. implode("\n" . str_repeat(' ', 12), $nf).'*/'
                . "\n" . str_repeat(' ', 8) . "]);\n";
        }
        if (!empty($numConditions)) {
            $conditions[] = "\$params = self::queryNumber([".implode(",",$numConditions)."".(count($hf) == 0?"":"/*".implode(",",$nf)."*/")."]);
		foreach (\$params as \$p)
		{
			\$query->andFilterWhere(\$p);
		}";
        }
        if (!empty($likeConditions)) {
            $conditions[] = "\$params = self::queryString([".implode(",",$likeConditions)."".(count($lf) == 0?"":"/*".implode(",",$lf)."*/")."]);
		foreach (\$params as \$p)
		{
			\$query->andFilterWhere(\$p);
		}";
        }
        if (!empty($timeConditions)) {
            $conditions[] = "\$params = self::queryTime([".implode(",",$timeConditions)."".(count($tf) == 0?"":"/*".implode(",",$tf)."*/")."]);
		foreach (\$params as \$p)
		{
			\$query->andFilterWhere(\$p);
		}";
        }

        return $conditions;
    }
696125
public function whereParameters()
    {
        return array_filter(
            $this->queryParameters,
            function ($queryParameter) {
                $key = $queryParameter['key'];
                return (! in_array($key, $this->predefinedParams));
            }
        );
    }
1278639
public function getClauses()
    {
        return array(
            $this->getSelect(),
            $this->getFrom(),
            $this->getJoins(),
            $this->getWhere(),
            $this->getGroup(),
            $this->getOrder(),
            $this->getLimit(),
        );
    }
1207646
protected function where($where)
    {
        foreach($where as $field => $value) {
            $this->queryBuilder->where($field, $value);
        }
    }
1282007
public function getConditionalLogic(): array
    {
        $conditionals = [];

        foreach ($this->config->get('conditional_logic') as $rules) {
            $conditional = new Conditional($rules, $this->parentKey);

            $conditionals[] = $conditional->toArray();
        }

        return $conditionals;
    }
1128114
public function getWhere()
    {
        $where = $this->where;

        if (! $where) {
            return [];
        }

        foreach ($where['$or'] as &$and) {
            if (isset($and['$and']) && count($and['$and']) === 1) {
                $and = reset($and['$and']);
            }

            if (isset($and['$or']) && count($and['$or']) === 1) {
                $and = reset($and['$or']);
            }
        }

        if (count($where['$or']) === 1) {
            $where = reset($where['$or']);
        }

        return $where;
    }
77669
private function getConditionSelectQuery(): QueryBuilder
    {
        $query = $this->connection->createQueryBuilder();
        $query->select('DISTINCT ngbm_rule_condition.*')
            ->from('ngbm_rule_condition');

        return $query;
    }
790617
def where_clause(self):
        
        cond = self._make_condition(self.restriction)
        return '' if cond is True else ' WHERE %s' % cond
241384
protected function _whereExpr($where)
    {
        if (empty($where)) {
            return $where;
        }
        if (!is_array($where)) {
            $where = array($where);
        }
        foreach ($where as $cond => &$term) {
            // is $cond an int? (i.e. Not a condition)
            if (is_int($cond)) {
                // $term is the full condition
                if ($term instanceof Zend_Db_Expr) {
                    $term = $term->__toString();
                }
            } else {
                // $cond is the condition with placeholder,
                // and $term is quoted into the condition
                $term = $this->quoteInto($cond, $term);
            }
            $term = '(' . $term . ')';
        }

        $where = implode(' AND ', $where);
        return $where;
    }
735929
private function buildWhereForUpdate()
    {
        $whereArray = array_combine($this->where, $this->bindings);
        list($whereNew, $condition) = $this->formatWhereToNamePlaceHolder($whereArray);

        return [$whereNew, $this->buildWherePlaceholderName($whereNew)];
    }
1231958
public function getCondition()
	{
		$value = $this->getValue();

		return [$this->column => [
			'from' => isset($value['from']) ? $value['from'] : '',
			'to' => isset($value['to']) ? $value['to'] : '',
		]];
	}