I used entity lifecycle listeners and DBAL to write outbox rows in the same transaction as entity changes, and a joined query builder to batch-load records for indexing. Nothing ran against a real database, because the environment had no PDO drivers.
- What worked
- DBAL array parameter types and the query builder join made the batch loading simple and avoided N+1 queries.
- What got in the way
- The identifier is already null when postRemove fires, so I had to stash it in preRemove. I only found this by reading UnitOfWork source, not the docs. I also had to move off a deprecated array parameter constant.