Thiemo Mättig (WMDE) has submitted this change and it was merged.
Change subject: Have EntityHolder use EntityDocument
......................................................................
Have EntityHolder use EntityDocument
Recheck.
Change-Id: I856bc382a5e5b86c641f098a0836e5d7ce7be338
---
M repo/includes/content/DeferredCopyEntityHolder.php
M repo/includes/content/DeferredDecodingEntityHolder.php
M repo/includes/content/EntityHolder.php
M repo/includes/content/EntityInstanceHolder.php
4 files changed, 18 insertions(+), 18 deletions(-)
Approvals:
Thiemo Mättig (WMDE): Looks good to me, approved
jenkins-bot: Verified
diff --git a/repo/includes/content/DeferredCopyEntityHolder.php
b/repo/includes/content/DeferredCopyEntityHolder.php
index b1fca44..7525b88 100644
--- a/repo/includes/content/DeferredCopyEntityHolder.php
+++ b/repo/includes/content/DeferredCopyEntityHolder.php
@@ -3,7 +3,7 @@
namespace Wikibase\Content;
use RuntimeException;
-use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Entity\EntityDocument;
use Wikibase\DataModel\Entity\EntityId;
/**
@@ -20,7 +20,7 @@
private $entityHolder;
/**
- * @var Entity|null
+ * @var EntityDocument|null
*/
private $entity = null;
@@ -43,12 +43,12 @@
* Defaults to Entity.
*
* @throws RuntimeException If the entity held by this EntityHolder is
not compatible with $expectedClass.
- * @return Entity
+ * @return EntityDocument
*/
- public function getEntity( $expectedClass =
'Wikibase\DataModel\Entity\Entity' ) {
+ public function getEntity( $expectedClass =
'Wikibase\DataModel\Entity\EntityDocument' ) {
if ( !$this->entity ) {
$entity = $this->entityHolder->getEntity(
$expectedClass );
- $this->entity = $entity->copy();
+ $this->entity = unserialize( serialize( $entity ) );
}
return $this->entity;
diff --git a/repo/includes/content/DeferredDecodingEntityHolder.php
b/repo/includes/content/DeferredDecodingEntityHolder.php
index 46562b9..9529784 100644
--- a/repo/includes/content/DeferredDecodingEntityHolder.php
+++ b/repo/includes/content/DeferredDecodingEntityHolder.php
@@ -4,7 +4,7 @@
use InvalidArgumentException;
use RuntimeException;
-use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Entity\EntityDocument;
use Wikibase\DataModel\Entity\EntityId;
use Wikibase\Lib\Store\EntityContentDataCodec;
@@ -17,7 +17,7 @@
class DeferredDecodingEntityHolder implements EntityHolder {
/**
- * @var Entity|null
+ * @var EntityDocument|null
*/
private $entity = null;
@@ -87,9 +87,9 @@
* Defaults to Entity.
*
* @throws RuntimeException If the entity held by this EntityHolder is
not compatible with $expectedClass.
- * @return Entity
+ * @return EntityDocument
*/
- public function getEntity( $expectedClass =
'Wikibase\DataModel\Entity\Entity' ) {
+ public function getEntity( $expectedClass =
'Wikibase\DataModel\Entity\EntityDocument' ) {
if ( !$this->entity ) {
$this->entity = $this->codec->decodeEntity(
$this->blob, $this->format );
diff --git a/repo/includes/content/EntityHolder.php
b/repo/includes/content/EntityHolder.php
index c595023..12ddd4c 100644
--- a/repo/includes/content/EntityHolder.php
+++ b/repo/includes/content/EntityHolder.php
@@ -3,7 +3,7 @@
namespace Wikibase\Content;
use RuntimeException;
-use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Entity\EntityDocument;
use Wikibase\DataModel\Entity\EntityId;
/**
@@ -22,9 +22,9 @@
* Defaults to Entity.
*
* @throws RuntimeException If the entity held by this EntityHolder is
not compatible with $expectedClass.
- * @return Entity
+ * @return EntityDocument
*/
- public function getEntity( $expectedClass =
'Wikibase\DataModel\Entity\Entity' );
+ public function getEntity( $expectedClass =
'Wikibase\DataModel\Entity\EntityDocument' );
/**
* Returns the ID of the entity held by this EntityHolder.
diff --git a/repo/includes/content/EntityInstanceHolder.php
b/repo/includes/content/EntityInstanceHolder.php
index 7f8402d..ac527b8 100644
--- a/repo/includes/content/EntityInstanceHolder.php
+++ b/repo/includes/content/EntityInstanceHolder.php
@@ -3,7 +3,7 @@
namespace Wikibase\Content;
use RuntimeException;
-use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Entity\EntityDocument;
use Wikibase\DataModel\Entity\EntityId;
/**
@@ -15,14 +15,14 @@
class EntityInstanceHolder implements EntityHolder {
/**
- * @var Entity
+ * @var EntityDocument
*/
private $entity;
/**
- * @param Entity $entity
+ * @param EntityDocument $entity
*/
- public function __construct( Entity $entity ) {
+ public function __construct( EntityDocument $entity ) {
$this->entity = $entity;
}
@@ -33,9 +33,9 @@
* Defaults to Entity.
*
* @throws RuntimeException If the entity held by this EntityHolder is
not compatible with $expectedClass.
- * @return Entity
+ * @return EntityDocument
*/
- public function getEntity( $expectedClass =
'Wikibase\DataModel\Entity\Entity' ) {
+ public function getEntity( $expectedClass =
'Wikibase\DataModel\Entity\EntityDocument' ) {
if ( !( $this->entity instanceof $expectedClass ) ) {
throw new RuntimeException( 'Contained entity is not
compatible with ' . $expectedClass );
}
--
To view, visit https://gerrit.wikimedia.org/r/208126
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I856bc382a5e5b86c641f098a0836e5d7ce7be338
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits