mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-14 07:28:41 +00:00
Fix find functionality
This commit is contained in:
parent
8c53047ee4
commit
50ab50c67e
|
|
@ -311,11 +311,10 @@ class DataMapperAbstract implements DataMapperInterface
|
||||||
|
|
||||||
foreach(static::$columns as $col) {
|
foreach(static::$columns as $col) {
|
||||||
if(isset($col['autocomplete']) && $col['autocomplete']) {
|
if(isset($col['autocomplete']) && $col['autocomplete']) {
|
||||||
$query->where($col['name'], 'LIKE', $search, 'OR');
|
$query->where(static::$table . '.' . $col['name'], 'LIKE', '%' . $search . '%', 'OR');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return static::getAllByQuery($query);
|
return static::getAllByQuery($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -176,12 +176,12 @@ class Builder extends BuilderAbstract
|
||||||
protected $unionOrders = [];
|
protected $unionOrders = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comparison operators.
|
* Comparison OPERATORS.
|
||||||
*
|
*
|
||||||
* @var string[]
|
* @var string[]
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
/* public */ const operators = [
|
/* public */ const OPERATORS = [
|
||||||
'=',
|
'=',
|
||||||
'<',
|
'<',
|
||||||
'>',
|
'>',
|
||||||
|
|
@ -459,14 +459,14 @@ class Builder extends BuilderAbstract
|
||||||
public function where($columns, $operator = null, $values = null, $boolean = 'and') : Builder
|
public function where($columns, $operator = null, $values = null, $boolean = 'and') : Builder
|
||||||
{
|
{
|
||||||
// TODO: handle $value is null -> operator NULL
|
// TODO: handle $value is null -> operator NULL
|
||||||
if (isset($operator) && !is_array($operator) && !in_array($operator, self::operators)) {
|
if (isset($operator) && !is_array($operator) && !in_array(strtolower($operator), self::OPERATORS)) {
|
||||||
throw new \InvalidArgumentException('Unknown operator.');
|
throw new \InvalidArgumentException('Unknown operator.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($columns)) {
|
if (is_array($columns)) {
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($columns as $key => $column) {
|
foreach ($columns as $key => $column) {
|
||||||
if (isset($operator[$i]) && !in_array($operator[$i], self::operators)) {
|
if (isset($operator[$i]) && !in_array(strtolower($operator[$i]), self::OPERATORS)) {
|
||||||
throw new \InvalidArgumentException('Unknown operator.');
|
throw new \InvalidArgumentException('Unknown operator.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -480,7 +480,7 @@ class Builder extends BuilderAbstract
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
} elseif (is_string($columns)) {
|
} elseif (is_string($columns)) {
|
||||||
if (isset($operator) && !in_array($operator, self::operators)) {
|
if (isset($operator) && !in_array(strtolower($operator), self::OPERATORS)) {
|
||||||
throw new \InvalidArgumentException('Unknown operator.');
|
throw new \InvalidArgumentException('Unknown operator.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user