class NodeConverter extends NodeConverter (View source)

An Object Converter for nodes which can be used for routing (but also for other purposes) as a plugin for the Property Mapper.

Constants

REMOVED_CONTENT_SHOWN

INVISIBLE_CONTENT_SHOWN

Properties

protected array $sourceTypes from  NodeConverter
protected Context $securityContext from  NodeConverter
protected ObjectManagerInterface $objectManager from  NodeConverter
protected PropertyMapper $propertyMapper from  NodeConverter
protected ContextFactoryInterface $contextFactory from  NodeConverter
protected NodeFactory $nodeFactory from  NodeConverter
protected NodeTypeManager $nodeTypeManager from  NodeConverter
protected NodeServiceInterface $nodeService from  NodeConverter
protected string $targetType from  NodeConverter
protected int $priority
protected DomainRepository $domainRepository
protected SiteRepository $siteRepository

Methods

mixed
convertFrom(string|array $source, string $targetType, array $subProperties = [], PropertyMappingConfigurationInterface $configuration = null)

Converts the specified $source into a Node.

void
setNodeProperties(object $nodeLike, NodeType $nodeType, array $properties, Context $context, PropertyMappingConfigurationInterface $configuration = null)

Iterates through the given $properties setting them on the specified $node using the appropriate TypeConverters.

array
prepareContextProperties(string $workspaceName, PropertyMappingConfigurationInterface $configuration = null, array $dimensions = null)

Prepares the context properties for the nodes based on the given workspace and dimensions

Details

mixed convertFrom(string|array $source, string $targetType, array $subProperties = [], PropertyMappingConfigurationInterface $configuration = null)

Converts the specified $source into a Node.

If $source is a UUID it is expected to refer to the identifier of a NodeData record of the "live" workspace

Otherwise $source has to be a valid node path:

The node path must be an absolute context node path and can be specified as a string or as an array item with the key "__contextNodePath". The latter case is for updating existing nodes.

This conversion method does not support / allow creation of new nodes because new nodes should be created through the createNode() method of an existing reference node.

Also note that the context's "current node" is not affected by this object converter, you will need to set it to whatever node your "current" node is, if any.

All elements in the source array which start with two underscores (like __contextNodePath) are specially treated by this converter.

All elements in the source array which start with a single underscore (like _hidden) are directly* set on the Node object.

All other elements, not being prefixed with underscore, are properties of the node.

Parameters

string|array $source

Either a string or array containing the absolute context node path which identifies the node. For example "/sites/mysitecom/homepage/about@user-admin"

string $targetType

not used

array $subProperties

not used

PropertyMappingConfigurationInterface $configuration

Return Value

mixed

An object or \Neos\Error\Messages\Error if the input format is not supported or could not be converted for other reasons

Exceptions

NodeException

protected void setNodeProperties(object $nodeLike, NodeType $nodeType, array $properties, Context $context, PropertyMappingConfigurationInterface $configuration = null)

Iterates through the given $properties setting them on the specified $node using the appropriate TypeConverters.

Parameters

object $nodeLike
NodeType $nodeType
array $properties
Context $context
PropertyMappingConfigurationInterface $configuration

Return Value

void

Exceptions

TypeConverterException

protected array prepareContextProperties(string $workspaceName, PropertyMappingConfigurationInterface $configuration = null, array $dimensions = null)

Prepares the context properties for the nodes based on the given workspace and dimensions

Parameters

string $workspaceName
PropertyMappingConfigurationInterface $configuration
array $dimensions

Return Value

array