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');
}
/** * {@inheritDoc} * * @api */ public function registerNodeTypes(array $definitions, $allowUpdate) { $nts = array(); // prepare them first (all or nothing) foreach ($definitions as $definition) { $nts[$definition->getName()] = $this->createNodeType($definition, $allowUpdate); } $this->objectManager->registerNodeTypes($definitions, $allowUpdate); // no need to fetch the node types as with cnd, we already have the def and can // now register them ourselves foreach ($nts as $nt) { $this->addNodeType($nt); } return new ArrayIterator($nts); }