Neos.ContentRepository/Classes/Migration/Transformations/AddDimensions.php
public function execute(NodeData $node)
    {
        $dimensionValuesToBeAdded = $node->getDimensionValues();

        foreach ($this->dimensionValues as $dimensionName => $dimensionValues) {
            if (!isset($dimensionValuesToBeAdded[$dimensionName])) {
                if (is_array($dimensionValues)) {
                    $dimensionValuesToBeAdded[$dimensionName] = $dimensionValues;
                } else {
                    $dimensionValuesToBeAdded[$dimensionName] = [$dimensionValues];
                }
            }
        }

        if ($this->addDefaultDimensionValues === true) {
            $configuredDimensions = $this->contentDimensionRepository->findAll();
            foreach ($configuredDimensions as $configuredDimension) {
                if (!isset($dimensionValuesToBeAdded[$configuredDimension->getIdentifier()])) {
                    $dimensionValuesToBeAdded[$configuredDimension->getIdentifier()] = [$configuredDimension->getDefault()];
                }
            }
        }

        $dimensionsToBeSet = [];
        foreach ($dimensionValuesToBeAdded as $dimensionName => $dimensionValues) {
            foreach ($dimensionValues as $dimensionValue) {
                $dimensionsToBeSet[] = new NodeDimension($node, $dimensionName, $dimensionValue);
            }
        }

        $node->setDimensions($dimensionsToBeSet);
    }
public function execute(NodeData $node)
    {
        $dimensionValuesToBeAdded = $node->getDimensionValues();

        foreach ($this->dimensionValues as $dimensionName => $dimensionValues) {
            if (!isset($dimensionValuesToBeAdded[$dimensionName])) {
                if (is_array($dimensionValues)) {
                    $dimensionValuesToBeAdded[$dimensionName] = $dimensionValues;
                } else {
                    $dimensionValuesToBeAdded[$dimensionName] = [$dimensionValues];
                }
            }
        }

        if ($this->addDefaultDimensionValues === true) {
            $configuredDimensions = $this->contentDimensionRepository->findAll();
            foreach ($configuredDimensions as $configuredDimension) {
                if (!isset($dimensionValuesToBeAdded[$configuredDimension->getIdentifier()])) {
                    $dimensionValuesToBeAdded[$configuredDimension->getIdentifier()] = [$configuredDimension->getDefault()];
                }
            }
        }

        $dimensionsToBeSet = [];
        foreach ($dimensionValuesToBeAdded as $dimensionName => $dimensionValues) {
            foreach ($dimensionValues as $dimensionValue) {
                $dimensionsToBeSet[] = new NodeDimension($node, $dimensionName, $dimensionValue);
            }
        }

        $node->setDimensions($dimensionsToBeSet);
    }
public function execute ( NodeData $ node ) { $ dimensionValuesToBeAdded = $ node -> getDimensionValues ( ) ; foreach ( $ this -> dimensionValues as $ dimensionName => $ dimensionValues ) { if ( ! isset ( $ dimensionValuesToBeAdded [ $ dimensionName ] ) ) { if ( is_array ( $ dimensionValues ) ) { $ dimensionValuesToBeAdded [ $ dimensionName ] = $ dimensionValues ; } else { $ dimensionValuesToBeAdded [ $ dimensionName ] = [ $ dimensionValues ] ; } } } if ( $ this -> addDefaultDimensionValues === true ) { $ configuredDimensions = $ this -> contentDimensionRepository -> findAll ( ) ; foreach ( $ configuredDimensions as $ configuredDimension ) { if ( ! isset ( $ dimensionValuesToBeAdded [ $ configuredDimension -> getIdentifier ( ) ] ) ) { $ dimensionValuesToBeAdded [ $ configuredDimension -> getIdentifier ( ) ] = [ $ configuredDimension -> getDefault ( ) ] ; } } } $ dimensionsToBeSet = [ ] ; foreach ( $ dimensionValuesToBeAdded as $ dimensionName => $ dimensionValues ) { foreach ( $ dimensionValues as $ dimensionValue ) { $ dimensionsToBeSet [ ] = new NodeDimension ( $ node , $ dimensionName , $ dimensionValue ) ; } } $ node -> setDimensions ( $ dimensionsToBeSet ) ; }
Add dimensions to the node.

@param NodeData $node
@return void
Add dimensions to the node .