Command-Query separation

Component ID

2832287

Component name

Command-Query separation

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

Command-query separation is a common concept in the software industry. Many architectures separate commands and queries from the rest of the system and send messages that are processed by handlers. This module leverages Drupal plugins to provide a way to defined queries, commands, and their handlers. You are also able to define decorators for handlers. The main aim of this project is to bring more SOLID principles and reusability to Drupal.

You are able to defyn commands, queries and and handlers in both modules and themes.

To help you get started there are Drupal console commands to walk you through the generation of these different plugins. (currently only available for generation in a module)

  • generate:command_query_separation:command_handler
  • generate:command_query_separation:query_handler

The module also provides some commands, queries, and their handlers for common use cases.

  • GetContextNode - Gets the current node.