Undeprecated where_in method.
The initial report that requested deprecation was an error. After a manual report, I discovered that the actual method is functioning properly.
This commit is contained in:
parent
49a16cc471
commit
8acdfdbcd5
@ -482,6 +482,34 @@ class Model {
|
|||||||
return new static();
|
return new static();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define WHERE usando IN en la sentencia SQL.
|
||||||
|
*
|
||||||
|
* @param string $column
|
||||||
|
* La columna a comparar.
|
||||||
|
*
|
||||||
|
* @param array $arr
|
||||||
|
* Arreglo con todos los valores a comparar con la columna.
|
||||||
|
*
|
||||||
|
* @param bool $in
|
||||||
|
* Define si se tienen que comprobar negativa o positivamente.
|
||||||
|
*
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public static function where_in(string $column, array $arr, bool $in = true) : static {
|
||||||
|
$arrIn = [];
|
||||||
|
foreach($arr as $value) {
|
||||||
|
$arrIn[] = static::bindValue($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($in)
|
||||||
|
static::$querySelect['where'] = "$column IN (".join(', ', $arrIn).")";
|
||||||
|
else
|
||||||
|
static::$querySelect['where'] = "$column NOT IN (".join(', ', $arrIn).")";
|
||||||
|
|
||||||
|
return new static();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define LEFT JOIN en la sentencia SQL.
|
* Define LEFT JOIN en la sentencia SQL.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user