From b0891885f9ae119c3f9f84e1afe1de8ed33d3099 Mon Sep 17 00:00:00 2001 From: kj Date: Sun, 7 Sep 2025 15:20:06 -0300 Subject: [PATCH] BREAKING CHANGE: Make select, from, and setNull methods variadic. --- src/Libs/Model.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Libs/Model.php b/src/Libs/Model.php index a3e617a..305bdd9 100644 --- a/src/Libs/Model.php +++ b/src/Libs/Model.php @@ -473,7 +473,7 @@ class Model * * @return static */ - public static function select(array $columns): static + public static function select(...$columns): static { static::$querySelect['select'] = $columns; @@ -488,7 +488,7 @@ class Model * * @return static */ - public static function from(array $tables): static + public static function from(...$tables): static { static::$querySelect['from'] = join(', ', $tables); @@ -983,15 +983,15 @@ class Model * Permite definir como nulo el valor de un atributo. * Sólo funciona para actualizar un elemento de la BD, no para insertar. * - * @param string|array $atts - * Atributo o arreglo de atributos que se definirán como nulos. + * @param array $attributes + * Atributo o arreglo de atributos que se definirán como nulos. * * @return void */ - public function setNull(string|array $atts): void + public function setNull(...$attributes): void { - if (is_array($atts)) { - foreach ($atts as $att) { + if (is_array($attributes)) { + foreach ($attributes as $att) { if (!in_array($att, $this->toNull)) { $this->toNull[] = $att; } @@ -999,8 +999,8 @@ class Model return; } - if (!in_array($atts, $this->toNull)) { - $this->toNull[] = $atts; + if (!in_array($attributes, $this->toNull)) { + $this->toNull[] = $attributes; } } }