Page MenuHomePhabricator

Lexeme (and maybe mediainfo) use a "default" EntityRevisionLookup when perhaps they should use a specific one
Open, LowPublic

Description

Lexeme has code such as this in its entity type wiring.

		'entity-revision-lookup-factory-callback' => function (
			EntityRevisionLookup $defaultLookup
		) {
			return new FormRevisionLookup( $defaultLookup );
		},

$defaultLookup here is conveniently a WikiPageEntityRevisionLookup.
This default lookup should probably be removed and each entity type that requires a WikiPageEntityRevisionLookup should instead grab one in its own wiring.

Currently WikiPageEntityRevisionLookup is only created in SingleEntitySourceServices in getEntityRevisionLookup
Instead a WikiPageEntityRevisionLookupFactory should be retrievable from somewhere in data-access as a generic service.
Entity type definitions should then specify the WikiPageEntityRevisionLookupFactory or closure that can be used to retrieve an WikiPageEntityRevisionLookup for them.
This standard factory is probably needed as the database name needs to be passed in from the entity source once that is known further up the wiring tree.