public function registerNamespace($prefix, $uri)
{
if (isset($this->namespaces[$prefix])) {
if ($this->namespaces[$prefix] === $uri) {
return;
}
if (isset($this->coreNamespaces[$prefix])) {
throw new NamespaceException("Cannot overwrite JCR core namespace prefix '{$prefix}' to a new uri '{$uri}'.");
}
}
$this->ensureNamespacesBackup();
$this->getConnection()->delete('phpcr_namespaces', array('prefix' => $prefix));
$this->getConnection()->delete('phpcr_namespaces', array('uri' => $uri));
$this->getConnection()->insert('phpcr_namespaces', array('prefix' => $prefix, 'uri' => $uri));
if (!empty($this->namespaces)) {
$this->namespaces[$prefix] = $uri;
}
}