public function updateBatch($table, $data, $conditions = [])
    {
        $query = $this->db->getQuery(true);

        // Build conditions
        $query = QueryHelper::buildWheres($query, $conditions);

        // Build update values.
        $fields = $this->db->getTable($table)->getColumns();

        $hasField = false;

        foreach ((array) $data as $field => $value) {
            if (!in_array($field, $fields)) {
                continue;
            }

            $query->set(QueryHelper::buildValueAssign($field, $value, $query));

            $hasField = true;
        }

        if (!$hasField) {
            return false;
        }

        $query->update($query->quoteName($table));

        $this->execute($query);

        return true;
    }
public function updateBatch($table, $data, $conditions = [])
    {
        $query = $this->db->getQuery(true);

        // Build conditions
        $query = QueryHelper::buildWheres($query, $conditions);

        // Build update values.
        $fields = $this->db->getTable($table)->getColumns();

        $hasField = false;

        foreach ((array) $data as $field => $value) {
            if (!in_array($field, $fields)) {
                continue;
            }

            $query->set(QueryHelper::buildValueAssign($field, $value, $query));

            $hasField = true;
        }

        if (!$hasField) {
            return false;
        }

        $query->update($query->quoteName($table));

        $this->execute($query);

        return true;
    }
public function updateBatch ( $ table , $ data , $ conditions = [ ] ) { $ query = $ this -> db -> getQuery ( true ) ; // Build conditions $ query = QueryHelper :: buildWheres ( $ query , $ conditions ) ; // Build update values. $ fields = $ this -> db -> getTable ( $ table ) -> getColumns ( ) ; $ hasField = false ; foreach ( ( array ) $ data as $ field => $ value ) { if ( ! in_array ( $ field , $ fields ) ) { continue ; } $ query -> set ( QueryHelper :: buildValueAssign ( $ field , $ value , $ query ) ) ; $ hasField = true ; } if ( ! $ hasField ) { return false ; } $ query -> update ( $ query -> quoteName ( $ table ) ) ; $ this -> execute ( $ query ) ; return true ; }
Batch update some data.

@param string $table      Table name.
@param array  $data       Data you want to update.
@param mixed  $conditions Where conditions, you can use array or Compare object.
Example:
- `array('id' => 5)` => id = 5
- `new GteCompare('id', 20)` => 'id >= 20'
- `new Compare('id', '%Flower%', 'LIKE')` => 'id LIKE "%Flower%"'

@return  boolean True if update success.
Batch update some data .