/** * @see ApiBase::execute * * @since 0.3 */ public function execute() { $params = $this->extractRequestParams(); $entityId = $this->getEntityId($params); if (isset($params['baserevid'])) { $entityRevision = $this->entityLoadingHelper->loadEntityRevision($entityId, (int) $params['baserevid']); } else { $entityRevision = $this->entityLoadingHelper->loadEntityRevision($entityId); } $entity = $entityRevision->getEntity(); if ($entity instanceof StatementListProvider) { $this->assertStatementListContainsGuids($entity->getStatements(), $params['claim']); } $summary = $this->modificationHelper->createSummary($params, $this); $changeOps = new ChangeOps(); $changeOps->add($this->getChangeOps($params)); try { $changeOps->apply($entity, $summary); } catch (ChangeOpException $e) { $this->errorReporter->dieException($e, 'failed-save'); } $status = $this->entitySavingHelper->attemptSaveEntity($entity, $summary, EDIT_UPDATE); $this->resultBuilder->addRevisionIdFromStatusToResult($status, 'pageinfo'); $this->resultBuilder->markSuccess(); $this->resultBuilder->setList(null, 'claims', $params['claim'], 'claim'); }