Closed janedbal closed 3 weeks ago
getNativeConnection()
is the best the public API can offer at runtime. Also note that middleware could perform arbitrary transformations on results, like type casting or changing array keys.
Ok, I ended up using that anyway. Thanks for confirmation.
Support Question
Hi, I'm trying to improve query type inference support in phpstan-doctrine, see PR. Any type of DQL expression is dependent on used driver (and PHP version and config). I tried to make this work out of the box (by autodetection) and so far I used this for conditional logic:
But now I realized that when middlewares are used, this will never match. And I found no reliable way in public api of doctrine/dbal to detect actually used driver. Did I miss some approach or do you think it would be handy even for other usecases to somehow expose really used driver?
I dont care about the instance itself, I could work even with some enum like those used in connection params or just its class-string.