Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\Content\EntityContentFactory Class Reference

Factory for EntityContent objects. More...

Public Member Functions

 __construct (array $entityContentModels, array $entityHandlerFactoryCallbacks)
 
 isEntityContentModel (string $contentModel)
 Determines whether the given content model is designated to hold some kind of Wikibase entity.
 
 getEntityContentModels ()
 
 getEntityTypes ()
 
 getNamespaceForType (string $entityType)
 Determines what namespace is suitable for the given type of entities.
 
 getSlotRoleForType (string $entityType)
 Determines which slot is used to store a given type of entities.
 
 getContentHandlerForType (string $entityType)
 Returns the EntityHandler for the given entity type.
 
 getEntityHandlerForContentModel (string $contentModel)
 Returns the EntityHandler for the given model id.
 
 getContentModelForType (string $entityType)
 Determines what content model is suitable for the given type of entities.
 
 newFromEntity (EntityDocument $entity)
 Constructs a new EntityContent from an Entity.
 
 newFromRedirect (EntityRedirect $redirect)
 Constructs a new EntityContent from an EntityRedirect, or null if the respective kind of entity does not support redirects.
 

Private Attributes

 $entityContentModels
 
 $entityHandlerFactoryCallbacks
 
 $entityHandlers = []
 

Detailed Description

Factory for EntityContent objects.

Author
Jeroen De Dauw < jeroe.nosp@m.nded.nosp@m.auw@g.nosp@m.mail.nosp@m..com >
Daniel Kinzler
Bene* < benes.nosp@m.tar..nosp@m.wikim.nosp@m.edia.nosp@m.@gmai.nosp@m.l.co.nosp@m.m >

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Content\EntityContentFactory::__construct ( array $entityContentModels,
array $entityHandlerFactoryCallbacks )
Parameters
string[]$entityContentModelsEntity type ID to content model ID mapping.
callable[]$entityHandlerFactoryCallbacksEntity type ID to callback mapping for creating ContentHandler objects.

Member Function Documentation

◆ getContentHandlerForType()

Wikibase\Repo\Content\EntityContentFactory::getContentHandlerForType ( string $entityType)

Returns the EntityHandler for the given entity type.

Parameters
string$entityType
Exceptions
OutOfBoundsExceptionif no content model is defined for the given entity type.
Returns
EntityHandler

◆ getContentModelForType()

Wikibase\Repo\Content\EntityContentFactory::getContentModelForType ( string $entityType)

Determines what content model is suitable for the given type of entities.

Parameters
string$entityType
Exceptions
OutOfBoundsExceptionif no content model is defined for the given entity type.
Returns
string

◆ getEntityContentModels()

Wikibase\Repo\Content\EntityContentFactory::getEntityContentModels ( )
Returns
string[] A list of content model IDs used to represent Wikibase entities.

◆ getEntityHandlerForContentModel()

Wikibase\Repo\Content\EntityContentFactory::getEntityHandlerForContentModel ( string $contentModel)

Returns the EntityHandler for the given model id.

Parameters
string$contentModel
Exceptions
OutOfBoundsExceptionif no entity handler is defined for the given content model.
Returns
EntityHandler

◆ getEntityTypes()

Wikibase\Repo\Content\EntityContentFactory::getEntityTypes ( )
Returns
string[] A list of entity type IDs used for Wikibase entities.

◆ getNamespaceForType()

Wikibase\Repo\Content\EntityContentFactory::getNamespaceForType ( string $entityType)

Determines what namespace is suitable for the given type of entities.

Parameters
string$entityType
Exceptions
OutOfBoundsExceptionif no content model is defined for the given entity type.
Returns
int

◆ getSlotRoleForType()

Wikibase\Repo\Content\EntityContentFactory::getSlotRoleForType ( string $entityType)

Determines which slot is used to store a given type of entities.

Parameters
string$entityType
Exceptions
OutOfBoundsExceptionif no content model is defined for the given entity type.
Returns
string the role name of the slot

◆ isEntityContentModel()

Wikibase\Repo\Content\EntityContentFactory::isEntityContentModel ( string $contentModel)

Determines whether the given content model is designated to hold some kind of Wikibase entity.

Parameters
string$contentModel
Returns
bool If the given content model ID is a known entity content model.

◆ newFromEntity()

Wikibase\Repo\Content\EntityContentFactory::newFromEntity ( EntityDocument $entity)

Constructs a new EntityContent from an Entity.

See also
EntityHandler::makeEntityContent
Parameters
EntityDocument$entity
Returns
EntityContent

◆ newFromRedirect()

Wikibase\Repo\Content\EntityContentFactory::newFromRedirect ( EntityRedirect $redirect)

Constructs a new EntityContent from an EntityRedirect, or null if the respective kind of entity does not support redirects.

See also
EntityHandler::makeEntityRedirectContent
Parameters
EntityRedirect$redirect
Returns
EntityContent|null

Member Data Documentation

◆ $entityContentModels

Wikibase\Repo\Content\EntityContentFactory::$entityContentModels
private

◆ $entityHandlerFactoryCallbacks

Wikibase\Repo\Content\EntityContentFactory::$entityHandlerFactoryCallbacks
private

◆ $entityHandlers

Wikibase\Repo\Content\EntityContentFactory::$entityHandlers = []
private

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