Example #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');
 }
Example #2
0
 /**
  * @param SessionInterface $session
  */
 public function addSession(SessionInterface $session)
 {
     $this->sessions->add($session);
 }
Example #3
0
 /**
  * @inheritdoc
  */
 public function removeSession(SessionInterface $session)
 {
     if ($this->sessions->contains($session)) {
         $this->sessions->removeElement($session);
         $session->removeTerm($this);
     }
 }
Example #4
0
 /**
  * @param SessionInterface $session
  */
 public function removeAdministeredSession(SessionInterface $session)
 {
     $this->administeredSessions->removeElement($session);
     $session->removeAdministrator($this);
 }