Jackalope\Transport\DoctrineDBAL\Client::workspaceExists PHP Method

workspaceExists() protected method

protected workspaceExists ( $workspaceName )
    protected function workspaceExists($workspaceName)
    {
        try {
            $query = 'SELECT 1 FROM phpcr_workspaces WHERE name = ?';
            $result = $this->getConnection()->fetchColumn($query, array($workspaceName));
        } catch (\Exception $e) {
            if ($e instanceof DBALException || $e instanceof \PDOException) {
                if (1045 == $e->getCode()) {
                    throw new LoginException('Access denied with your credentials: ' . $e->getMessage());
                }
                if ('42S02' == $e->getCode()) {
                    throw new RepositoryException('You did not properly set up the database for the repository. See README.md for more information. Message from backend: ' . $e->getMessage());
                }
                throw new RepositoryException('Unexpected error talking to the backend: ' . $e->getMessage(), 0, $e);
            }
            throw $e;
        }
        return $result;
    }

Usage Example

Example #1
0
 /**
  * {@inheritDoc}
  */
 protected function workspaceExists($workspaceName)
 {
     $cacheKey = "workspace: {$workspaceName}";
     $result = $this->caches['meta']->fetch($cacheKey);
     if (!$result && parent::workspaceExists($workspaceName)) {
         $result = 1;
         $this->caches['meta']->save($cacheKey, $result);
     }
     return $result;
 }