public function processRecord(NodeTemplate $nodeTemplate, array $data)
    {
        $this->unsetAllNodeTemplateProperties($nodeTemplate);

        $externalIdentifier = $this->getExternalIdentifierFromRecordData($data);
        $nodeName = $this->renderNodeName($externalIdentifier);
        if (!isset($data['uriPathSegment'])) {
            $data['uriPathSegment'] = Slug::create($this->getLabelFromRecordData($data))->getValue();
        }

        $recordMapping = $this->getNodeProcessing($externalIdentifier);
        if ($recordMapping !== null) {
            $node = $this->storageNode->getContext()->getNodeByIdentifier($recordMapping->getNodeIdentifier());
            if ($node === null) {
                throw new \Exception(sprintf('Failed retrieving existing node for update. External identifier: %s Node identifier: %s. Maybe the record mapping in the database does not match the existing (imported) nodes anymore.', $externalIdentifier, $recordMapping->getNodeIdentifier()), 1462971366085);
            }
            $this->applyProperties($this->getPropertiesFromDataProviderPayload($data), $node);

        } else {
            $nodeTemplate->setNodeType($this->nodeType);
            $nodeTemplate->setName($nodeName);
            $this->applyProperties($this->getPropertiesFromDataProviderPayload($data), $nodeTemplate);

            $node = $this->createNodeFromTemplate($nodeTemplate, $data);
            $this->registerNodeProcessing($node, $externalIdentifier);
        }

        $this->dimensionsImporter->process($node, $this->getPropertiesFromDataProviderPayload($data), $this->currentEvent);

        return $node;
    }
public function processRecord(NodeTemplate $nodeTemplate, array $data)
    {
        $this->unsetAllNodeTemplateProperties($nodeTemplate);

        $externalIdentifier = $this->getExternalIdentifierFromRecordData($data);
        $nodeName = $this->renderNodeName($externalIdentifier);
        if (!isset($data['uriPathSegment'])) {
            $data['uriPathSegment'] = Slug::create($this->getLabelFromRecordData($data))->getValue();
        }

        $recordMapping = $this->getNodeProcessing($externalIdentifier);
        if ($recordMapping !== null) {
            $node = $this->storageNode->getContext()->getNodeByIdentifier($recordMapping->getNodeIdentifier());
            if ($node === null) {
                throw new \Exception(sprintf('Failed retrieving existing node for update. External identifier: %s Node identifier: %s. Maybe the record mapping in the database does not match the existing (imported) nodes anymore.', $externalIdentifier, $recordMapping->getNodeIdentifier()), 1462971366085);
            }
            $this->applyProperties($this->getPropertiesFromDataProviderPayload($data), $node);

        } else {
            $nodeTemplate->setNodeType($this->nodeType);
            $nodeTemplate->setName($nodeName);
            $this->applyProperties($this->getPropertiesFromDataProviderPayload($data), $nodeTemplate);

            $node = $this->createNodeFromTemplate($nodeTemplate, $data);
            $this->registerNodeProcessing($node, $externalIdentifier);
        }

        $this->dimensionsImporter->process($node, $this->getPropertiesFromDataProviderPayload($data), $this->currentEvent);

        return $node;
    }
public function processRecord ( NodeTemplate $ nodeTemplate , array $ data ) { $ this -> unsetAllNodeTemplateProperties ( $ nodeTemplate ) ; $ externalIdentifier = $ this -> getExternalIdentifierFromRecordData ( $ data ) ; $ nodeName = $ this -> renderNodeName ( $ externalIdentifier ) ; if ( ! isset ( $ data [ 'uriPathSegment' ] ) ) { $ data [ 'uriPathSegment' ] = Slug :: create ( $ this -> getLabelFromRecordData ( $ data ) ) -> getValue ( ) ; } $ recordMapping = $ this -> getNodeProcessing ( $ externalIdentifier ) ; if ( $ recordMapping !== null ) { $ node = $ this -> storageNode -> getContext ( ) -> getNodeByIdentifier ( $ recordMapping -> getNodeIdentifier ( ) ) ; if ( $ node === null ) { throw new \ Exception ( sprintf ( 'Failed retrieving existing node for update. External identifier: %s Node identifier: %s. Maybe the record mapping in the database does not match the existing (imported) nodes anymore.' , $ externalIdentifier , $ recordMapping -> getNodeIdentifier ( ) ) , 1462971366085 ) ; } $ this -> applyProperties ( $ this -> getPropertiesFromDataProviderPayload ( $ data ) , $ node ) ; } else { $ nodeTemplate -> setNodeType ( $ this -> nodeType ) ; $ nodeTemplate -> setName ( $ nodeName ) ; $ this -> applyProperties ( $ this -> getPropertiesFromDataProviderPayload ( $ data ) , $ nodeTemplate ) ; $ node = $ this -> createNodeFromTemplate ( $ nodeTemplate , $ data ) ; $ this -> registerNodeProcessing ( $ node , $ externalIdentifier ) ; } $ this -> dimensionsImporter -> process ( $ node , $ this -> getPropertiesFromDataProviderPayload ( $ data ) , $ this -> currentEvent ) ; return $ node ; }
Processes a single record

Override this method if you need a different approach.

@param NodeTemplate $nodeTemplate
@param array $data
@return NodeInterface
@throws \Exception
@api
Processes a single record