public function buildConditions($filterData = null, $filterConditions = null, $plugin = null, $limit = CAKE_THEME_FILTER_ROW_LIMIT) {
		$result = [];
		if (empty($filterData) || !is_array($filterData)) {
			return $result;
		}

		if (!is_array($filterConditions)) {
			$filterConditions = [];
		}

		$conditionsGroup = null;
		if (isset($filterConditions['group'])) {
			$conditionsGroup = $filterConditions['group'];
		}
		$conditionSignGroup = $this->_parseConditionGroup($conditionsGroup);
		$conditionsCache = [];
		$filterRowCount = 0;
		$limit = (int)$limit;
		if ($limit <= 0) {
			$limit = CAKE_THEME_FILTER_ROW_LIMIT;
		}

		foreach ($filterData as $index => $modelInfo) {
			if (!is_int($index) || !is_array($modelInfo)) {
				continue;
			}

			$filterRowCount++;
			if ($filterRowCount > $limit) {
				break;
			}

			foreach ($modelInfo as $filterModel => $filterField) {
				if (!is_array($filterField)) {
					continue;
				}

				foreach ($filterField as $filterFieldName => $filterFieldValue) {
					if ($filterFieldValue === '') {
						continue;
					}

					$condSign = null;
					if (isset($filterConditions[$index][$filterModel][$filterFieldName])) {
						$condSign = $filterConditions[$index][$filterModel][$filterFieldName];
					}
					$condition = $this->getCondition($filterModel . '.' . $filterFieldName, $filterFieldValue, $condSign, $plugin);
					if ($condition === false) {
						continue;
					}

					$cacheKey = md5(serialize($condition));
					if (in_array($cacheKey, $conditionsCache)) {
						continue;
					}

					$result[$conditionSignGroup][] = $condition;
					$conditionsCache[] = $cacheKey;
				}
			}
		}
		if (isset($result[$conditionSignGroup]) && (count($result[$conditionSignGroup]) == 1)) {
			$result = array_shift($result[$conditionSignGroup]);
		}

		return $result;
	}