public function postConnect(ConnectionEventArgs $args)
    {
        $db = $args->getConnection();
        $platform = $args->getDatabasePlatform();
        $platformName = $platform->getName();

        if ($platformName === 'sqlite') {
            $db->query('PRAGMA synchronous = OFF');
        } elseif ($platformName === 'mysql') {
            /** @see http://docs.doctrine-project.org/en/latest/cookbook/mysql-enums.html */
            $platform->registerDoctrineTypeMapping('enum', 'string');

            // Set database character set & collation as configured
            $charset = $this->config->get('general/database/charset');
            $collation = $this->config->get('general/database/collate');
            $db->executeQuery('SET NAMES ? COLLATE ?', [$charset, $collation], [PDO::PARAM_STR]);

            // Increase group_concat_max_len to 100000. By default, MySQL
            // sets this to a low value – 1024 – which causes issues with
            // certain Bolt content types – particularly repeaters – where
            // the outcome of a GROUP_CONCAT() query will be more than 1024 bytes.
            // See also: http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_group_concat_max_len
            $groupConcatMaxLen = $this->config->get('general/database/group_concat_max_len', 100000);
            $db->executeQuery('SET SESSION group_concat_max_len = ?', [$groupConcatMaxLen], [PDO::PARAM_INT]);
        } elseif ($platformName === 'postgresql') {
            /** @see https://github.com/doctrine/dbal/pull/828 */
            $db->executeQuery("SET NAMES 'utf8'");
        }
    }
public function postConnect(ConnectionEventArgs $args)
    {
        $db = $args->getConnection();
        $platform = $args->getDatabasePlatform();
        $platformName = $platform->getName();

        if ($platformName === 'sqlite') {
            $db->query('PRAGMA synchronous = OFF');
        } elseif ($platformName === 'mysql') {
            /** @see http://docs.doctrine-project.org/en/latest/cookbook/mysql-enums.html */
            $platform->registerDoctrineTypeMapping('enum', 'string');

            // Set database character set & collation as configured
            $charset = $this->config->get('general/database/charset');
            $collation = $this->config->get('general/database/collate');
            $db->executeQuery('SET NAMES ? COLLATE ?', [$charset, $collation], [PDO::PARAM_STR]);

            // Increase group_concat_max_len to 100000. By default, MySQL
            // sets this to a low value – 1024 – which causes issues with
            // certain Bolt content types – particularly repeaters – where
            // the outcome of a GROUP_CONCAT() query will be more than 1024 bytes.
            // See also: http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_group_concat_max_len
            $groupConcatMaxLen = $this->config->get('general/database/group_concat_max_len', 100000);
            $db->executeQuery('SET SESSION group_concat_max_len = ?', [$groupConcatMaxLen], [PDO::PARAM_INT]);
        } elseif ($platformName === 'postgresql') {
            /** @see https://github.com/doctrine/dbal/pull/828 */
            $db->executeQuery("SET NAMES 'utf8'");
        }
    }
public function postConnect ( ConnectionEventArgs $ args ) { $ db = $ args -> getConnection ( ) ; $ platform = $ args -> getDatabasePlatform ( ) ; $ platformName = $ platform -> getName ( ) ; if ( $ platformName === 'sqlite' ) { $ db -> query ( 'PRAGMA synchronous = OFF' ) ; } elseif ( $ platformName === 'mysql' ) { /** @see http://docs.doctrine-project.org/en/latest/cookbook/mysql-enums.html */ $ platform -> registerDoctrineTypeMapping ( 'enum' , 'string' ) ; // Set database character set & collation as configured $ charset = $ this -> config -> get ( 'general/database/charset' ) ; $ collation = $ this -> config -> get ( 'general/database/collate' ) ; $ db -> executeQuery ( 'SET NAMES ? COLLATE ?' , [ $ charset , $ collation ] , [ PDO :: PARAM_STR ] ) ; // Increase group_concat_max_len to 100000. By default, MySQL // sets this to a low value – 1024 – which causes issues with // certain Bolt content types – particularly repeaters – where // the outcome of a GROUP_CONCAT() query will be more than 1024 bytes. // See also: http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_group_concat_max_len $ groupConcatMaxLen = $ this -> config -> get ( 'general/database/group_concat_max_len' , 100000 ) ; $ db -> executeQuery ( 'SET SESSION group_concat_max_len = ?' , [ $ groupConcatMaxLen ] , [ PDO :: PARAM_INT ] ) ; } elseif ( $ platformName === 'postgresql' ) { /** @see https://github.com/doctrine/dbal/pull/828 */ $ db -> executeQuery ( "SET NAMES 'utf8'" ) ; } }
After connecting, update this connection's database settings.

Note: Doctrine expects this method to be called postConnect

@param ConnectionEventArgs $args

@throws \Doctrine\DBAL\DBALException
After connecting update this connection s database settings .