Doctrine ORM and domain eventsΒΆ
As described in the documentation of the SimpleBus/DoctrineORMBridge package library it provides:
A command bus middleware which wraps the handling of commands inside a database transaction
A command bus middleware which collects domain events recorded by entities and lets the event bus handle them
Install SimpleBus/DoctrineORMBridge
Before you continue, first install the
simple-bus/doctrine-orm-bridge
package in your project:composer require simple-bus/doctrine-orm-bridge
When you enable the DoctrineORMBridgeBundle
in your project, both
features will be automatically registered as command bus middlewares:
1 2 3 4 5 6 7 8 9 10 11 12 | class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
...
new SimpleBus\SymfonyBridge\DoctrineOrmBridgeBundle()
)
...
}
...
}
|
You can optionally configure which entity manager and connection should be used:
1 2 3 4 5 | # in config.yml
doctrine_orm_bridge:
entity_manager: default
connection: default
|