Wikibase
MediaWiki Wikibase extension
Wikibase\DataModel\Entity\Item Class Reference

Represents a single Wikibase item. More...

+ Inheritance diagram for Wikibase\DataModel\Entity\Item:
+ Collaboration diagram for Wikibase\DataModel\Entity\Item:

Public Member Functions

 __construct (ItemId $id=null, Fingerprint $fingerprint=null, SiteLinkList $siteLinks=null, StatementList $statements=null)
 
 getId ()
 Returns the id of the entity or null if it does not have one. More...
 
 setId ( $id)
 
 getFingerprint ()
 
 setFingerprint (Fingerprint $fingerprint)
 
 getLabels ()
 
 getDescriptions ()
 
 getAliasGroups ()
 
 setLabel ( $languageCode, $value)
 
 setDescription ( $languageCode, $value)
 
 setAliases ( $languageCode, array $aliases)
 
 getSiteLinkList ()
 
 setSiteLinkList (SiteLinkList $siteLinks)
 
 addSiteLink (SiteLink $siteLink)
 Adds a site link to the list of site links. More...
 
 removeSiteLink ( $siteId)
 Removes the sitelink with specified site ID if the Item has such a sitelink. More...
 
 getSiteLink ( $siteId)
 
 hasLinkToSite ( $siteId)
 
 getType ()
 
 isEmpty ()
 Returns if the Item has no content. More...
 
 getStatements ()
 
 setStatements (StatementList $statements)
 
 equals ( $target)
 
 copy ()
 
 __clone ()
 
 clear ()
 

Static Public Member Functions

static newEmpty ()
 

Public Attributes

const ENTITY_TYPE = 'item'
 

Private Attributes

 $id
 
 $fingerprint
 
 $siteLinks
 
 $statements
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

Wikibase\DataModel\Entity\Item::__construct ( ItemId  $id = null,
Fingerprint  $fingerprint = null,
SiteLinkList  $siteLinks = null,
StatementList  $statements = null 
)
Since
1.0
Parameters
ItemId | null$id
Fingerprint | null$fingerprint
SiteLinkList | null$siteLinks
StatementList | null$statements

Member Function Documentation

◆ __clone()

Wikibase\DataModel\Entity\Item::__clone ( )

◆ addSiteLink()

Wikibase\DataModel\Entity\Item::addSiteLink ( SiteLink  $siteLink)

Adds a site link to the list of site links.

If there already is a site link with the site id of the provided site link, then that one will be overridden by the provided one.

Since
0.6
Parameters
SiteLink$siteLink

◆ clear()

Wikibase\DataModel\Entity\Item::clear ( )

◆ copy()

Wikibase\DataModel\Entity\Item::copy ( )
See also
EntityDocument::copy
Since
0.1
Returns
self

Implements Wikibase\DataModel\Entity\EntityDocument.

◆ equals()

Wikibase\DataModel\Entity\Item::equals (   $target)
See also
EntityDocument::equals
Since
0.1
Parameters
mixed$target
Returns
bool

Implements Wikibase\DataModel\Entity\EntityDocument.

◆ getAliasGroups()

Wikibase\DataModel\Entity\Item::getAliasGroups ( )
See also
AliasesProvider::getAliasGroups
Since
6.0
Returns
AliasGroupList

Implements Wikibase\DataModel\Term\AliasesProvider.

◆ getDescriptions()

Wikibase\DataModel\Entity\Item::getDescriptions ( )

◆ getFingerprint()

Wikibase\DataModel\Entity\Item::getFingerprint ( )
Since
0.7.3
Returns
Fingerprint

Implements Wikibase\DataModel\Term\FingerprintProvider.

◆ getId()

Wikibase\DataModel\Entity\Item::getId ( )

Returns the id of the entity or null if it does not have one.

Since
0.1 return type changed in 0.3
Returns
ItemId|null

Implements Wikibase\DataModel\Entity\EntityDocument.

