Bene has uploaded a new change for review.
https://gerrit.wikimedia.org/r/269133
Change subject: Use EntityDocument in remaining places
......................................................................
Use EntityDocument in remaining places
(besides tests)
Note: EntityFactory can return EntityDocument, all users of it can deal
with it.
Change-Id: I210e0a7bb3789f3ec19db6c9ae01a4a19e42e1bb
---
M lib/includes/EntityFactory.php
M repo/includes/Interactors/ItemMergeInteractor.php
M repo/includes/ParserOutput/ParserOutputJsConfigBuilder.php
3 files changed, 12 insertions(+), 13 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/33/269133/1
diff --git a/lib/includes/EntityFactory.php b/lib/includes/EntityFactory.php
index dcc6ae8..bba224c 100644
--- a/lib/includes/EntityFactory.php
+++ b/lib/includes/EntityFactory.php
@@ -4,7 +4,7 @@
use OutOfBoundsException;
use RuntimeException;
-use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Entity\EntityDocument;
/**
* Factory for Entity objects.
@@ -83,7 +83,7 @@
* @param String $entityType The type of the desired new entity.
*
* @throws RuntimeException
- * @return Entity The new Entity object.
+ * @return EntityDocument The new Entity object.
*/
public function newEmpty( $entityType ) {
$class = $this->getEntityClass( $entityType );
diff --git a/repo/includes/Interactors/ItemMergeInteractor.php
b/repo/includes/Interactors/ItemMergeInteractor.php
index 4267a4b..4674656 100644
--- a/repo/includes/Interactors/ItemMergeInteractor.php
+++ b/repo/includes/Interactors/ItemMergeInteractor.php
@@ -7,7 +7,6 @@
use Wikibase\ChangeOp\ChangeOpException;
use Wikibase\ChangeOp\ChangeOpsMerge;
use Wikibase\ChangeOp\MergeChangeOpsFactory;
-use Wikibase\DataModel\Entity\Entity;
use Wikibase\DataModel\Entity\EntityDocument;
use Wikibase\DataModel\Entity\EntityId;
use Wikibase\DataModel\Entity\Item;
@@ -16,8 +15,8 @@
use Wikibase\Lib\Store\EntityRevisionLookup;
use Wikibase\Lib\Store\EntityStore;
use Wikibase\Lib\Store\EntityTitleLookup;
-use Wikibase\Lib\Store\StorageException;
use Wikibase\Lib\Store\RevisionedUnresolvedRedirectException;
+use Wikibase\Lib\Store\StorageException;
use Wikibase\Repo\Store\EntityPermissionChecker;
use Wikibase\Summary;
use Wikibase\SummaryFormatter;
@@ -286,15 +285,15 @@
*/
private function attemptSaveMerge( Item $fromItem, Item $toItem,
$summary, $bot ) {
$toSummary = $this->getSummary( 'to', $toItem->getId(),
$summary );
- $fromRev = $this->saveEntity( $fromItem, $toSummary, $bot );
+ $fromRev = $this->saveItem( $fromItem, $toSummary, $bot );
$fromSummary = $this->getSummary( 'from', $fromItem->getId(),
$summary );
- $toRev = $this->saveEntity( $toItem, $fromSummary, $bot );
+ $toRev = $this->saveItem( $toItem, $fromSummary, $bot );
return array( $fromRev, $toRev );
}
- private function saveEntity( Entity $entity, Summary $summary, $bot ) {
+ private function saveItem( Item $item, Summary $summary, $bot ) {
// Given we already check all constraints in ChangeOpsMerge,
it's
// fine to ignore them here. This is also needed to not run into
// the constraints we're supposed to ignore (see
ChangeOpsMerge::removeConflictsWithEntity
@@ -306,7 +305,7 @@
try {
return $this->entityStore->saveEntity(
- $entity,
+ $item,
$this->summaryFormatter->formatSummary(
$summary ),
$this->user,
$flags
diff --git a/repo/includes/ParserOutput/ParserOutputJsConfigBuilder.php
b/repo/includes/ParserOutput/ParserOutputJsConfigBuilder.php
index 5a74391..2806844 100644
--- a/repo/includes/ParserOutput/ParserOutputJsConfigBuilder.php
+++ b/repo/includes/ParserOutput/ParserOutputJsConfigBuilder.php
@@ -4,7 +4,7 @@
use DataValues\Serializers\DataValueSerializer;
use FormatJson;
-use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Entity\EntityDocument;
use Wikibase\DataModel\SerializerFactory;
/**
@@ -34,11 +34,11 @@
}
/**
- * @param Entity $entity
+ * @param EntityDocument $entity
*
* @return array
*/
- public function build( Entity $entity ) {
+ public function build( EntityDocument $entity ) {
$entityId = $entity->getId();
if ( !$entityId ) {
@@ -56,11 +56,11 @@
}
/**
- * @param Entity $entity
+ * @param EntityDocument $entity
*
* @return string
*/
- private function getSerializedEntity( Entity $entity ) {
+ private function getSerializedEntity( EntityDocument $entity ) {
$serializer = $this->serializerFactory->newEntitySerializer();
$serialization = $serializer->serialize( $entity );
--
To view, visit https://gerrit.wikimedia.org/r/269133
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I210e0a7bb3789f3ec19db6c9ae01a4a19e42e1bb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Bene <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits