Neos\Neos\Domain\Model\Site::setNodeName PHP Метод

setNodeName() публичный Метод

Sets the node name for this site
public setNodeName ( string $nodeName ) : void
$nodeName string The site node name
Результат void
    public function setNodeName($nodeName)
    {
        $this->nodeName = $nodeName;
    }

Usage Example

 /**
  * Update a site
  *
  * @param Site $site A site to update
  * @param string $newSiteNodeName A new site node name
  * @return void
  * @Flow\Validate(argumentName="$site", type="UniqueEntity")
  * @Flow\Validate(argumentName="$newSiteNodeName", type="NotEmpty")
  * @Flow\Validate(argumentName="$newSiteNodeName", type="StringLength", options={ "minimum"=1, "maximum"=250 })
  * @Flow\Validate(argumentName="$newSiteNodeName", type="Neos.Neos:NodeName")
  */
 public function updateSiteAction(Site $site, $newSiteNodeName)
 {
     if ($site->getNodeName() !== $newSiteNodeName) {
         $oldSiteNodePath = NodePaths::addNodePathSegment(SiteService::SITES_ROOT_PATH, $site->getNodeName());
         $newSiteNodePath = NodePaths::addNodePathSegment(SiteService::SITES_ROOT_PATH, $newSiteNodeName);
         /** @var $workspace Workspace */
         foreach ($this->workspaceRepository->findAll() as $workspace) {
             $siteNode = $this->nodeDataRepository->findOneByPath($oldSiteNodePath, $workspace);
             if ($siteNode !== null) {
                 $siteNode->setPath($newSiteNodePath);
             }
         }
         $site->setNodeName($newSiteNodeName);
         $this->nodeDataRepository->persistEntities();
     }
     $this->siteRepository->update($site);
     $this->addFlashMessage('The site "%s" has been updated.', 'Update', null, array(htmlspecialchars($site->getName())), 1412371798);
     $this->unsetLastVisitedNodeAndRedirect('index');
 }