Skip to content

Commit

Permalink
Update for DataModel 6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
aude committed Apr 8, 2016
1 parent ebb47ce commit 5abc802
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"require": {
"php": ">=5.5.0",
"benestar/asparagus": "~0.4",
"monolog/monolog": "~1.18"
"monolog/monolog": "~1.18",
"wikibase/data-model": "~6.0"
},
"autoload": {
"psr-4": {
Expand Down
8 changes: 3 additions & 5 deletions src/EntityImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
use Psr\Log\LoggerInterface;
use User;
use Wikibase\DataModel\Entity\BasicEntityIdParser;
use Wikibase\DataModel\Entity\Entity;
use Wikibase\DataModel\Entity\EntityDocument;
use Wikibase\DataModel\Entity\EntityId;
use Wikibase\DataModel\Entity\EntityIdParsingException;
use Wikibase\DataModel\Entity\EntityIdValue;
use Wikibase\DataModel\Entity\Item;
use Wikibase\DataModel\Entity\ItemId;
use Wikibase\DataModel\Serializers\StatementSerializer;
use Wikibase\DataModel\Snak\PropertyValueSnak;
use Wikibase\DataModel\Statement\StatementList;
use Wikibase\Repo\Store\WikiPageEntityStore;
Expand Down Expand Up @@ -135,7 +133,7 @@ private function importBatch( array $batch ) {
return $stashedEntities;
}

private function createEntity( Entity $entity ) {
private function createEntity( EntityDocument $entity ) {
$entity->setId( null );

$entity->setStatements( new StatementList() );
Expand Down Expand Up @@ -171,7 +169,7 @@ private function getBadgeItems( array $entities ) {
return $badgeItems;
}

private function getReferencedEntities( Entity $entity ) {
private function getReferencedEntities( EntityDocument $entity ) {
$snaks = $entity->getStatements()->getAllSnaks();
$entities = array();

Expand Down
13 changes: 2 additions & 11 deletions src/StatementsImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,15 @@
namespace Wikibase\Import;

use ApiMain;
use DataValues\Serializers\DataValueSerializer;
use Serializers\Serializer;
use FauxRequest;
use Psr\Log\LoggerInterface;
use RequestContext;
use User;
use Wikibase\DataModel\DeserializerFactory;
use Wikibase\DataModel\Entity\BasicEntityIdParser;
use Wikibase\DataModel\Entity\Entity;
use Wikibase\DataModel\Entity\EntityDocument;
use Wikibase\DataModel\Entity\EntityId;
use Wikibase\DataModel\Entity\EntityIdValue;
use Wikibase\DataModel\Entity\Item;
use Wikibase\DataModel\Entity\ItemId;
use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\DataModel\Serializers\StatementSerializer;
use Wikibase\DataModel\Snak\PropertyNoValueSnak;
use Wikibase\DataModel\Snak\PropertySomeValueSnak;
use Wikibase\DataModel\Snak\PropertyValueSnak;
use Wikibase\DataModel\Statement\Statement;
use Wikibase\DataModel\Statement\StatementList;

Expand Down Expand Up @@ -52,7 +43,7 @@ public function __construct(
$this->idParser = new BasicEntityIdParser();
}

public function importStatements( Entity $entity ) {
public function importStatements( EntityDocument $entity ) {
$statements = $entity->getStatements();

$this->logger->info( 'Adding statements: ' . $entity->getId()->getSerialization() );
Expand Down

1 comment on commit 5abc802

@JeroenDeDauw
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the code still works with older versions as well, so increasing the lower bound that far is not optimal

Please sign in to comment.