O4DOIXmlFilter::createRelatedNode PHP Method

createRelatedNode() public method

Create a related work or product node.
public createRelatedNode ( $doc, $workOrProduct, $relationCode, $ids ) : DOMElement
$doc DOMDocument
$workOrProduct string
$relationCode string One of the O4DOI_RELATION_* constants.
$ids array
return DOMElement
    function createRelatedNode($doc, $workOrProduct, $relationCode, $ids)
    {
        $deployment = $this->getDeployment();
        $relatedNode = $doc->createElementNS($deployment->getNamespace(), "Related{$workOrProduct}");
        // Relation code (mandatory)
        $relatedNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(), 'RelationCode', $relationCode));
        // Work/Product ID (mandatory)
        foreach ($ids as $idType => $id) {
            $relatedNode->appendChild($this->createIdentifierNode($doc, $workOrProduct, $idType, $id));
        }
        return $relatedNode;
    }