@param array | Condition[] $conditions

@return array
347331
protected function arrayToConditions($conditions)
    {
        $ret = [];

        foreach ($conditions as $key => $value) {
            if ($value instanceof Condition) {
                $ret[] = $value;
                continue;
            }

            $propertyOperator = explode('-', $key);

            if (in_array(count($propertyOperator), [1, 2])) {
                $ret[] = new Condition($propertyOperator[0], $value, $propertyOperator[1] ?? null);
            }
        }

        return $ret;
    }
356662
public function addConditions(array $conditions = array())
    {
        foreach ($conditions as $key => $condition) {
            if (is_array($condition)) {
                call_user_func_array(array($this, 'addCondition'), $condition);
            } elseif (!$this->getBuilder()->getHelper()->isNumber($key)) {
                call_user_func_array(array($this, 'addCondition'), array($key, $condition));
            } else {
                $this->addCondition($condition);
            }
        }

        return $this;
    }
1260107
public function findBy(array $conditions)
    {
        $s = $this->selector();
        foreach ($conditions as $column => $value) {
            $s->where($column, '=', $value);
        }

        return $s->execute();
    }
1277945
protected function setConditions($conditions = [])
    {
        if ($conditions instanceof Closure || is_array($conditions)) {
            $this->conditions = $conditions;
        } else {
            $this->conditions = [$conditions];
        }
    }
997959
protected function processConditions(array $conditions) {
		foreach($cp=$conditions as $k=>$v) {
			if(is_numeric($k) || in_array(strtolower($k), ['and', 'or', 'xor', 'not'])) {
				$newK = $k;
				if(is_array($v))
					$v = $this->processConditions($v);
				else
					$v = $this->replaceTable($v);
			}
			else
				$newK = $this->replaceTable($k);

			if($newK != $k)
				unset($conditions[$k]);
			$conditions[$newK] = $v;
		}

		return $conditions;
	}
760807
public function conditions($conditions, $context) {
		$path = null;
		if (isset($conditions['design'])) {
			$paths = ['design', 'view'];
			foreach ($paths as $element) {
				if (isset($conditions[$element])) {
					$path .= "_{$element}/{$conditions[$element]}/";
					unset($conditions[$element]);
				}
			}
		}
		if (isset($conditions['id'])) {
			$path = "{$conditions['id']}";
			unset($conditions['id']);
		}
		if (isset($conditions['path'])) {
			$path = "{$conditions['path']}";
			unset($conditions['path']);
		}
		return [$path, $conditions];
	}
979522
public static function arrWhere(Array $conditions)
    {

        $model = static::class;
        $obj = new $model();

        foreach ($conditions as $condition) {
            if (count($condition) == 2) {
                $obj = $obj->where($condition[0], $condition[1]);
            } elseif (count($condition) == 3) {
                if (strtolower(trim($condition[1])) === 'between') {
                    $obj = $obj->whereBetween($condition[0], $condition[2]);
                } else {
                    $obj = $obj->where($condition[0], $condition[1], $condition[2]);
                }
            } elseif (count($condition) == 4) {
                if (strtolower(trim($condition[1])) === 'between') {
                    $obj = $obj->whereBetween($condition[0], $condition[2], $condition[3]);
                } else {
                    $obj = $obj->where($condition[0], $condition[1], $condition[2], $condition[3]);
                }
            } else {
                throw new \Exception("Invalid " . strtoupper($key) . " condition", 1);
            }
        }

        return $obj;
    }
271773
public function filterConditions(
        array $conditions,
        string $matchType = CollectionUtility::MATCH_TYPE_LOOSE,
        $preserveKeys = false
    ): ArrayObjectInterface {
        return new static(CollectionUtility::filterWhere($this->isCollection() ? $this->data : [$this->data],
            $conditions, $matchType, $preserveKeys));
    }
331828
protected function _searchConditions($conditions = []) {
		$model = $this->MimeTypes->alias;

		$sessionSearch = $this->request->getSession()->read($model . '.search');
		$fieldStr = '';
		$searchStr = '';

		if (!empty($this->request->query['clear']) && $this->request->query['clear'] === 'search') {
			$this->request->getSession()->delete($model . '.search');
		} else {

		if ($this->request->getData() && !empty($this->request->data['Form']['field'])) {
			$fieldStr = $this->request->data['Form']['field'];
		} elseif (!empty($this->request->query['field'])) {
			$fieldStr = $this->request->query['field'];
		} elseif (!empty($sessionSearch['field'])) {
			$fieldStr = $sessionSearch['field'];
		}

		if ($this->request->getData() && !empty($this->request->data['Form']['search'])) {
			$searchStr = $this->request->data['Form']['search'];
		} elseif (!empty($this->request->query['search'])) {
			$searchStr = $this->request->query['search'];
		} elseif (!empty($sessionSearch['search'])) {
			$searchStr = $sessionSearch['search'];
		}

		}
		$this->set(compact('fields', 'searchStr'));

		if (!empty($searchStr)) {
			$this->request->getSession()->write($model . '.search', ['search' => $searchStr, 'field' => $fieldStr]);

			$conditions['or'][$model . '.name LIKE'] = '%' . $searchStr . '%';
			$conditions['or'][$model . '.ext LIKE'] = '%' . $searchStr . '%';
			$conditions['or'][$model . '.type LIKE'] = '%' . $searchStr . '%';
			$conditions['or'][$model . '.alt_type LIKE'] = '%' . $searchStr . '%';
		}
		return $conditions;
	 }
