15
15
use Yiisoft \Db \Exception \InvalidConfigException ;
16
16
use Yiisoft \Db \Exception \NotSupportedException ;
17
17
use Yiisoft \Db \Expression \Expression ;
18
+ use Yiisoft \Db \Expression \ExpressionInterface ;
19
+ use Yiisoft \Db \Query \QueryPartsInterface ;
18
20
19
21
use function array_diff_key ;
20
22
use function array_diff ;
@@ -695,11 +697,11 @@ public function update(array|null $properties = null): int
695
697
return $ this ->updateInternal ($ properties );
696
698
}
697
699
698
- public function updateAll (array $ propertyValues , array |string $ condition = [], array $ params = []): int
700
+ public function updateAll (array $ propertyValues , array |string $ condition = [], array | ExpressionInterface | string | null $ from = null , array $ params = []): int
699
701
{
700
702
$ command = $ this ->db ()->createCommand ();
701
703
702
- $ command ->update ($ this ->tableName (), $ propertyValues , $ condition , $ params );
704
+ $ command ->update ($ this ->tableName (), $ propertyValues , $ condition , $ from , $ params );
703
705
704
706
return $ command ->execute ();
705
707
}
@@ -720,6 +722,8 @@ public function updateAll(array $propertyValues, array|string $condition = [], a
720
722
* Use negative values if you want to decrement the counters.
721
723
* @param array|string $condition The conditions that will be put in the `WHERE` part of the `UPDATE` SQL.
722
724
* Please refer to {@see Query::where()} on how to specify this parameter.
725
+ * @param array|ExpressionInterface|string|null $from The FROM part of the `UPDATE` SQL.
726
+ * Please refer to {@see QueryPartsInterface::from()} on how to specify this parameter.
723
727
* @param array $params The parameters (name => value) to be bound to the query.
724
728
*
725
729
* Do not name the parameters as `:bp0`, `:bp1`, etc., because they are used internally by this method.
@@ -730,7 +734,7 @@ public function updateAll(array $propertyValues, array|string $condition = [], a
730
734
*
731
735
* @return int The number of rows updated.
732
736
*/
733
- public function updateAllCounters (array $ counters , array |string $ condition = '' , array $ params = []): int
737
+ public function updateAllCounters (array $ counters , array |string $ condition = '' , array | ExpressionInterface | string | null $ from = null , array $ params = []): int
734
738
{
735
739
$ n = 0 ;
736
740
@@ -741,7 +745,7 @@ public function updateAllCounters(array $counters, array|string $condition = '',
741
745
}
742
746
743
747
$ command = $ this ->db ()->createCommand ();
744
- $ command ->update ($ this ->tableName (), $ counters , $ condition , $ params );
748
+ $ command ->update ($ this ->tableName (), $ counters , $ condition , $ from , $ params );
745
749
746
750
return $ command ->execute ();
747
751
}
0 commit comments