Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\DataModel\Services\EntityId\EntityIdComposer Class Reference

Constructs EntityId objects from entity type identifiers and unique parts of entity ID serializations. More...

Public Member Functions

 __construct (array $composers)
 
 composeEntityId ( $entityType, $uniquePart)
 

Private Attributes

 $composers
 

Detailed Description

Constructs EntityId objects from entity type identifiers and unique parts of entity ID serializations.

The unique part is typically the numeric part of an entity ID, excluding the static part that's the same for all IDs of that type.

Meant to be the counterpart for

See also
Int32EntityId::getNumericId, as well as an extensible replacement for
LegacyIdInterpreter::newIdFromTypeAndNumber.
Since
3.9
Author
Thiemo Kreuz

Constructor & Destructor Documentation

◆ __construct()

Wikibase\DataModel\Services\EntityId\EntityIdComposer::__construct ( array  $composers)
Parameters
callable[]$composersArray mapping entity type identifiers to callables accepting a single mixed value, representing the unique part of an entity ID serialization, and returning an EntityId object.
Exceptions
InvalidArgumentException

Member Function Documentation

◆ composeEntityId()

Wikibase\DataModel\Services\EntityId\EntityIdComposer::composeEntityId (   $entityType,
  $uniquePart 
)
Parameters
string$entityType
mixed$uniquePart
Exceptions
InvalidArgumentExceptionwhen the entity type is not known or the unique part is not unique.
UnexpectedValueExceptionwhen the configured composer did not return an EntityId object.
Returns
EntityId

Member Data Documentation

◆ $composers

Wikibase\DataModel\Services\EntityId\EntityIdComposer::$composers
private

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