/**
  * Creates database connection and returns it.
  *
  * @throws DatabaseConnectionException
  * @throws DatabaseNotConfiguredException
  *
  * @return DatabaseInterface
  */
 protected function createDatabase()
 {
     /** Call to fetchConfigFile redirects to setup wizard, if shop has not been configured. */
     $configFile = $this->fetchConfigFile();
     /** Validate the configuration file */
     $this->validateConfigFile($configFile);
     /** Set config file to be able to read shop configuration within the class */
     $this->setConfigFile($configFile);
     /** @var array $connectionParameters Parameters needed for the database connection */
     $connectionParameters = $this->getConnectionParameters();
     $databaseAdapter = new DatabaseAdapter();
     $databaseAdapter->setConnectionParameters($connectionParameters);
     $databaseAdapter->connect();
     return $databaseAdapter;
 }