private function getConnection()
    {
        if ($this->connection) {
            return $this->connection;
        }

        $reflection = new \ReflectionProperty(\Contao\Database::class, 'resConnection');
        $reflection->setAccessible(true);

        return $this->connection = $reflection->getValue($this->getDatabase());
    }
private function getConnection()
    {
        if ($this->connection) {
            return $this->connection;
        }

        $reflection = new \ReflectionProperty(\Contao\Database::class, 'resConnection');
        $reflection->setAccessible(true);

        return $this->connection = $reflection->getValue($this->getDatabase());
    }
private function getConnection ( ) { if ( $ this -> connection ) { return $ this -> connection ; } $ reflection = new \ ReflectionProperty ( \ Contao \ Database :: class , 'resConnection' ) ; $ reflection -> setAccessible ( true ) ; return $ this -> connection = $ reflection -> getValue ( $ this -> getDatabase ( ) ) ; }
Obtain the doctrine connection.

@return Connection

@throws \ReflectionException Throws could not connect to database.
Obtain the doctrine connection .