Page MenuHomePhabricator

Make repository name a EntityIdComposer construtor parameter, not a parameter of composerEntityId parameters to EntityIdComposer
Open, MediumPublic

Description

Currently EntityIdComposer::composeEntityId assumes repository name/prefix is explicitly provided in every call. This makes the way how ID composer is used a bit different to how EntityIdParser is used. ID Parser's "parse" method has no direct knowledge on what repository name/prefix should be added to the resulting ID. Prefix-adding wrapper is used instead.

As ID composer is used in contexts where ID parser could be also used if there is relevant data (e.g. transforming data from the database to entity IDs depending whether full ID or just a numeric part of ID is stored), it seems it make sense to make the behaviour of both of those services similar in this regard.
To achieve this repository name/prefix would become a property of the particular ID composer instances (passed in the constructor), and not be explicitly provided in each composeEntityId call.
ID composer will pass a configured repository prefix/name when calling a "composer callback" in composeEntityId.

This change will make EntityIdComposer more "symmetrical" to EntityIdParser.

The way ID composer would be used after this change could be also seen as it is performing a simple repository prefix mapping ("empty" prefix to the given repository prefix)

Event Timeline

WMDE-leszek created this task.
WMDE-leszek added a subscriber: Ladsgroup.