/** * @param InputInterface $input * @return bool */ protected function execute(InputInterface $input) { $this->inputInterface = $input; $fromArg = $input->getArgument('from'); $sourceEnvironment = Environment::get($fromArg); $toArg = $this->getDestinationEnvironment(); $destEnvironment = Environment::get($toArg); $sourceDatabase = new Database($sourceEnvironment); $destinationDatabase = new Database($destEnvironment); $this->consoleOutput->output('Starting pulling <fg=magenta>' . $input->getArgument('from') . '</> database...'); $sourceResult = $sourceDatabase->exportSql(); if ($sourceResult->isFailed()) { $this->consoleOutput->output('<fg=red>Error!!</> Pulling <fg=magenta>' . $input->getArgument('from') . '</> wasn\'t successfull.'); $this->consoleOutput->output('<fg=default>Please</> check your Logs for more Information.'); return -1; } else { $this->consoleOutput->output('<fg=green>Success!!</> Pulling <fg=magenta>' . $input->getArgument('from') . '</> was successfull.'); } $this->consoleOutput->output('Starting importing <fg=magenta>' . $this->getDestinationEnvironment() . '</> database...'); $destinationResult = $destinationDatabase->importSql($sourceResult->getPath()); if ($destinationResult->isFailed()) { $this->consoleOutput->output('<fg=red>Error!!</> Importing <fg=magenta>' . $this->getDestinationEnvironment() . '</> wasn\'t successfull.'); $this->consoleOutput->output('<fg=default>Please</> check your Logs for more Information.'); return -1; } else { $this->consoleOutput->output('<fg=green>Success!!</> Importing <fg=magenta>' . $this->getDestinationEnvironment() . '</> was successfull.'); } return 0; }