In Concrete CMS 9.0, we’ve added commands and command handlers as core-supported objects. From Wikipedia:
In object-oriented programming, the command pattern is a behavioral design pattern in which an object is used to encapsulate all information needed to perform an action or trigger an event at a later time. This information includes the method name, the object that owns the method and values for the method parameters.
More simply put: Command (or, more generally, Message
) objects encapsulate all the data needed to store a particular command that you’d like to run, and the handlers are called automatically with these objects passed in when the commands are actually triggered. Some benefits to adopting a command/command handler architecture are the ability to trigger code from multiple locations (from within a Dashboard page controller and a console command, for example) and increased code legibility.
Read on for more information.