Пример #1
0
 protected function getTransport()
 {
     $transport = new \Jackalope\Transport\DoctrineDBAL\Client(new \Jackalope\Factory(), $this->getConnection());
     try {
         $transport->createWorkspace($GLOBALS['phpcr.workspace']);
     } catch (\PHPCR\RepositoryException $e) {
         if ($e->getMessage() != "Workspace '" . $GLOBALS['phpcr.workspace'] . "' already exists") {
             // if the message is not that the workspace already exists, something went really wrong
             throw $e;
         }
     }
     $transport->login(new \PHPCR\SimpleCredentials("user", "passwd"), $GLOBALS['phpcr.workspace']);
     return $transport;
 }
 public function getRepository()
 {
     $transport = new \Jackalope\Transport\DoctrineDBAL\Client(new \Jackalope\Factory(), $this->connection);
     foreach (array($GLOBALS['phpcr.workspace'], $this->otherWorkspacename) as $workspace) {
         try {
             $transport->createWorkspace($workspace);
         } catch (\PHPCR\RepositoryException $e) {
             if ($e->getMessage() != "Workspace '{$workspace}' already exists") {
                 // if the message is not that the workspace already exists, something went really wrong
                 throw $e;
             }
         }
     }
     return new \Jackalope\Repository(null, $transport, $this->getRepositoryFactoryParameters());
 }