Skip to content

Extended global events

Currently, global events have to be static methods and can exist on any class. This is so that the code can be copied and executed within the application context by using a Hazaar\Warlock\Container object. The Hazaar\Warlock\Container class extends from the Hazaar\Warlock\Process class which is the class that defines all the functions used by running processes, such as trigger(), log(), etc. These types of global events are defined in configuration as ClassName::methodName.

The plan here is to allow methods that are stored in existing services to be executed as global events. These would be defined in the config as ClassName->methodName so as to not interfer with the existing functionality and still allow global event code to be stored on any application accessible class. However, defining the config like this would add an additional check that the class extends the Hazaar\Warlock\Process class when it is instantiated. This new object can then be initialised, pretty much exactly how a running Service is, then the method will be executed without the use of a container object.