Last updated
Last updated
Command Query Responsibility Segregation is a simple concept. When you want something to happen, you will use a Command. If you need results returned, you will use a query.
An over simplified example of this would be if you need to write to a database, you would use a Command. If you need results from a database, you would use a Query.
!!! success "Symfony CQRS Bridge" Once the CQRS Symfony Bridge is installed, you can use the Command Bus that comes with that to gain access to additional features and functionality.
!!! success "Symfony CQRS Bridge" Once the CQRS Symfony Bridge is installed, you can use the Query Bus that comes with that to gain addition features and functionality.
Both Commands and Queries are considered to be messages. It is HIGHLY recommended to use the AbstractMessage
class for both Commands and Queries. For all examples I will assume you have extended this class.
!!! note AbstractMessage
treats the message as a value object. So using with
will return a new instance of the class.
AbstractMessage
APIBoth Command and Query Handers are assumed to just be message handlers.
The Symfony Bridge uses Symfony Components to add additional functionality to the CQRS component.