◆ getLabels()

Wikibase\DataModel\Entity\Item::getLabels ( )
See also
LabelsProvider::getLabels
Since
6.0
Returns
TermList

Implements Wikibase\DataModel\Term\LabelsProvider.

◆ getSiteLink()

Wikibase\DataModel\Entity\Item::getSiteLink (   $siteId)
Since
0.6
Parameters
string$siteId
Returns
SiteLink
Exceptions
OutOfBoundsException

◆ getSiteLinkList()

Wikibase\DataModel\Entity\Item::getSiteLinkList ( )
Since
0.8
Returns
SiteLinkList

◆ getStatements()

Wikibase\DataModel\Entity\Item::getStatements ( )
Since
1.0
Returns
StatementList

Implements Wikibase\DataModel\Statement\StatementListProvider.

◆ getType()

Wikibase\DataModel\Entity\Item::getType ( )
See also
Entity::getType
Since
0.1
Returns
string Returns the entity type "item".

Implements Wikibase\DataModel\Entity\EntityDocument.

◆ hasLinkToSite()

Wikibase\DataModel\Entity\Item::hasLinkToSite (   $siteId)
Since
0.4
Parameters
string$siteId
Returns
bool

◆ isEmpty()

Wikibase\DataModel\Entity\Item::isEmpty ( )

Returns if the Item has no content.

Having an id set does not count as having content.

Since
0.1
Returns
bool

Implements Wikibase\DataModel\Entity\EntityDocument.

◆ newEmpty()

static Wikibase\DataModel\Entity\Item::newEmpty ( )
static
Deprecated:
since 2.5, use new Item() instead.
Returns
self

◆ removeSiteLink()

Wikibase\DataModel\Entity\Item::removeSiteLink (   $siteId)

Removes the sitelink with specified site ID if the Item has such a sitelink.

Since
0.1
Parameters
string$siteIdthe target site's id

◆ setAliases()

Wikibase\DataModel\Entity\Item::setAliases (   $languageCode,
array  $aliases 
)
Parameters
string$languageCode
string[]$aliases
Exceptions
InvalidArgumentException

◆ setDescription()

Wikibase\DataModel\Entity\Item::setDescription (   $languageCode,
  $value 
)
Parameters
string$languageCode
string$value
Exceptions
InvalidArgumentException

◆ setFingerprint()

Wikibase\DataModel\Entity\Item::setFingerprint ( Fingerprint  $fingerprint)
Since
0.7.3
Parameters
Fingerprint$fingerprint

◆ setId()

Wikibase\DataModel\Entity\Item::setId (   $id)
Since
0.5, can be null since 1.0
Parameters
ItemId | null$id
Exceptions
InvalidArgumentException

Implements Wikibase\DataModel\Entity\EntityDocument.

◆ setLabel()

Wikibase\DataModel\Entity\Item::setLabel (   $languageCode,
  $value 
)
Parameters
string$languageCode
string$value
Exceptions
InvalidArgumentException

◆ setSiteLinkList()

Wikibase\DataModel\Entity\Item::setSiteLinkList ( SiteLinkList  $siteLinks)
Since
0.8
Parameters
SiteLinkList$siteLinks

◆ setStatements()

Wikibase\DataModel\Entity\Item::setStatements ( StatementList  $statements)
Since
1.0
Parameters
StatementList$statements

Implements Wikibase\DataModel\Statement\StatementListHolder.

Member Data Documentation

◆ $fingerprint

Wikibase\DataModel\Entity\Item::$fingerprint
private

◆ $id

Wikibase\DataModel\Entity\Item::$id
private

◆ $siteLinks

Wikibase\DataModel\Entity\Item::$siteLinks
private

◆ $statements

Wikibase\DataModel\Entity\Item::$statements
private

◆ ENTITY_TYPE

const Wikibase\DataModel\Entity\Item::ENTITY_TYPE = 'item'

The documentation for this class was generated from the following file: