public function createWorkspace($name, $srcWorkspace = null)
{
if (null !== $srcWorkspace) {
throw new NotImplementedException('Creating workspace as clone of existing workspace not supported');
}
if ($this->workspaceExists($name)) {
throw new RepositoryException("Workspace '{$name}' already exists");
}
try {
$this->getConnection()->insert('phpcr_workspaces', array('name' => $name));
} catch (\Exception $e) {
throw new RepositoryException("Couldn't create Workspace '{$name}': " . $e->getMessage(), 0, $e);
}
$this->getConnection()->insert('phpcr_nodes', array('path' => '/', 'parent' => '', 'workspace_name' => $name, 'identifier' => $this->generateUuid(), 'type' => 'nt:unstructured', 'local_name' => '', 'namespace' => '', 'props' => '<?xml version="1.0" encoding="UTF-8"?>
<sv:node xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:rep="internal" />', 'depth' => 0));
}