/** * Builds the settings.local.php file. */ public function __construct() { $this->projectName = Platform::projectName(); $this->containerName = Docker::getContainerName('mariadb'); $this->string = "<?php\n\n"; $this->dbFromLocal(); $this->dbFromDocker(); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $containerName = null; $type = $input->getArgument('service'); switch ($type) { case 'http': $containerName = Docker::getContainerName('nginx'); break; case 'php': $containerName = Docker::getContainerName('phpfpm'); break; case 'db': $containerName = Docker::getContainerName('mariadb'); break; case 'redis': $containerName = Docker::getContainerName('redis'); break; case 'solr': $this->stdOut->writeln("<error>Not provided yet</error>"); break; default: $this->stdOut->writeln("<error>Invalid service type</error>"); break; } $builder = new ProcessBuilder(['docker', 'exec', '-it', $containerName, 'bash']); $process = $builder->getProcess(); // Need to set tty true, ShellHelper doesn't allow this setting. $process->setTty(true); try { $process->mustRun(null); } catch (ProcessFailedException $e) { $message = "The command failed with the exit code: " . $process->getExitCode(); $message .= "\n\nFull command: " . $process->getCommandLine(); throw new \Exception($message); } }