Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function initialize(OutputInterface $output, $purge = false)
 {
     if (!$purge) {
         $output->writeln('  [ ] Purging workspaces');
         return;
     }
     $sessions = $this->connections->getConnections();
     $rootPath = '/' . $this->pathSegments->getPathSegment($this->rootRole);
     foreach ($sessions as $session) {
         try {
             $session->getRootNode();
         } catch (RepositoryException $e) {
             // TODO: We should catch the more explicit
             // WorkspaceNotFoundException but Jackalope doctrine-dbal does
             // not throw this: https://github.com/jackalope/jackalope-doctrine-dbal/issues/322
             continue;
         }
         if ($session->nodeExists($rootPath)) {
             $session->getNode($rootPath)->remove();
             $session->save();
         }
     }
     $output->writeln('  [-] Purging workspaces');
 }