Can purge and initialize the content repository using any number of registered *initializers*. Initializers should be designed to be idempotent - they should not do anything to change the state of the repository beyond their initial changes: https://en.wikipedia.org/wiki/Idempotent
Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $purge = $input->getOption('purge');
     $force = $input->getOption('force');
     if ($purge && false === $force) {
         $question = new ConfirmationQuestion('<question>Are you sure you want to purge ALL the configured workspaces?</>', false);
         if (false === $this->questionHelper->ask($input, $output, $question)) {
             $output->writeln('Cancelled');
             return;
         }
     }
     $this->initializer->initialize($output, $purge);
 }
Exemplo n.º 2
0
 /**
  * Load the given fixture classes.
  *
  * @param array           $fixtures
  * @param mixed           $purge
  * @param mixed           $initialize
  * @param OutputInterface $output
  */
 public function execute(array $fixtures, $purge = true, $initialize = true, OutputInterface $output = null)
 {
     $output = $output ?: new NullOutput();
     if (true === $initialize) {
         $output->writeln('<comment>Initializing repository</comment>');
         $this->initializer->initialize($output, $purge);
     }
     $output->writeln('<comment>Loading fixtures</comment>');
     foreach ($fixtures as $fixture) {
         $output->writeln(sprintf(' - %s<info>loading "</info>%s<info>"</info>', $fixture instanceof OrderedFixtureInterface ? '[' . $fixture->getOrder() . ']' : '', get_class($fixture)));
         $fixture->load($this->documentManager);
         $this->documentManager->clear();
     }
 }