Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F167384
Example to fetch a statement from Wikibase
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
Bene
May 20 2015, 7:18 PM
2015-05-20 19:18:30 (UTC+0)
Size
647 B
Referenced Files
None
Subscribers
None
Example to fetch a statement from Wikibase
View Options
$entityLookup = Wikibase\Client\WikibaseClient::getDefaultInstance()->getStore()->getEntityLookup();
/** @var Wikibase\DataModel\Entity\Item $item */
$item = $entityLookup->getEntity( new Wikibase\DataModel\Entity\ItemId( $prefixedId ) );
$statements = $item->getStatements()->getWithPropertyId( new Wikibase\DataModel\Entity\PropertyId( $bannerPropertyId ) )->getBestStatements();
if ( !$statements->isEmpty() ) {
$statements = $statements->toArray();
$snak = $statements[0]->getMainSnak();
if ( $snak instanceof Wikibase\DataModel\Snak\PropertyValueSnak ) {
$banner = $snak->getDataValue()->getValue();
}
}
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
162880
Default Alt Text
Example to fetch a statement from Wikibase (647 B)
Attached To
Mode
P664 Example to fetch a statement from Wikibase
Attached
Detach File
Event Timeline
Log In to Comment