@@ -701,6 +701,24 @@ public function updateMultiple(
701701 return $ results ;
702702 }
703703
704+ /**
705+ * @param mixed $source The data we want to update to every rows.
706+ * @param Conditions $conditions Where conditions, you can use array or Compare object.
707+ * @param ORMOptions|int $options The options.
708+ *
709+ * @return StatementInterface
710+ * @throws \ReflectionException
711+ *
712+ * @deprecated Use updateBulk() instead
713+ */
714+ public function updateWhere (
715+ array |object $ source ,
716+ mixed $ conditions = null ,
717+ ORMOptions |int $ options = new ORMOptions ()
718+ ): StatementInterface {
719+ return $ this ->updateBulk ($ source , $ conditions , $ options );
720+ }
721+
704722 /**
705723 * Using one data to update multiple rows, filter by where conditions.
706724 * Example:
@@ -714,7 +732,7 @@ public function updateMultiple(
714732 * @return StatementInterface
715733 * @throws \ReflectionException
716734 */
717- public function updateWhere (
735+ public function updateBulk (
718736 array |object $ source ,
719737 mixed $ conditions = null ,
720738 ORMOptions |int $ options = new ORMOptions ()
@@ -994,14 +1012,47 @@ protected function prepareCreateInitData(mixed $initData, array $item, mixed $co
9941012 return $ item ;
9951013 }
9961014
1015+ public function deleteBulk (mixed $ conditions , ORMOptions $ options = new ORMOptions ()): StatementInterface
1016+ {
1017+ if (is_object ($ conditions ) && EntityMetadata::isEntity ($ conditions )) {
1018+ $ conditions = Arr::only ($ this ->extract ($ conditions ), $ this ->getKeys ());
1019+ }
1020+
1021+ $ conditions = $ this ->conditionsToWheres ($ conditions );
1022+
1023+ // Event
1024+
1025+ $ statement = $ this ->delete ()
1026+ ->where ($ conditions )
1027+ ->execute ();
1028+
1029+ // Event
1030+
1031+ return $ statement ;
1032+ }
1033+
9971034 /**
9981035 * @param Conditions $conditions
9991036 * @param ORMOptions|int $options
10001037 *
10011038 * @return void
10021039 * @throws \ReflectionException
1040+ *
1041+ * @deprecated Use deleteBatch() instead.
10031042 */
10041043 public function deleteWhere (mixed $ conditions , ORMOptions |int $ options = new ORMOptions ()): void
1044+ {
1045+ $ this ->deleteBatch ($ conditions , $ options );
1046+ }
1047+
1048+ /**
1049+ * @param Conditions $conditions
1050+ * @param ORMOptions|int $options
1051+ *
1052+ * @return void
1053+ * @throws \ReflectionException
1054+ */
1055+ public function deleteBatch (mixed $ conditions , ORMOptions |int $ options = new ORMOptions ()): void
10051056 {
10061057 $ options = clone ORMOptions::wrap ($ options );
10071058
0 commit comments