public static function setApplicationConnection(Application $application, $connName)
 {
     $container = $application->getKernel()->getContainer();
     $connName = $connName ? $connName : 'default';
     $connServiceName = sprintf('doctrine.dbal.%s_connection', $connName);
     if (!$container->hasService($connServiceName)) {
         throw new \InvalidArgumentException(sprintf('Could not find Doctrine Connection named "%s"', $connName));
     }
     $connection = $container->getService($connServiceName);
     $helperSet = $application->getHelperSet();
     $helperSet->set(new ConnectionHelper($connection), 'db');
 }