public function update(array $setValues)
    {
        $modelClass = $this->_className;

        // cloning fetch query to get where,order by and limit values
        $updateQuery = clone($this->_queryHelper);

        // transform query to update
        $updateQuery->cleanQueryBeforeSwitching()
                    ->update($modelClass::formatTableNameMySQL());

        // build set values
        $params = array();
        foreach ($setValues as $fieldName => $value) {
            $updateQuery->set($fieldName, '?');
            $params[] = $value;
        }

        // merge set values with where values
        $params = array_merge($params, $updateQuery->getWhereParamsValues());

        // execute query
        $query = $this->_dataSource->prepare($updateQuery->buildQuery());
        $query->execute($params);

        // check for mysql error
        $errorcode = $query->errorInfo();
        if ($errorcode[0] != "00000") {
            throw new Exception($errorcode[2]);
        }
    }
public function update(array $setValues)
    {
        $modelClass = $this->_className;

        // cloning fetch query to get where,order by and limit values
        $updateQuery = clone($this->_queryHelper);

        // transform query to update
        $updateQuery->cleanQueryBeforeSwitching()
                    ->update($modelClass::formatTableNameMySQL());

        // build set values
        $params = array();
        foreach ($setValues as $fieldName => $value) {
            $updateQuery->set($fieldName, '?');
            $params[] = $value;
        }

        // merge set values with where values
        $params = array_merge($params, $updateQuery->getWhereParamsValues());

        // execute query
        $query = $this->_dataSource->prepare($updateQuery->buildQuery());
        $query->execute($params);

        // check for mysql error
        $errorcode = $query->errorInfo();
        if ($errorcode[0] != "00000") {
            throw new Exception($errorcode[2]);
        }
    }
public function update ( array $ setValues ) { $ modelClass = $ this -> _className ; // cloning fetch query to get where,order by and limit values $ updateQuery = clone ( $ this -> _queryHelper ) ; // transform query to update $ updateQuery -> cleanQueryBeforeSwitching ( ) -> update ( $ modelClass :: formatTableNameMySQL ( ) ) ; // build set values $ params = array ( ) ; foreach ( $ setValues as $ fieldName => $ value ) { $ updateQuery -> set ( $ fieldName , '?' ) ; $ params [ ] = $ value ; } // merge set values with where values $ params = array_merge ( $ params , $ updateQuery -> getWhereParamsValues ( ) ) ; // execute query $ query = $ this -> _dataSource -> prepare ( $ updateQuery -> buildQuery ( ) ) ; $ query -> execute ( $ params ) ; // check for mysql error $ errorcode = $ query -> errorInfo ( ) ; if ( $ errorcode [ 0 ] != "00000" ) { throw new Exception ( $ errorcode [ 2 ] ) ; } }
Update models in collection with specified values

@param array $setValues - Associative array with model field name as key, and model field value as value

@throws Exception

@return void
Update models in collection with specified values