protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->instances->lock();
     $container = $this->getContainer();
     $mysql_type = $container->getParameter('mysql_type');
     if ($mysql_type == "") {
         $this->doCommand($output, OutputInterface::VERBOSITY_NORMAL, 'config', array());
         $this->getApplication()->loadContainer();
         $this->instances = $this->getContainer()->get('instances');
     }
     $instance = $this->instances->find(Instance::makeId($input->getOption('root'), $input->getOption('name')));
     if ($instance === NULL) {
         $instance = new Instance();
         $instance->setRoot($input->getOption('root'));
         $instance->setName($input->getOption('name'));
     } elseif (!$input->getOption('force')) {
         throw new \Exception("Cannot create instance. Use -f to overwrite existing instance.");
     }
     if ($input->getOption('url')) {
         $instance->setUrl($input->getOption('url'));
     }
     $this->instances->create($instance, !$input->getOption('skip-url'), !$input->getOption('skip-db'), $input->getOption('perm'));
     $this->instances->save();
     if ($output->getVerbosity() > OutputInterface::VERBOSITY_QUIET) {
         $this->export($instance->getRoot(), $instance->getName(), $input->getOption('prefix'), $input->getOption('output-file'), $output);
     }
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->instances->lock();
     $instance = $this->instances->find(Instance::makeId($input->getOption('root'), $input->getOption('name')));
     if (!$instance) {
         return;
     }
     $this->instances->remove($instance->getId());
     $this->instances->save();
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->instances->lock();
     $count = 0;
     foreach ($this->instances->findAll() as $instance) {
         if ($input->getOption('force') || !file_exists($instance->getRoot())) {
             $output->writeln("Destroy (root={$instance->getRoot()}, name={$instance->getName()}, dsn={$instance->getDsn()})");
             $this->instances->remove($instance->getId());
             $count++;
         } else {
             $output->writeln("Skip (root={$instance->getRoot()}, name={$instance->getName()}, dsn={$instance->getDsn()})");
         }
     }
     $output->writeln("Destroyed {$count} instance(s)");
     $this->instances->save();
 }