Ladsgroup has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/332961 )

Change subject: Very basic ChangeOpDeserializer
......................................................................

Very basic ChangeOpDeserializer

Bug: T155700
Change-Id: I2f974247597a009c04aa7a5e373cd1b0e6b709f9
---
M WikibaseLexeme.entitytypes.php
A src/ChangeOp/LexemeChangeOpDeserializer.php
2 files changed, 49 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseLexeme 
refs/changes/61/332961/1

diff --git a/WikibaseLexeme.entitytypes.php b/WikibaseLexeme.entitytypes.php
index 4570c04..e4569d4 100644
--- a/WikibaseLexeme.entitytypes.php
+++ b/WikibaseLexeme.entitytypes.php
@@ -20,6 +20,7 @@
 use Wikibase\DataModel\Services\Lookup\LabelDescriptionLookup;
 use Wikibase\Lib\LanguageNameLookup;
 use Wikibase\LanguageFallbackChain;
+use Wikibase\Lexeme\ChangeOp\LexemeChangeOpDeserializer;
 use Wikibase\Lexeme\Content\LexemeContent;
 use Wikibase\Lexeme\Content\LexemeHandler;
 use Wikibase\Lexeme\DataModel\Lexeme;
@@ -114,5 +115,13 @@
                // Identifier of a resource loader module that, when 
`require`d, returns a function
                // returning a deserializer
                'js-deserializer-factory-function' => 
'wikibase.lexeme.getDeserializer',
+               'changeop-deserializer-callback' => function () {
+                       $wikibaseRepo = WikibaseRepo::getDefaultInstance();
+
+                       return new LexemeChangeOpDeserializer(
+                               $wikibaseRepo->getStringNormalizer(),
+                               
$wikibaseRepo->getChangeOpFactoryProvider()->getFingerprintChangeOpFactory()
+                       );
+               }
        ]
 ];
diff --git a/src/ChangeOp/LexemeChangeOpDeserializer.php 
b/src/ChangeOp/LexemeChangeOpDeserializer.php
new file mode 100644
index 0000000..fa36d16
--- /dev/null
+++ b/src/ChangeOp/LexemeChangeOpDeserializer.php
@@ -0,0 +1,40 @@
+<?php
+namespace Wikibase\Lexeme\ChangeOp;
+
+use Wikibase\ChangeOp\ChangeOps;
+use Wikibase\ChangeOp\FingerprintChangeOpFactory;
+use Wikibase\Repo\ChangeOp\ChangeOpDeserializer;
+use Wikibase\StringNormalizer;
+
+/**
+ * Class for creating ChangeOps for EditEntity API
+ *
+ * @license GPL-2.0+
+ * @author Amir Sarabadani <ladsgr...@gmail.com>
+ */
+class LexemeChangeOpDeserializer implements ChangeOpDeserializer {
+
+       /**
+        * @var StringNormalizer
+        */
+       protected $stringNormalizer;
+
+       /**
+        * @var FingerprintChangeOpFactory
+        */
+       private $termChangeOpFactory;
+
+       public function __construct(
+               StringNormalizer $stringNormalizer,
+               FingerprintChangeOpFactory $termChangeOpFactory
+       ) {
+               $this->stringNormalizer = $stringNormalizer;
+               $this->termChangeOpFactory = $termChangeOpFactory;
+       }
+
+       public function createEntityChangeOp( array $changeRequest ) {
+               // Do nothing
+               return new ChangeOps();
+       }
+
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/332961
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2f974247597a009c04aa7a5e373cd1b0e6b709f9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseLexeme
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup <ladsgr...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to