Update a model document.

@throws \Exception

@return mixed
495123
public function update()
    {
        $this->exitIfModelNotSet();

        if (!$this->model->exists) {
            throw new \Exception('Model not persisted yet');
        }

        $document = $this->model->getDocumentData();

        $params = [
            'id'    => $this->model->getKey(),
            'type'  => $this->model->getDocumentType(),
            'index' => $this->model->getDocumentIndex(),
            'body'  => [
                'doc' => $document,
            ],
        ];

        return $this->connection->updateStatement($params);
    }
1043301
public function update(Model $model)
    {
        $data['models'] = [];
        $data['models'][] = $this->createModelData($model);
        $data['action'] = 'merge';

        $modelResult = $this->getRequest()->request(
            'PATCH',
            $this->getRequestUrl('models'),
            $data
        );

        return $this->getModelsFromResult($modelResult);
    }
194965
public function update($attributes)
    {
        try {
            self::init();
            foreach ($attributes as $column => $value) {
                $columns[] = $column. ' = :'.$column;
            }
            $sql = 'UPDATE ' . self::$modelTable . ' SET ' . implode(', ', $columns) . ' WHERE id = ' . $this->id;
            $stm = self::$connect->prepare($sql);
            $stm->execute($attributes);
            $this->setAttributes($attributes);
            return $this;
        } catch (\Exception $exception) {
            var_dump($exception->getMessage());
        }
    }
