User:Mainframe98/Services

This page describes thing related to services in MediaWiki. See also: Dependency Injection.

General service types

edit

MediaWiki has a few common service types. This section describes them and identifies for which purpose they can be used.

Store
This is service can, as its name implies, store and retrieve things.
Factory
There are two kinds of factories, both of which may be used within the same class:
Make
Create an object if it does not exist yet and return the same object when provided with the same parameters.
New
Create a new object every time the method is invoked.
Lookup
This service provides information about a given thing, as an addition to the object. It does not create objects itself unless the object is auxiliary.
Manager
This service manages things. It can optionally retrieve the things too.
Repository
This service is a read-only storage for looking up things. The things are often predefined elsewhere and do not change during runtime.