src/Sulu/Bundle/PageBundle/Resources/phpcr-migrations/Version201511240843.php
private function upgradeBlockProperty(
        BlockMetadata $blockProperty,
        array $components,
        NodeInterface $node,
        $locale,
        $up
    ) {
        $componentNames = array_map(
            function($item) {
                return $item['component']->getName();
            },
            $components
        );

        $lengthName = sprintf('i18n:%s-%s-length', $locale, $blockProperty->getName());
        $length = $node->getPropertyValue($lengthName);

        for ($i = 0; $i < $length; ++$i) {
            $type = $node->getPropertyValue(sprintf('i18n:%s-%s-type#%s', $locale, $blockProperty->getName(), $i));

            if (!in_array($type, $componentNames)) {
                continue;
            }

            foreach ($components[$type]['children'] as $child) {
                $name = sprintf('i18n:%s-%s-%s#%s', $locale, $blockProperty->getName(), $child->getName(), $i);
                if (!$node->hasProperty($name)) {
                    continue;
                }

                $value = $node->getPropertyValue($name);

                if ($up) {
                    $value = $this->upgradeDate($value);
                } else {
                    $value = $this->downgradeDate($value);
                }

                $node->setProperty($name, $value);
            }
        }
    }
private function upgradeBlockProperty(
        BlockMetadata $blockProperty,
        array $components,
        NodeInterface $node,
        $locale,
        $up
    ) {
        $componentNames = array_map(
            function($item) {
                return $item['component']->getName();
            },
            $components
        );

        $lengthName = sprintf('i18n:%s-%s-length', $locale, $blockProperty->getName());
        $length = $node->getPropertyValue($lengthName);

        for ($i = 0; $i < $length; ++$i) {
            $type = $node->getPropertyValue(sprintf('i18n:%s-%s-type#%s', $locale, $blockProperty->getName(), $i));

            if (!in_array($type, $componentNames)) {
                continue;
            }

            foreach ($components[$type]['children'] as $child) {
                $name = sprintf('i18n:%s-%s-%s#%s', $locale, $blockProperty->getName(), $child->getName(), $i);
                if (!$node->hasProperty($name)) {
                    continue;
                }

                $value = $node->getPropertyValue($name);

                if ($up) {
                    $value = $this->upgradeDate($value);
                } else {
                    $value = $this->downgradeDate($value);
                }

                $node->setProperty($name, $value);
            }
        }
    }
private function upgradeBlockProperty ( BlockMetadata $ blockProperty , array $ components , NodeInterface $ node , $ locale , $ up ) { $ componentNames = array_map ( function ( $ item ) { return $ item [ 'component' ] -> getName ( ) ; } , $ components ) ; $ lengthName = sprintf ( 'i18n:%s-%s-length' , $ locale , $ blockProperty -> getName ( ) ) ; $ length = $ node -> getPropertyValue ( $ lengthName ) ; for ( $ i = 0 ; $ i < $ length ; ++ $ i ) { $ type = $ node -> getPropertyValue ( sprintf ( 'i18n:%s-%s-type#%s' , $ locale , $ blockProperty -> getName ( ) , $ i ) ) ; if ( ! in_array ( $ type , $ componentNames ) ) { continue ; } foreach ( $ components [ $ type ] [ 'children' ] as $ child ) { $ name = sprintf ( 'i18n:%s-%s-%s#%s' , $ locale , $ blockProperty -> getName ( ) , $ child -> getName ( ) , $ i ) ; if ( ! $ node -> hasProperty ( $ name ) ) { continue ; } $ value = $ node -> getPropertyValue ( $ name ) ; if ( $ up ) { $ value = $ this -> upgradeDate ( $ value ) ; } else { $ value = $ this -> downgradeDate ( $ value ) ; } $ node -> setProperty ( $ name , $ value ) ; } } }
Upgrades the given block property to the new date representation.

@param BlockMetadata $blockProperty
@param array $components
@param NodeInterface $node
@param string $locale
@param bool $up
Upgrades the given block property to the new date representation .