Page MenuHomePhabricator

Implement EntityIdLabelFormatter without the checks for if the entity exists
Closed, ResolvedPublic

Description

In order to avoid sorting out the complicated logic around if an entity exists or not yet (which we didnt break down yet).
We will split that off into a different story.

In order to avoid doing this logic we need to implement a new EntityIdLabelFormatter for federated properties that has most of the same logic as LabelsProviderEntityIdHtmlLinkFormatter but without the entity existing checks.

Roughly speaking this involves removing the following lines,

		$title = $this->entityTitleLookup->getTitleForId( $entityId );

//		if ( $title === null ) {
//			return $this->nonExistingFormatter->formatEntityId( $entityId );
//		}

		$term = $this->lookupEntityLabel( $entityId );

		// We can skip the potentially expensive isKnown() check if we found a term.
		if ( $term !== null ) {
			$label = $term->getText();
//		} elseif ( !$title->isKnown() ) {
//			return $this->nonExistingFormatter->formatEntityId( $entityId );
		} else {
			$label = $entityId->getSerialization();
		}

Wiring up this code will be done in T249799

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 21 2020, 11:17 AM
Addshore renamed this task from Implement LabelsProviderEntityIdHtmlLinkFormatter without the checks for if the entity exists to Implement EntityIdLabelFormatter without the checks for if the entity exists.Apr 21 2020, 11:18 AM
Restricted Application added a project: User-Addshore. · View Herald TranscriptApr 22 2020, 8:50 AM

Change 591763 had a related patch set uploaded (by Addshore; owner: Addshore):
[mediawiki/extensions/Wikibase@master] FP: Implement IdHtmlLinkFormatter without existance / title check

https://gerrit.wikimedia.org/r/591763

Change 591763 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] FP: Implement IdHtmlLinkFormatter without existance / title check

https://gerrit.wikimedia.org/r/591763

Samantha_Alipio_WMDE closed this task as Resolved.May 4 2020, 2:10 PM