concrete/src/Install/Installer.php
public function createConnection()
    {
        $pdoCheck = $this->application->make(PdoMysqlExtension::class)->performCheck();
        if ($pdoCheck->getState() !== PreconditionResult::STATE_PASSED) {
            throw new UserMessageException($pdoCheck->getMessage());
        }
        $databaseConfiguration = $this->getDefaultConnectionConfiguration();
        if ($databaseConfiguration === null) {
            throw new UserMessageException(t('The configuration is missing the required database connection parameters.'));
        }
        $databaseManager = $this->application->make(DatabaseManager::class);
        try {
            $connection = $databaseManager->getFactory()->createConnection($databaseConfiguration);
        } catch (Exception $x) {
            throw new UserMessageException($x->getMessage(), $x->getCode(), $x);
        } catch (Throwable $x) {
            throw new UserMessageException($x->getMessage(), $x->getCode());
        }

        $connection = $this->setPreferredCharsetCollation($connection);

        return $connection;
    }
public function createConnection()
    {
        $pdoCheck = $this->application->make(PdoMysqlExtension::class)->performCheck();
        if ($pdoCheck->getState() !== PreconditionResult::STATE_PASSED) {
            throw new UserMessageException($pdoCheck->getMessage());
        }
        $databaseConfiguration = $this->getDefaultConnectionConfiguration();
        if ($databaseConfiguration === null) {
            throw new UserMessageException(t('The configuration is missing the required database connection parameters.'));
        }
        $databaseManager = $this->application->make(DatabaseManager::class);
        try {
            $connection = $databaseManager->getFactory()->createConnection($databaseConfiguration);
        } catch (Exception $x) {
            throw new UserMessageException($x->getMessage(), $x->getCode(), $x);
        } catch (Throwable $x) {
            throw new UserMessageException($x->getMessage(), $x->getCode());
        }

        $connection = $this->setPreferredCharsetCollation($connection);

        return $connection;
    }
public function createConnection ( ) { $ pdoCheck = $ this -> application -> make ( PdoMysqlExtension :: class ) -> performCheck ( ) ; if ( $ pdoCheck -> getState ( ) !== PreconditionResult :: STATE_PASSED ) { throw new UserMessageException ( $ pdoCheck -> getMessage ( ) ) ; } $ databaseConfiguration = $ this -> getDefaultConnectionConfiguration ( ) ; if ( $ databaseConfiguration === null ) { throw new UserMessageException ( t ( 'The configuration is missing the required database connection parameters.' ) ) ; } $ databaseManager = $ this -> application -> make ( DatabaseManager :: class ) ; try { $ connection = $ databaseManager -> getFactory ( ) -> createConnection ( $ databaseConfiguration ) ; } catch ( Exception $ x ) { throw new UserMessageException ( $ x -> getMessage ( ) , $ x -> getCode ( ) , $ x ) ; } catch ( Throwable $ x ) { throw new UserMessageException ( $ x -> getMessage ( ) , $ x -> getCode ( ) ) ; } $ connection = $ this -> setPreferredCharsetCollation ( $ connection ) ; return $ connection ; }
Create a new Connection instance using the values specified in the options.

@throws \Concrete\Core\Error\UserMessageException throws a UserMessageException in case of problems

@return \Concrete\Core\Database\Connection\Connection
Create a new Connection instance using the values specified in the options .