InstallerCommand
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Customize\Command; | |
use Eccube\Command\PluginCommandTrait; | |
use Symfony\Component\Console\Command\Command; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use Symfony\Component\Console\Style\SymfonyStyle; | |
use Symfony\Component\Finder\Finder; | |
use Symfony\Component\Process\Process; | |
class InstallerCommand extends Command | |
{ | |
protected static $defaultName = 'customize:install'; | |
use PluginCommandTrait; | |
protected function configure() | |
{ | |
$this | |
->setDescription('Load customize data fixtures to database.'); | |
} | |
protected function execute(InputInterface $input, OutputInterface $output) | |
{ | |
$io = new SymfonyStyle($input, $output); | |
$process = new Process('bin/console eccube:install -n'); | |
$process->mustRun(); | |
$io->text($process->getOutput()); | |
$finder = Finder::create() | |
->in(__DIR__ . '/Fixtures') | |
->name('*.sql'); | |
foreach ($finder->getIterator() as $fixture) { | |
$process = new Process('bin/console doctrine:database:import '.$fixture->getPathname()); | |
$process->mustRun(); | |
$io->text($process->getOutput()); | |
} | |
$this->clearCache($io); | |
$io->success('success.'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment