protected function setupDatabaseFromRestore(
        $method = null,
        $localhost = false
    ) {
        /** @var EngineType $engine */
        $engine = $this->getEngineInstance();

        if ($engine instanceof DockerEngineType) {
            $options = $this->databaseRestoreOptions();

            if (!isset($method)
                || !in_array($method, $options)) {
                $method = $this->doAsk(new ChoiceQuestion(
                    'Setup the project using? ',
                    $options
                ));
            }
            switch ($method) {
                case 'site-config':
                    $this
                        ->setupDrupalInstall($localhost)
                        ->setDrupalUuid($localhost)
                        ->importDrupalConfig(1, $localhost);
                    break;
                case 'database-import':
                    $this->importDatabaseToService($this->getPhpServiceName(), null, true, $localhost);
                    break;
                default:
                    /** @var DrupalPlatformRestoreInterface $platform */
                    $platform = $this->getPlatformInstance();

                    if ($platform instanceof DrupalPlatformRestoreInterface) {
                        $platform->drupalRestore($method);
                    }
            }
            $this->clearDrupalCache($localhost);
        } else {
            $classname = get_class($engine);

            throw new \RuntimeException(
                sprintf("The engine type %s isn't supported", $classname::getLabel())
            );
        }

        return $this;
    }
protected function setupDatabaseFromRestore(
        $method = null,
        $localhost = false
    ) {
        /** @var EngineType $engine */
        $engine = $this->getEngineInstance();

        if ($engine instanceof DockerEngineType) {
            $options = $this->databaseRestoreOptions();

            if (!isset($method)
                || !in_array($method, $options)) {
                $method = $this->doAsk(new ChoiceQuestion(
                    'Setup the project using? ',
                    $options
                ));
            }
            switch ($method) {
                case 'site-config':
                    $this
                        ->setupDrupalInstall($localhost)
                        ->setDrupalUuid($localhost)
                        ->importDrupalConfig(1, $localhost);
                    break;
                case 'database-import':
                    $this->importDatabaseToService($this->getPhpServiceName(), null, true, $localhost);
                    break;
                default:
                    /** @var DrupalPlatformRestoreInterface $platform */
                    $platform = $this->getPlatformInstance();

                    if ($platform instanceof DrupalPlatformRestoreInterface) {
                        $platform->drupalRestore($method);
                    }
            }
            $this->clearDrupalCache($localhost);
        } else {
            $classname = get_class($engine);

            throw new \RuntimeException(
                sprintf("The engine type %s isn't supported", $classname::getLabel())
            );
        }

        return $this;
    }
protected function setupDatabaseFromRestore ( $ method = null , $ localhost = false ) { /** @var EngineType $engine */ $ engine = $ this -> getEngineInstance ( ) ; if ( $ engine instanceof DockerEngineType ) { $ options = $ this -> databaseRestoreOptions ( ) ; if ( ! isset ( $ method ) || ! in_array ( $ method , $ options ) ) { $ method = $ this -> doAsk ( new ChoiceQuestion ( 'Setup the project using? ' , $ options ) ) ; } switch ( $ method ) { case 'site-config' : $ this -> setupDrupalInstall ( $ localhost ) -> setDrupalUuid ( $ localhost ) -> importDrupalConfig ( 1 , $ localhost ) ; break ; case 'database-import' : $ this -> importDatabaseToService ( $ this -> getPhpServiceName ( ) , null , true , $ localhost ) ; break ; default : /** @var DrupalPlatformRestoreInterface $platform */ $ platform = $ this -> getPlatformInstance ( ) ; if ( $ platform instanceof DrupalPlatformRestoreInterface ) { $ platform -> drupalRestore ( $ method ) ; } } $ this -> clearDrupalCache ( $ localhost ) ; } else { $ classname = get_class ( $ engine ) ; throw new \ RuntimeException ( sprintf ( "The engine type %s isn't supported" , $ classname :: getLabel ( ) ) ) ; } return $ this ; }
Setup a Drupal database from restore.

@param null $method
The method on how to restore.
@param bool $localhost
Run commands using the localhost.

@return $this
@throws \Robo\Exception\TaskException
Setup a Drupal database from restore .