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:
KJ 2024-02-17 22:10:30 -04:00
parent 49a16cc471
commit 8acdfdbcd5
1 changed files with 28 additions and 0 deletions

View File

@ -482,6 +482,34 @@ class Model {
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.
*