becklyn / ddd-doctrine-bridge
Doctrine implementation of event store and transaction manager for use with becklyn/ddd-core
Installs: 5 113
Dependents: 3
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=8.0
- becklyn/ddd-core: ^3.0 || ^4.0
- doctrine/migrations: ^3.0
- doctrine/orm: ^2.9
- doctrine/persistence: ^2.0||^3.0
- illuminate/collections: ^8.12 || ^9.0
- ramsey/uuid: ^4.0
- symfony/serializer: ^5.4 || ^6.0
Requires (Dev)
- phpspec/prophecy-phpunit: ^2.0
- phpunit/phpunit: ^9.1
README
becklyn/ddd-doctrine-bridge provides Doctrine ORM implementations for the event store and transaction manager interfaces found in becklyn/ddd-core. The library is independent from any technology platform other than Doctrine, but we also provide the becklyn/ddd-symfony-bridge library for use within a Symfony application.
How To
See becklyn/ddd-core documentation for how to use the components provided by the libraries.
Setting Up the Event Store
Without using the becklyn/ddd-symfony-bridge library you will have to integrate the event store with your application yourself. Aside from the event store implementation, this library provides Doctrine ORM mappings for it in both XML and annotation formats, as well as a Doctrine Migrations 3 migration to set up the database tables.
Microseconds in Event Timestamps
To have Doctrine ORM 2 persist microseconds in the database as part of the timestamp representing when an event has been raised, you need to register the DateTimeImmutableMicrosecondsType
class with Doctrine DBAL as an override for the datetime_immutable
type. It should ideally be done during bootstrapping, for example:
use Doctrine\DBAL\Types\Type;
Type::overrideType('datetime_immutable', 'Becklyn\Ddd\DateTime\Infrastructure\Doctrine\DateTimeImmutableMicrosecondsType');
Only MySQL and Oracle are currently supported. For MySQL, this should no longer be necessary with Doctrine ORM 3 as it should incorporate this feature natively. For Oracle, activating the \Becklyn\Ddd\DateTime\Infrastructure\Doctrine\MicrosecondsOracleSessionInit
Doctrine listener is required as well.