Example #1
0
 /**
  * Register node types with the backend.
  *
  * This is only a proxy to the transport
  *
  * @param array $definitions an array of NodeTypeDefinitions
  * @param boolean $allowUpdate whether to fail if node already exists or to
  *      update it
  *
  * @return bool true on success
  */
 public function registerNodeTypes($types, $allowUpdate)
 {
     if (!$this->transport instanceof NodeTypeManagementInterface) {
         if ($this->transport instanceof NodeTypeCndManagementInterface) {
             throw new UnsupportedRepositoryOperationException('TODO: serialize the node types to cnd');
         }
         throw new UnsupportedRepositoryOperationException('Transport does not support registering node types');
     }
     return $this->transport->registerNodeTypes($types, $allowUpdate);
 }
Example #2
0
 /**
  * Register node types with the backend.
  *
  * This is only a proxy to the transport
  *
  * @param array   $types       an array of NodeTypeDefinitions
  * @param boolean $allowUpdate whether to fail if node already exists or to
  *      update it
  *
  * @return bool true on success
  */
 public function registerNodeTypes($types, $allowUpdate)
 {
     if ($this->transport instanceof NodeTypeManagementInterface) {
         return $this->transport->registerNodeTypes($types, $allowUpdate);
     }
     if ($this->transport instanceof NodeTypeCndManagementInterface) {
         $writer = new CndWriter($this->session->getWorkspace()->getNamespaceRegistry());
         return $this->transport->registerNodeTypesCnd($writer->writeString($types), $allowUpdate);
     }
     throw new UnsupportedRepositoryOperationException('Transport does not support registering node types');
 }