Обновляет указанный инфоблок.

@param array $data
@param array $fields

@return array

@throws \marvin255\bxmigrate\migrate\Exception
489148
protected function IblockUpdate(array $data, array $fields = null)
    {
        $return = [];

        if (!empty($data['ID'])) {
            $iblock = $this->iblockLocate($data['ID']);
            unset($data['ID']);
        } elseif (!empty($data['CODE'])) {
            $iblock = $this->iblockLocate($data['CODE']);
            unset($data['CODE']);
        } else {
            throw new Exception('You must set iblock CODE param or iblock ID param');
        }

        $ib = new CIBlock();
        $res = $ib->Update($iblock['ID'], $data);
        if ($res) {
            $return[] = "Iblock {$iblock['CODE']}({$iblock['ID']}) updated";
            if ($fields) {
                $return = array_merge(
                    $return,
                    $this->IblockSetFields($iblock['ID'], $fields)
                );
            }
        } else {
            throw new Exception("Can't update {$iblock['CODE']}({$iblock['ID']}) iblock: {$ib->LAST_ERROR}");
        }

        return $return;
    }
1187047
public function puts(array $fields, array $data)
    {
        $c = count($data);
        if ($c <= 0 or count($fields) <= 0)
        {
            return false;
        }

        return $this->db->insertBatch($fields, $data, $this->table);
    }
95653
private function assoc_array_to_rows( $fields ) {
		$rows = array();

		foreach ( $fields as $field => $value ) {

			if ( ! is_string( $value ) ) {
				$value = json_encode( $value );
			}

			$rows[] = (object) array(
				'Field' => $field,
				'Value' => $value,
			);
		}

		return $rows;
	}
701700
public function update(array $data, array $parameters = []) {
        if (!$this->canAlter()) {
            throw new Exception('Need index, type, and key to update a document');
        }
        if (!$this->esClient) {
            throw new Exception('Need ElasticSearch client object for ALTER operations');
        }
        $params = [
            'index' => $this->meta['index'],
            'type' => $this->meta['type'],
            'id' => $this->meta['id'],
            'body' => $data] + $parameters;
        return $this->esClient->update($params);
    }
113602
public function fields($fields) {
        if (!is_array($fields)) {
            $fields = func_get_args();
        }

        $this->_fields = $fields;

        return $this;
    }
493121
public function deleteFields(array $fields)
    {
        $fields = Validate::arrToLower($fields);
        if (($key = array_search($this->databaseConfig->getIdentifier(), $fields)) !== false)
            throw new \Exception('You can not delete the id field');
        $diff   = array_diff($fields,$this->fields());
        if (!empty($diff))
            throw new \Exception('Field(s) "' . implode(', ', $diff) . '" does not exists in table');
        $config         = $this->getConfig();
        $config->schema = array_diff_key($this->schema(), array_flip($fields));
        $data = $this->getData();
        foreach ($data as $key => $object)
        {
            foreach ($fields as $name)
                unset($data[$key]->{$name});
        }
        $this->databaseDocument->put($data);
        $this->databaseConfig->put($config);
        return true;
    }
912786
public function objToArray($object, $fields)
  {
      $data = array();
      foreach ($fields as $target => $key) {
          $default = null;
          if (is_array($key)) {
              $default = $key[1];
              $key = $key[0];

        // biblioteka rzuca exception tylko gdy nie znajduje wartości, jeśli natomiast naturalnie zwracany jest null to muszę go ręcznie sprawdzić
        try {
            $data[$target] = $this->dumpObject(AbstractEntity::getValueByMethodOrAttribute($object, $key));

//          if (is_null($data[$target]))
          if (!$data[$target]) {
              $data[$target] = $default;
          }
        } catch (AbstractEntityException $e) {
            $data[$target] = $default;
        } catch (DumperContinueException $e) {
            $data[$target] = $default;
        }
          } else {
              $data[$target] = $this->dumpObject(AbstractEntity::getValueByMethodOrAttribute($object, $key, $default), $throwException = false);
          }
      }

      return $data;
  }
445245
protected function build_input($data, array $fields = [] ){
        return parent::build_input($data, $fields).$this->length_helper($data);
    }
983191
public function update(array $fields = [])
    {
        $connection = $this->getConnection();

        $this->beforeUpdateInternal();

        $connection->beginTransaction();
        try {
            if ($updated = $this->updateInternal($fields)) {
                $connection->commit();
            } else {
                $connection->rollBack();
            }
        } catch (Exception $e) {
            $connection->rollBack();
            throw $e;
        }

        $this->afterUpdateInternal();

        if ($updated) {
            $this->updateRelated();
            $this->attributes->resetOldAttributes();
        }

        return $updated;
    }
