改名
This commit is contained in:
@@ -106,7 +106,26 @@ trait Condition
|
|||||||
return $condition;
|
return $condition;
|
||||||
}
|
}
|
||||||
foreach ($condition as $key => $value) {
|
foreach ($condition as $key => $value) {
|
||||||
if (empty($value)) continue;
|
$array = $this->resolve($array, $key, $value);
|
||||||
|
}
|
||||||
|
if (is_array($array)) {
|
||||||
|
return implode(' AND ', $array);
|
||||||
|
}
|
||||||
|
return $array;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $array
|
||||||
|
* @param $key
|
||||||
|
* @param $value
|
||||||
|
* @return mixed
|
||||||
|
* @throws NotFindClassException
|
||||||
|
* @throws ReflectionException
|
||||||
|
*/
|
||||||
|
private function resolve($array, $key, $value): mixed
|
||||||
|
{
|
||||||
|
if (empty($value)) return $array;
|
||||||
if (!is_numeric($key)) {
|
if (!is_numeric($key)) {
|
||||||
$array[] = sprintf('%s=%s', $key, $value);
|
$array[] = sprintf('%s=%s', $key, $value);
|
||||||
} else if (is_array($value)) {
|
} else if (is_array($value)) {
|
||||||
@@ -114,8 +133,7 @@ trait Condition
|
|||||||
} else {
|
} else {
|
||||||
$array[] = sprintf('%s', $value);
|
$array[] = sprintf('%s', $value);
|
||||||
}
|
}
|
||||||
}
|
return $array;
|
||||||
return implode(' AND ', $array);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -128,7 +146,6 @@ trait Condition
|
|||||||
*/
|
*/
|
||||||
private function _arrayMap($condition, $array): string
|
private function _arrayMap($condition, $array): string
|
||||||
{
|
{
|
||||||
var_dump($condition);
|
|
||||||
if (!isset($condition[0])) {
|
if (!isset($condition[0])) {
|
||||||
return implode(' AND ', $this->_hashMap($condition));
|
return implode(' AND ', $this->_hashMap($condition));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user