Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector Class Reference

Queries db term store for collisions on terms. More...

+ Inheritance diagram for Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector:
+ Collaboration diagram for Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector:

Public Member Functions

 __construct (string $entityType, ILoadBalancer $loadBalancer, TypeIdsLookup $typeIdsLookup)
 
 detectLabelCollision (string $lang, string $label)
 Returns an entity id that collides with given label in given language, if any. More...
 
 detectLabelAndDescriptionCollision (string $lang, string $label, string $description)
 Returns an entity id that collides with given label and description in given languages, if any. More...
 

Private Member Functions

 makeEntityId ( $numericEntityId)
 
 composeEntityId ( $numericEntityId)
 
 findEntityIdsWithTermInLang ( $lang, string $text, int $termTypeId, bool $firstMatchOnly=false, array $filterOnEntityIds=[])
 
 getTermQueryParams ( $typeId, $lang, $text)
 
 getDbr ()
 

Private Attributes

 $entityType
 
 $loadBalancer
 
 $typeIdsLookup
 
 $databaseEntityTermsTableProvider
 

Detailed Description

Queries db term store for collisions on terms.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::__construct ( string  $entityType,
ILoadBalancer  $loadBalancer,
TypeIdsLookup  $typeIdsLookup 
)
Parameters
string$entityTypeone of the two supported types: Item::ENTITY_TYPE or Property::ENTITY_TYPE
ILoadBalancer$loadBalancer
TypeIdsLookup$typeIdsLookup
Exceptions
InvalidArgumentExceptionwhen non supported entity type is given

Member Function Documentation

◆ composeEntityId()

Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::composeEntityId (   $numericEntityId)
private

◆ detectLabelAndDescriptionCollision()

Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::detectLabelAndDescriptionCollision ( string  $lang,
string  $label,
string  $description 
)

Returns an entity id that collides with given label and description in given languages, if any.

Parameters
string$lang
string$label
string$description
Returns
EntityId|null numeric entity id of colliding entity, if any

Implements Wikibase\Repo\Store\TermsCollisionDetector.

◆ detectLabelCollision()

Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::detectLabelCollision ( string  $lang,
string  $label 
)

Returns an entity id that collides with given label in given language, if any.

Parameters
string$lang
string$label
Returns
EntityId|null

Implements Wikibase\Repo\Store\TermsCollisionDetector.

◆ findEntityIdsWithTermInLang()

Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::findEntityIdsWithTermInLang (   $lang,
string  $text,
int  $termTypeId,
bool  $firstMatchOnly = false,
array  $filterOnEntityIds = [] 
)
private

◆ getDbr()

Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::getDbr ( )
private

◆ getTermQueryParams()

Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::getTermQueryParams (   $typeId,
  $lang,
  $text 
)
private

◆ makeEntityId()

Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::makeEntityId (   $numericEntityId)
private
Parameters
mixed | null$numericEntityId
Returns
EntityId|null

Member Data Documentation

◆ $databaseEntityTermsTableProvider

Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::$databaseEntityTermsTableProvider
private

◆ $entityType

Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::$entityType
private

◆ $loadBalancer

Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::$loadBalancer
private

◆ $typeIdsLookup

Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector::$typeIdsLookup
private

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