806668
public function having($conditions, $parameters = [])
	{
		$this->having = [];

		if (!empty($conditions)) {
			$this->addHaving($conditions, $parameters);
		}

		return $this;
	}
452417
public static function ToString($Conditions) {
      $Result = '';

      foreach ($Conditions as $Condition) {
         if (!is_array($Condition) || count($Condition) < 2)
            continue; // skip ill-formatted conditions.

         if (strlen($Result) > 0)
            $Result .= "\n";

         $Result .= "{$Condition[0]},{$Condition[1]}";
         if (count($Condition) >= 3) {
            $Result .= $Condition[2];
         }
      }
      return $Result;
   }
914965
public function getItems(array $conditions = array())
    {
        $list = $this->getList($conditions);

        if (empty($list)) {
            return array();
        }

        $handler_id = null;

        $items = array();
        foreach ((array) $list as $item) {
            $handler_id = $item['type'];
            $items[$item['entity_id']] = $item;
        }

        $handlers = $this->collection->getHandlers();

        $entity_conditions = array(
            'status' => isset($conditions['status']) ? $conditions['status'] : null,
            $handlers[$handler_id]['entity'] . '_id' => array_keys($items)
        );

        $entities = $this->getListEntities($handler_id, $entity_conditions);

        if (empty($entities)) {
            return array();
        }

        foreach ($entities as $entity_id => &$entity) {
            if (isset($items[$entity_id])) {
                $entity['weight'] = $items[$entity_id]['weight'];
                $entity['collection_item'] = $items[$entity_id];
                $entity['collection_handler'] = $handlers[$handler_id];
            }
        }

        gplcart_array_sort($entities);
        return $entities;
    }
293805
public function where($conditions)
    {
        if ($conditions = is_array($conditions) && func_num_args() === 1 ? $conditions : func_get_args()) {
            $this->_parts['where'][] = $conditions;
        }
        return $this;
    }
1155870
protected function prepareArray(array $conditions)
    {
        switch (count($conditions)) {
            case 1:
                $result = $conditions[0];
                break;
            case 2:
                if (is_array($conditions[1])) {
                    $result = $conditions[0].' IN ('.implode(',', $conditions[1]).')';
                } elseif (is_null($conditions[1])) {
                    $result = $conditions[0].' IS NULL';
                } elseif ($conditions[1] instanceof \pwf\components\querybuilder\interfaces\SelectBuilder) {
                    $result = $conditions[0].' IN ('.$conditions[1]->generate().')';
                    $this->setParams(array_merge($this->getParams(),
                            $conditions[1]->getParams()));
                } else {
                    $result = $conditions[0].'=?';//.$conditions[0];
                    $this->addParam($conditions[0], $conditions[1]);
                }
                break;
            case 3:
                $left   = is_array($conditions[1]) ? $this->prepareConditions($conditions[1])
                        : $conditions[1];
                $right  = is_array($conditions[2]) ? $this->prepareConditions($conditions[2])
                        : $conditions[2];
                $result = '(('.$left.') '.$conditions[0].' ('.$right.'))';
                break;
            default:
                throw new \Exception('Wrong condition configuration');
        }

        return $result;
    }
1202319
public function findAllBy(array $conditions = array())
    {
        $sql = sprintf('SELECT * FROM %s', $this->getTableName());
        $whereConditions = $this->assembleEquality($conditions);
        $where = sprintf('WHERE %s', implode(' AND ', $whereConditions));
        $sql .= " $where";

        return $this->selectQuery($sql, $conditions);
    }
771546
public function remove($conditions)
    {
        $sql = 'DELETE FROM ' . $this->table .
            ' WHERE id = :id';

        $stat = $this->pdo->prepare($sql);
        $stat->bindValue(':id', $conditions);

        return $stat->execute();
    }
1219484
protected function validateConditions(array $conditions)
    {
        foreach ($conditions as $key => $val) {
            if ($this->referenceResolver->isReference($key)) {
                return true;
            }
        }

        return parent::validateConditions($conditions);
    }