Skip to content

Commit cad85d2

Browse files
committed
add auto-register documentation
1 parent 425f551 commit cad85d2

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

doc/command_bus_bundle.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ services:
6464
- { name: command_handler, handles: Fully\Qualified\Class\Name\Of\RegisterUser }
6565
```
6666
67+
### Auto-Register command handlers
68+
69+
You can omit the `handles` tag attribute if your handler meets the following conditions:
70+
71+
1. Uses the "class_based" command name resolving strategy
72+
2. Handles a single command using the `__invoke` method
73+
3. Has a single, non optional class type hinted `__invoke` method parameter
74+
6775
> #### Command handlers are lazy-loaded
6876
>
6977
> Since only one of the command handlers is going to handle any particular command, command handlers are lazy-loaded.

doc/event_bus_bundle.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ services:
6565
- { name: event_subscriber, subscribes_to: Fully\Qualified\Class\Name\Of\UserRegistered }
6666
```
6767
68+
### Auto-Register event subscribers
69+
70+
You can omit the `subscribes_to` tag attribute if your subscriber meets the following conditions:
71+
72+
1. Uses the "class_based" event name resolving strategy
73+
2. Subscribers to single event using the `__invoke` method
74+
3. Has a single, non optional class type hinted `__invoke` method parameter
75+
6876
> #### Event subscribers are lazy-loaded
6977
>
7078
> Since only some of the event subscribers are going to handle any particular event, event subscribers are lazy-loaded.

0 commit comments

Comments
 (0)