BAOs - Allow BAOs to subscribe to hooks/events via `EventSubscriberInterface` or...
authorTim Otten <totten@civicrm.org>
Fri, 21 May 2021 18:51:32 +0000 (11:51 -0700)
committerTim Otten <totten@civicrm.org>
Wed, 26 May 2021 23:52:19 +0000 (16:52 -0700)
commitc8d8465306767fe281283ed005f1f1cb86d0f7c1
tree4fcb68a02b9daf91e4af253c7979ae58ee1d2c02
parentdf2b1bc531a1f27b01db9697d7922766d6fa5fa0
BAOs - Allow BAOs to subscribe to hooks/events via `EventSubscriberInterface` or `HookInterface`

Before: There is no pleasant way for a BAO to register a listener for an
event.  True, one can use `Civi::dispatch()`, but (lacking a good
initialization point) it's hard to register reliably.  True, you can also
add new items to `\Civi\Core\Container::createEventDispatcher()`, but
this is rather out-of-the-way.

After: A BAO class may optionally implement `EventDispatcherInterface` or
`HookInterface`. Methods will be automatically registered. The list
of listeners will be cached in the container.
CRM/Core/DAO/AllCoreTables.php
Civi/Core/Container.php