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');
}