/** * Returns the absolute path of this node with additional context information (such as the workspace name). * * Example: /sites/mysitecom/homepage/about@user-admin * * @return string Node path with context information */ public function getContextPath() { return NodePaths::generateContextPath($this->path, $this->workspace->getName(), $this->getDimensionValues()); }
/** * Generate missing URI path segments * * This generates URI path segment properties for all document nodes which don't have * a path segment set yet. * * @param string $workspaceName * @param boolean $dryRun * @return void */ public function generateUriPathSegments($workspaceName, $dryRun) { $baseContext = $this->createContext($workspaceName, []); $baseContextSiteNodes = $baseContext->getNode('/sites')->getChildNodes(); if ($baseContextSiteNodes === []) { return; } foreach ($this->dimensionCombinator->getAllAllowedCombinations() as $dimensionCombination) { $flowQuery = new FlowQuery($baseContextSiteNodes); $siteNodes = $flowQuery->context(['dimensions' => $dimensionCombination, 'targetDimensions' => []])->get(); if (count($siteNodes) > 0) { $this->output->outputLine('Searching for nodes with missing URI path segment in dimension "%s"', array(trim(NodePaths::generateContextPath('', '', $dimensionCombination), '@;'))); foreach ($siteNodes as $siteNode) { $this->generateUriPathSegmentsForNode($siteNode, $dryRun); } } } }
/** * Returns the absolute path of this node with additional context information (such as the workspace name). * * Example: /sites/mysitecom/homepage/about@user-admin * * @return string Node path with context information * @api */ public function getContextPath() { return NodePaths::generateContextPath($this->getPath(), $this->context->getWorkspaceName(), $this->context->getDimensions()); }
/** * Generate missing URI path segments * * This generates URI path segment properties for all document nodes which don't have * a path segment set yet. * * @param string $workspaceName * @param boolean $dryRun * @return void */ public function generateUriPathSegments($workspaceName, $dryRun) { $baseContext = $this->createContext($workspaceName, []); $baseContextSitesNode = $baseContext->getNode(SiteService::SITES_ROOT_PATH); if (!$baseContextSitesNode) { $this->output->outputLine('<error>Could not find "' . SiteService::SITES_ROOT_PATH . '" root node</error>'); return; } $baseContextSiteNodes = $baseContextSitesNode->getChildNodes(); if ($baseContextSiteNodes === []) { $this->output->outputLine('<error>Could not find any site nodes in "' . SiteService::SITES_ROOT_PATH . '" root node</error>'); return; } foreach ($this->dimensionCombinator->getAllAllowedCombinations() as $dimensionCombination) { $flowQuery = new FlowQuery($baseContextSiteNodes); $siteNodes = $flowQuery->context(['dimensions' => $dimensionCombination, 'targetDimensions' => []])->get(); if (count($siteNodes) > 0) { $this->output->outputLine('Checking for nodes with missing URI path segment in dimension "%s"', array(trim(NodePaths::generateContextPath('', '', $dimensionCombination), '@;'))); foreach ($siteNodes as $siteNode) { $this->generateUriPathSegmentsForNode($siteNode, $dryRun); } } } $this->persistenceManager->persistAll(); }