/** * {@inheritDoc} * * @api */ public function registerNamespace($prefix, $uri) { if (!$this->transport instanceof WritingInterface) { throw new UnsupportedRepositoryOperationException('Transport does not support writing'); } // prevent default namespace prefixes to be overridden. $this->checkPrefix($prefix); // prevent default namespace uris to be overridden if (false !== array_search($uri, $this->defaultNamespaces)) { throw new NamespaceException("Can not change default namespace {$prefix} = {$uri}"); } $this->lazyLoadNamespaces(); //first try putting the stuff in backend, and only afterwards update lokal info // this has no impact on running sessions, go directly to storage $this->transport->registerNamespace($prefix, $uri); // update local info if (false !== ($oldpref = array_search($uri, $this->userNamespaces))) { // the backend takes care of storing this, but we have to update frontend info unset($this->userNamespaces[$oldpref]); } $this->userNamespaces[$prefix] = $uri; }