Skip to content

Commit bd024e7

Browse files
committed
BatchUpdate withAll parameter
1 parent c6adf2b commit bd024e7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Model.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ public function setAlias($alias)
342342
/**
343343
* Create an existent CI Query Builder instance with Model features for query purpose.
344344
*
345-
* @param bookl $withAll withAll() switch helper
345+
* @param boolean $withAll withAll() switch helper
346346
* @return object CI_DB_query_builder
347347
* @example
348348
* $posts = $this->PostModel->find()
@@ -573,6 +573,7 @@ public function update($attributes, $condition=NULL)
573573
* Update a batch of update queries into combined query strings.
574574
*
575575
* @param array $dataSet [[[Attributes], [Condition]], ]
576+
* @param boolean $withAll withAll() switch helper
576577
* @param integer $maxLenth MySQL max_allowed_packet
577578
* @return integer Count of sucessful query pack(s)
578579
* @example
@@ -581,7 +582,7 @@ public function update($attributes, $condition=NULL)
581582
* [['title'=>'A2', 'modified'=>'1'], ['id'=>2]],
582583
* ];);
583584
*/
584-
public function batchUpdate(Array $dataSet, $maxLength=4*1024*1024)
585+
public function batchUpdate(Array $dataSet, $withAll=false, $maxLength=4*1024*1024)
585586
{
586587
$count = 0;
587588
$sqlBatch = '';
@@ -591,6 +592,10 @@ public function batchUpdate(Array $dataSet, $maxLength=4*1024*1024)
591592
// Data format
592593
list($attributes, $condition) = $each;
593594

595+
// WithAll helper
596+
if ($withAll===true) {
597+
$this->withAll();
598+
}
594599
// Model Condition
595600
$query = $this->_findByCondition($condition);
596601

0 commit comments

Comments
 (0)