[5.0] Use Container contract in database connection factory

PhpStorm was screaming at me when I tried to pass an application instance into the connection factory.