daniel added a comment.

@Ladsgroup I have an alternative proposal. Here's how I understand the need:

  • we want a file defining templates for WikibaseRepo, and a factory service for getting these templates in PHP
  • we want a file defining templates for WikibaseLexeme, and a factory service for getting these templates in PHP

So:

  • remove the static singleton field from TemplateFactory
  • For WikibaseRepo, create a TemplateFactory instance that loads the template definitions for repo.
  • For WikibaseLexeme, create a TemplateFactory instance that loads the template definitions for lexeme.

The question is now where to get the right TemplateFactory instance from. TemplateFactory will have to be injected into services, so it has has to be available to wiring code. So the natural place for the repo instance is the WikibaseRepo top level factory. Managing a singleton in a static field, as we do now, will also work, but it annoying for testing etc.

Similarly, we could manage the TemplateFactory instance for lexeme in a static field of some class (which probably doesn't do anything else, and doesn't need to subclass TemplateFactory). However, we'll have to introduce a top level factory for WikibaseLexeme anyway, or at least some static front for accessing services, like MediaInfoServices.

So, my proposal is:

  • create a WikibaseLexemeServices class.
  • WikibaseLexemeServices manages a TemplateFactory instance in a static field for now.
  • WikibaseLexemeServices can eventually become a proper top level factory
  • Optionally, remove the singleton from TemplateFactory, and move it to the WikibaseRepo top level factory

TASK DETAIL
https://phabricator.wikimedia.org/T161789

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Ladsgroup, daniel
Cc: daniel, Aklapper, Ladsgroup, QZanden, Salgo60, D3r1ck01, Izno, Wikidata-bugs, aude, Darkdadaah, Mbch331
_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to