partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

UpdateConfigCommand.php (929B)


      1 <?php
      2 
      3 namespace PartKeepr\SetupBundle\Command;
      4 
      5 use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
      6 use Symfony\Component\Console\Input\InputInterface;
      7 use Symfony\Component\Console\Output\OutputInterface;
      8 
      9 class UpdateConfigCommand extends ContainerAwareCommand
     10 {
     11     public function configure()
     12     {
     13         parent::configure();
     14         $this->setName('partkeepr:setup:update-config');
     15         $this->setDescription('Updates the PartKeepr configuration with all required config parameters');
     16     }
     17 
     18     public function execute(InputInterface $input, OutputInterface $output)
     19     {
     20         $configService = $this->getContainer()->get('partkeepr.setup.config_service');
     21         $config = $configService->configParser();
     22         $configOutput = $configService->getConfig($config);
     23 
     24         file_put_contents($configService->getConfigPath(false), $configOutput);
     25         $output->writeln('Config updated');
     26     }
     27 }