Repository navigation
fix(database): honour injected connections during initialization - #2326
hipsterjazzbo wants to merge 5 commits into
Conversation
Assisted-by: Crush:gpt-6.1-terra
This reasoning doesn't make sense, as Tempest's initializers will never be called directly, we can safely change a normal initializer to a dynamic one in a patch release |
|
Agreed, thanks — I was overvaluing the old I've updated the PR to make |
Context
This is a draft implementation of #2325. I'd appreciate feedback on the approach before considering it ready.
Currently,
DatabaseInitializercreates and registers its ownPDOConnection, potentially replacing an application-providedConnection.ConnectionInitializerhas a separate cache and only handles the default database configuration.GenericDatabasealso relies on aconfigproperty that isn't part of theConnectioninterface.Proposed change
ConnectionInitializer.DatabaseConfigexplicitly toGenericDatabase, retaining compatibility with existing constructor calls.Design choice — feedback welcome
I initially considered converting
ConnectionInitializerdirectly into aDynamicInitializer. That would be slightly less code, but would change its existing publicinitialize(Container $container)method signature.Instead, this implementation preserves that signature and introduces a small
TaggedConnectionInitializerthat delegates to the same connection-resolution logic.It's an extra class, but avoids changing an existing public method contract in a 3.x bug fix.
Does that seem like the right trade-off, or would you prefer the direct dynamic-initializer approach? Is there a simpler option I've overlooked?
I'm happy to revise this based on feedback. I'm deliberately leaving Doctrine DBAL integration and the broader v4 database refactor out of scope.
Closes #2325