1038054
protected function getTransfredFields(array $columns)
    {
        $collection = [];

        foreach ($columns as $column) {
            // While constructing the array for each field
            // there is no need to set translations for options
            // or even labels. This step is handled using the FieldTransformer
            $properties['name'] = $column->COLUMN_NAME;
            $properties['is-nullable'] = ($column->IS_NULLABLE == 'YES');
            $properties['data-value'] = $column->COLUMN_DEFAULT;
            $properties['data-type'] = $this->getDataType($column->DATA_TYPE, $column->COLUMN_TYPE);
            $properties['data-type-params'] = $this->getPrecision($column->CHARACTER_MAXIMUM_LENGTH, $column->DATA_TYPE, $column->COLUMN_TYPE);
            $properties['is-primary'] = in_array($column->COLUMN_KEY, ['PRIMARY KEY', 'PRI']);
            $properties['is-index'] = ($column->COLUMN_KEY == 'MUL');
            $properties['is-unique'] = ($column->COLUMN_KEY == 'UNI');
            $properties['is-auto-increment'] = ($column->EXTRA == 'AUTO_INCREMENT');
            $properties['comment'] = $column->COLUMN_COMMENT ?: null;
            $properties['options'] = $this->getHtmlOptions($column->DATA_TYPE, $column->COLUMN_TYPE);
            $properties['is-unsigned'] = (strpos($column->COLUMN_TYPE, 'unsigned') !== false);

            $constraint = $this->getForeignConstraint($column->COLUMN_NAME);

            $properties['foreign-constraint'] = !is_null($constraint) ? $constraint->toArray() : null;

            if (intval($column->CHARACTER_MAXIMUM_LENGTH) > 255
                || in_array($column->DATA_TYPE, $this->largeDataTypes)) {
                $properties['is-on-index'] = false;
            }

            $collection[] = $properties;
        }

        $localeGroup = Helpers::makeLocaleGroup($this->tableName);

        $fields = FieldTransformer::fromArray($collection, $localeGroup, $this->languages);

        // At this point we constructed the fields collection with the default html-type
        // We need to set the html-type using the config::getEloquentToHtmlMap() setting
        $this->setHtmlType($fields);

        return $fields;
    }
41708
public function fetchData(array $fields)
    {
        //set up the blank data
        $data = array();

        foreach ($fields as $name => $field) {
            $data[$name] = null;
        }

        //populate the data from the file
        $this->setDataModel($this->populateData($data));
    }
40085
public function update(array $data)
    {
        $project_id = (int) (empty($data['project_id']) ? 0: $data['project_id']);
        $person_id = (int) (empty($data['person_id']) ? 0: $data['person_id']);
        if ($project_id <= 0) {
            throw new Exception("Required field project_id");
        }
        if ($person_id <= 0) {
            throw new Exception("Required field person_id");
        }
        return $this->rest->put("projects/$project_id/people/$person_id", $data);
    }
664036
public function saveAgent($fields = array()) {
        $this->checkRequiredKeys(__METHOD__, $fields, array('MODULE_ID', 'NAME'));

        $exists = $this->getAgent(array(
            'MODULE_ID' => $fields['MODULE_ID'],
            'NAME' => $fields['NAME']
        ));

        $exportExists = $this->prepareExportAgent($exists);
        $fields = $this->prepareExportAgent($fields);

        if (empty($exists)) {
            $ok = $this->getMode('test') ? true : $this->addAgent($fields);
            $this->outNoticeIf($ok, 'Агент %s: добавлен', $fields['NAME']);
            return $ok;
        }

        if (strtotime($fields['NEXT_EXEC']) <= strtotime($exportExists['NEXT_EXEC'])) {
            unset($fields['NEXT_EXEC']);
            unset($exportExists['NEXT_EXEC']);
        }

        if ($this->hasDiff($exportExists, $fields)) {
            $ok = $this->getMode('test') ? true : $this->updateAgent($fields);
            $this->outNoticeIf($ok, 'Агент %s: обновлен', $fields['NAME']);
            $this->outDiffIf($ok, $exportExists, $fields);
            return $ok;
        }


        $ok = $this->getMode('test') ? true : $exists['ID'];
        if ($this->getMode('out_equal')) {
            $this->outIf($ok, 'Агент %s: совпадает', $fields['NAME']);
        }
        return $ok;
    }
731915
public function strict_assign( array $fields, array $data )
	{
		foreach( $fields as $field )
		{
			if ( isset( $data[$field] ) )
			{
				$this->__set( $field, $data[$field] );
			}
		}
	}
840312
protected function getSortingFieldValue($data, $fields)
	{
		if(is_object($data))
		{
			foreach($fields as $field)
				$data=isset($data->$field) ? $data->$field : null;
		}
		else
		{
			foreach($fields as $field)
				$data=isset($data[$field]) ? $data[$field] : null;
		}
		return $this->caseSensitiveSort ? $data : mb_strtolower($data,Yii::app()->charset);
	}
1307662
protected function UFUpdate(array $data)
    {
        $return = [];
        global $USER_FIELD_MANAGER;
        if (empty($data['FIELD_NAME'])) {
            throw new Exception('You must set group FIELD_NAME');
        }
        if (empty($data['ENTITY_ID'])) {
            throw new Exception('You must set group ENTITY_ID');
        }
        if ($id = $this->UFGetIdByCode($data['ENTITY_ID'], $data['FIELD_NAME'])) {
            $ib = new CUserTypeEntity();
            $id = $ib->Update($id, $data);
            if ($id) {
                $return[] = "Update {$data['FIELD_NAME']} user field";
                if (
                    !empty($data['LIST'])
                    && ($arType = $USER_FIELD_MANAGER->GetUserType($data['USER_TYPE_ID']))
                    && $arType['BASE_TYPE'] == 'enum'
                ) {
                    $obEnum = new CUserFieldEnum();
                    $res = $obEnum->SetEnumValues($id, $data['LIST']);
                    $return[] = "Update {$data['FIELD_NAME']} user field list";
                }
            } else {
                throw new Exception("Can't update {$data['FIELD_NAME']} user field");
            }
        } else {
            throw new Exception("Can't find {$data['FIELD_NAME']} user field");
        }

        return $return;
    }
177535
final public function toArrayFor($fields){
		$array = array();
		$all = $this->toArray();
		foreach($fields as $field){
			if( array_key_exists($field, $all) ){
				$array[$field] = $all[$field];
			}
		}
		return $array;
	}