PHP Class Neos\ContentRepository\Domain\Service\ImportExport\NodeImportService

Internally, uses associative arrays instead of Domain Models for performance reasons, so "nodeData" in this class is always an associative array.
显示文件 Open project: neos/neos-development-collection Class Usage Examples

Protected Properties

Property Type Description
$entityManager Doctrine\Common\Persistence\ObjectManager ..
$nodeDataPropertyNames array For each element, an array of additional settings can be specified; currently the only setting is the following: - columnType => \PDO::PARAM_*
$nodeDataStack array
$nodeIdentifierStack array
$nodeNameStack array
$persistenceManager Neos\Flow\Persistence\PersistenceManagerInterface
$propertyMapper Neos\Flow\Property\PropertyMapper
$propertyMappingConfiguration ImportExportPropertyMappingConfiguration
$securityContext Neos\Flow\Security\Context

Public Methods

Method Description
import ( XMLReader $xmlReader, string $targetPath, string $resourceLoadPath = null ) : void Imports the sub-tree from the xml reader into the given target path.

Protected Methods

Method Description
convertElementToValue ( XMLReader $reader, string $currentType, string $currentEncoding, string $currentClassName, string $currentNodeIdentifier, string $currentProperty ) : mixed Convert an element to the value it represents.
determineFormatVersion ( XMLReader $xmlReader ) : null | string Determines the ContentRepository format version of the given xml
getCurrentPath ( ) : string Provides the path for a NodeData according to the current stacks
getParentPath ( string $path ) : string Provides the parent of the given path
importSubtree ( XMLReader $xmlReader ) : void Imports the sub-tree from the xml reader into the given target path.
parseArrayElements ( XMLReader $reader, string $elementName, string $currentNodeIdentifier ) : array Parses the content of exported array and returns the values
parseDimensionsElement ( XMLReader $reader ) : array Parses the content of the dimensions-tag and returns the dimensions as an array 'dimension name' => dimension value
parseElement ( XMLReader $xmlReader ) : void Parses the given XML element and adds its content to the internal content tree
parseEndElement ( XMLReader $reader ) : void Parses the closing tags writes data to the database then
parsePropertiesElement ( XMLReader $reader, string $currentNodeIdentifier ) : array Parses the content of the properties-tag and returns the properties as an array 'property name' => property value
persistEntities ( mixed $propertyValue ) : void Checks if a propertyValue contains an entity and persists it.
persistNodeData ( array $nodeData ) : void Saves the given array as a node data entity without using the ORM.

Method Details

convertElementToValue() protected method

Convert an element to the value it represents.
protected convertElementToValue ( XMLReader $reader, string $currentType, string $currentEncoding, string $currentClassName, string $currentNodeIdentifier, string $currentProperty ) : mixed
$reader XMLReader
$currentType string current element (userland) type
$currentEncoding string date encoding of element
$currentClassName string class name of element
$currentNodeIdentifier string identifier of the node
$currentProperty string current property name
return mixed

determineFormatVersion() protected method

Determines the ContentRepository format version of the given xml
protected determineFormatVersion ( XMLReader $xmlReader ) : null | string
$xmlReader XMLReader
return null | string the version as a string or null if the version could not be determined

getCurrentPath() protected method

Provides the path for a NodeData according to the current stacks
protected getCurrentPath ( ) : string
return string

getParentPath() protected method

Provides the parent of the given path
protected getParentPath ( string $path ) : string
$path string path to get parent for
return string parent path

import() public method

The root node of the imported tree becomes a child of the node specified as the target path, as the following example illustrates: 1. Existing Nodes Before Import: path - to - - my - - - targetNode - - - - A - other - - nodes 2. Sub-tree in xml to import to 'path/to/my/targetNode': - 3. existing nodes after the import: path - to - - my - - - targetNode - - - - A - - - - B - - - - - B1 - another - - sub-tree
public import ( XMLReader $xmlReader, string $targetPath, string $resourceLoadPath = null ) : void
$xmlReader XMLReader The XML input to import - must be either XML as a string or a prepared \XMLReader instance containing XML data
$targetPath string path to the node which becomes parent of the root of the imported sub-tree
$resourceLoadPath string
return void

importSubtree() protected method

The root node of the imported tree becomes a child of the node specified by target path. This parser uses the depth-first reading strategy, which means it will read the input from top til bottom.
protected importSubtree ( XMLReader $xmlReader ) : void
$xmlReader XMLReader A prepared XML Reader with the structure to import
return void

parseArrayElements() protected method

Parses the content of exported array and returns the values
protected parseArrayElements ( XMLReader $reader, string $elementName, string $currentNodeIdentifier ) : array
$reader XMLReader reader positioned just after an opening array-tag
$elementName string
$currentNodeIdentifier string
return array the array values

parseDimensionsElement() protected method

Parses the content of the dimensions-tag and returns the dimensions as an array 'dimension name' => dimension value
protected parseDimensionsElement ( XMLReader $reader ) : array
$reader XMLReader reader positioned just after an opening dimensions-tag
return array the dimension values

parseElement() protected method

Parses the given XML element and adds its content to the internal content tree
protected parseElement ( XMLReader $xmlReader ) : void
$xmlReader XMLReader The XML Reader with the element to be parsed as its root
return void

parseEndElement() protected method

Parses the closing tags writes data to the database then
protected parseEndElement ( XMLReader $reader ) : void
$reader XMLReader
return void

parsePropertiesElement() protected method

Parses the content of the properties-tag and returns the properties as an array 'property name' => property value
protected parsePropertiesElement ( XMLReader $reader, string $currentNodeIdentifier ) : array
$reader XMLReader reader positioned just after an opening properties-tag
$currentNodeIdentifier string
return array the properties

persistEntities() protected method

Checks if a propertyValue contains an entity and persists it.
protected persistEntities ( mixed $propertyValue ) : void
$propertyValue mixed
return void

persistNodeData() protected method

If the node data already exists (same dimensions, same identifier, same workspace) it is replaced.
protected persistNodeData ( array $nodeData ) : void
$nodeData array node data to save as an associative array ( $column_name => $value )
return void

Property Details

$entityManager protected_oe property

..
protected ObjectManager,Doctrine\Common\Persistence $entityManager
return Doctrine\Common\Persistence\ObjectManager

$nodeDataPropertyNames protected_oe property

For each element, an array of additional settings can be specified; currently the only setting is the following: - columnType => \PDO::PARAM_*
protected array $nodeDataPropertyNames
return array

$nodeDataStack protected_oe property

protected array $nodeDataStack
return array

$nodeIdentifierStack protected_oe property

protected array $nodeIdentifierStack
return array

$nodeNameStack protected_oe property

protected array $nodeNameStack
return array

$persistenceManager protected_oe property

protected PersistenceManagerInterface,Neos\Flow\Persistence $persistenceManager
return Neos\Flow\Persistence\PersistenceManagerInterface

$propertyMapper protected_oe property

protected PropertyMapper,Neos\Flow\Property $propertyMapper
return Neos\Flow\Property\PropertyMapper

$propertyMappingConfiguration protected_oe property

protected ImportExportPropertyMappingConfiguration,Neos\ContentRepository\Domain\Service\ImportExport $propertyMappingConfiguration
return ImportExportPropertyMappingConfiguration

$securityContext protected_oe property

protected Context,Neos\Flow\Security $securityContext
return Neos\Flow\Security\Context