Skip to content
dantleech edited this page Oct 11, 2014 · 2 revisions

Migration command

export SULUMIXINNAME="sulu:path"
export SULUTARGETTYPE="sulu:structureroute1"
./app/console doctrine:phpcr:node:update --query "SELECT * FROM [nt:unstructured] WHERE [jcr:mixinTypes] = '$SULUMIXINNAME'" --apply-closure "\$originalPath = \$node->getPath(); echo basename(\$originalPath); if (basename(\$originalPath) == '') { return; }; \$session->move(\$node->getPath(), \$node->getPath() . '-old'); \$session->save(); \$session->refresh(false); \$parent = \$session->getNode(dirname(\$originalPath)); \$newNode = \$parent->addNode(basename(\$originalPath), '$SULUTARGETTYPE'); \$session->save(); foreach (\$node->getProperties() as \$name => \$prop) { if (\$name === 'jcr:uuid' || \$name === 'jcr:primaryType') { continue; }; \$newNode->setProperty(\$name, \$prop->getValue()); }; foreach (\$node->getNodes() as \$name => \$child) { \$session->move(\$child->getPath(), \$newNode->getPath() . '/' . \$name); }; foreach (\$newNode->getReferences() as \$refProp) { \$refProp->setValue(\$newNode->getIdentifier()); }; \$node->setProperty('__fuckcontent', 'fuck'); \$session->save();"