914833
public function update()
    {
        $snapshot = $this->_snapshot;
        if ($snapshot === false) {
            throw new PreconditionException(['update failed: `:model` instance is snapshot disabled', 'model' => static::class]);
        }

        $primaryKeyValuePairs = $this->_getPrimaryKeyValuePairs();

        $fields = $this->getFields();

        $changedFields = [];
        foreach ($fields as $field) {
            if ($this->$field === null) {
                /** @noinspection NotOptimalIfConditionsInspection */
                if (isset($snapshot[$field])) {
                    $changedFields[] = $field;
                }
            } elseif (!isset($snapshot[$field])) {
                $changedFields[] = $field;
            } elseif ($snapshot[$field] !== $this->$field) {
                if (is_string($this->$field) && !is_string($snapshot[$field]) && (string)$snapshot[$field] === $this->$field) {
                    $this->$field = $snapshot[$field];
                } else {
                    $changedFields[] = $field;
                }
            }
        }

        if (!$changedFields) {
            return $this;
        }

        $this->validate($changedFields);

        foreach ($this->getAutoFilledData(self::OP_UPDATE) as $field => $value) {
            if (in_array($field, $fields, true)) {
                $this->$field = $value;
            }
        }

        $this->eventsManager->fireEvent('model:beforeSave', $this);
        $this->eventsManager->fireEvent('model:beforeUpdate', $this);

        $fieldValues = [];
        foreach ($fields as $field) {
            if ($this->$field === null) {
                if (isset($snapshot[$field])) {
                    $fieldValues[$field] = null;
                }
            } elseif (!isset($snapshot[$field]) || $snapshot[$field] !== $this->$field) {
                $fieldValues[$field] = $this->$field;
            }
        }

        foreach ($primaryKeyValuePairs as $key => $value) {
            unset($fieldValues[$key]);
        }

        if (!$fieldValues) {
            return $this;
        }

        foreach ($this->getJsonFields() as $field) {
            if (isset($fieldValues[$field]) && is_array($fieldValues[$field])) {
                $fieldValues[$field] = json_encode($fieldValues[$field], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
            }
        }

        $query = static::query(null, $this)->where($primaryKeyValuePairs);
        $query->update($fieldValues);

        $expressionFields = [];
        foreach ($fieldValues as $field => $value) {
            if ($value instanceof ExpressionInterface) {
                $expressionFields[] = $field;
            }
        }

        if ($expressionFields && $rs = $query->select($expressionFields)->fetch(true)) {
            foreach ((array)$rs[0] as $field => $value) {
                $this->$field = $value;
            }
        }

        $this->_snapshot = $this->toArray();

        $this->eventsManager->fireEvent('model:afterUpdate', $this);
        $this->eventsManager->fireEvent('model:afterSave', $this);

        return $this;
    }
89526
public function update()
    {
        // convert to condition.
        $args = func_get_args();
        $attributes = array_shift($args);
        $cond = call_user_func_array(array($this, 'toCondition'), $args);

        // to SQL.
        $sql = $cond->toUpdateSQL($attributes);
        var_dump($sql, $cond->getParams());

        // query.
        $sth = $this->query($sql, $cond->getParams());
        return $sth->isSuccess();
    }
687225
public function updatedAtToday()
    {
        /* @var $this ActiveQuery */
        $model = $this->noInitModel;
        $start = strtotime(date('Y-m-d'));
        $end = $start + 86400;
        if ($model->timeFormat == BaseEntityModel::$timeFormatDatetime) {
            $start = gmdate('Y-m-d H:i:s', $start);
            $end = gmdate('Y-m-d H:i:s', $end);
        }
        return $this->updatedAt($start, $end);
    }
1073884
public function updateAction() {
        try {
            if(sizeOf($this->dispatcher->getParams()) == 0) {
                throw new Exception('Invalid Entity Id Passed In', 400);
            }
            $entity = $this->validateEntityId($this->dispatcher->getParam(0));
            $isChanged = $this->updateActionInternal($entity);
            if($isChanged) {
                $this->showActionInternal($entity->findFirst($entity->getId()));
            }
        } catch(Exception $e) {
            $this->handleError($e);
        } catch(ValidationException $e) {
            $this->handleValidationError($e);
        } catch(AclException $e) {
            $this->handleAclError($e);
        } catch(CatchableException $e) {
            $this->handleCatchableError($e);
        }
    }
383292
public function postUpdate()
    {
        /** @var ObjectManager $om */
        $om = $this->container->get('claroline.persistence.object_manager');

        /** @var MaskManager $maskManager */
        $maskManager = $this->container->get('claroline.manager.mask_manager');

        /** @var ResourceType $pathType */
        $quizType = $om
            ->getRepository('Claroline\CoreBundle\Entity\Resource\ResourceType')
            ->findOneBy(['name' => 'ujm_exercise']);

        $this->log('Renaming mask decoder `VIEW_DOCIMOLOGY` to `view_docimology`...');
        $maskManager->renameMask($quizType, 'VIEW_DOCIMOLOGY', 'view_docimology');

        $this->log('Renaming mask decoder `MANAGE_PAPERS` to `manage_papers`...');
        $maskManager->renameMask($quizType, 'MANAGE_PAPERS', 'manage_papers');

        $om->flush();

        $this->log('Set exo numbering...');

        $sql = "UPDATE ujm_exercise SET numbering = 'none' WHERE numbering ='' OR numbering = NULL";
        $sth = $this->container->get('doctrine.dbal.default_connection')->prepare($sql);
        $sth->execute();

        $this->log('Clean old schema table...');
        $drop = 'DROP TABLE IF EXISTS ujm_link_hint_paper;';
        $dropSth = $this->container->get('doctrine.dbal.default_connection')->prepare($drop);
        $dropSth->execute();
    }
69917
public function update($id)
    {
        $uf = new \CUserTypeEntity();
        $result = $uf->Update($id, $this->fields);

        if (!$result) {
            global $APPLICATION;
            throw new \Exception($APPLICATION->GetException());
        }

        Logger::log("Обновлен UF {$id}", Logger::COLOR_GREEN);
    }
1328303
public final static function updateSchemaModel()
    {
        $model = new static();

        if (MbMigration::schema()->hasTable($model->getTable())) {
            MbMigration::schema()->table($model->getTable(), function (Blueprint $table) use ($model) {
                $table->engine = 'InnoDB';
                $model->updateSchema($table);
            });
        } else {
            throw new \Exception("Schema {$model->getTable()} was not found");
        }
    }
1313493
public function updatedBy()
    {
        $relation = $this->belongsTo(
            AccountableServiceProvider::userModel(),
            config('accountable.column_names.updated_by')
        );

        return $this->userModelUsesSoftDeletes() ? $relation->withTrashed() : $relation;
    }
240043
protected function updateFile($filename)
    {
        $current = Context::getParam('current-version');
        $next = Context::getParam('new-version');

        $content = file_get_contents($filename);
        if (false === strpos($content, $current)) {
            throw new Exception('The version class ' . $filename . " does not contain the current version $current");
        }
        if (isset($this->options['pattern'])) {
            $current = str_replace('%version%', $current, $this->options['pattern']);
            $next = str_replace('%version%', $next, $this->options['pattern']);
        }
        $content = str_replace($current, $next, $content);
        if (false === strpos($content, $next)) {
            throw new Exception('The version class ' . $filename . " could not be updated with version $next");
        }
        file_put_contents($filename, $content);
    }
167222
public function update()
    {
        try {
            Option::set(self::LAST_RUN_TIME_OPTION_NAME, Date::factory('today')->getTimestamp());

            $locUrl = Option::get(self::LOC_URL_OPTION_NAME);
            if (!empty($locUrl)) {
                $this->downloadFile('loc', $locUrl);
            }

            $ispUrl = Option::get(self::ISP_URL_OPTION_NAME);
            if (!empty($ispUrl)) {
                $this->downloadFile('isp', $ispUrl);
            }

            $orgUrl = Option::get(self::ORG_URL_OPTION_NAME);
            if (!empty($orgUrl)) {
                $this->downloadFile('org', $orgUrl);
            }
        } catch (Exception $ex) {
            // message will already be prefixed w/ 'GeoIPAutoUpdater: '
            StaticContainer::get(LoggerInterface::class)->error('Auto-update failed: {exception}', [
                'exception' => $ex,
                'ignoreInScreenWriter' => true,
            ]);
            $this->performRedundantDbChecks();
            throw $ex;
        }

        $this->performRedundantDbChecks();
    }
364394
public function updateDocument(\Document $document)
  {
    $arrSet = $this->buildDocumentDataArray($document, false);
    
    $this->Database->prepare("UPDATE tl_dms_documents %s WHERE id=?")->set($arrSet)->execute($document->id);
    
    return $document;
  }
139488
public function update($object)
    {
        try {
            $this->dm->persist($object);
            $this->dm->flush();
        } catch (\Exception $e) {
            throw new ModelManagerException('', 0, $e);
        }
    }
24947
public function actionUpdate()
    {
        $result = ['error' => Yii::t('podium/view', 'Error')];

        if (Yii::$app->request->isPost) {
            $result = (new Update())->nextStep();
        }
        return Json::encode($result);
    }
1005402
public function actionUpdate()
    {
        $model = $this->findModel();

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            \Yii::$app->getSession()->setFlash('success', $this->getFlashMsg('success'));
            return $this->redirect(ArrayHelper::merge(['view'], $model->getPrimaryKey(true)));
        } else {
            if ($model->hasErrors()) {
                \Yii::$app->getSession()->setFlash('error', $this->getFlashMsg('error'));
            }
            return $this->render($this->viewID, [
                'model' => $model,
            ]);
        }
    }