Deduplicate alias if one or more already exsist

@param int $nodeId
@param int $siteId
@param string $alias

@return string
548015
private function deduplicate($nodeId, $siteId, $alias)
    {
        $dupFound   = false;
        $current    = $alias;
        $increment  = 0;

        do {
            $dupFound = (bool)$this
                ->database
                ->query(
                    "SELECT 1 FROM {ucms_seo_route} WHERE route = :route AND site_id = :site",
                    [':route' => $current, ':site' => $siteId]
                )
                ->fetchField()
            ;

            if ($dupFound) {
                $current = $alias . '-' . ($increment++);
            }

        } while ($dupFound);

        return $current;
    }
132358
protected function getChoices($siteId, $language)
    {
        $orderedNodes = $this->nodeRepository->findTreeNode($siteId, $language, NodeInterface::ROOT_NODE_ID);

        return $this->getHierarchicalChoices($orderedNodes);
    }
892079
public function worker($serverId, $siteId, $workerId)
    {
        return new Worker(
            $this->get("servers/$serverId/sites/$siteId/workers/$workerId")['worker']
            + ['server_id' => $serverId, 'site_id' => $siteId], $this
        );
    }
1361655
public function getPathAlias($nodeId, $siteId)
    {
        $route = $this
            ->database
            ->query(
                "SELECT route, is_outdated FROM {ucms_seo_route} WHERE node_id = :node AND site_id = :site",
                [':node' => $nodeId, ':site' => $siteId]
            )
            ->fetch()
        ;

        if (!$route || $route->is_outdated) {
            return $this->computeAndStorePathAlias($nodeId, $siteId, ($route ? $route->route : null));
        } else {
            return $route->route;
        }
    }
1232134
public function getBySiteRootId($siteRootId)
    {
        if (!isset($this->trees[$siteRootId])) {
            $tree = $this->treeFactory->factory($siteRootId);
            $this->trees[$siteRootId] = $tree;
        }

        return $this->trees[$siteRootId];
    }
329001
def delete_alias(self, addressid, data):
        """"""
        return self.api_call(
            ENDPOINTS['aliases']['delete'],
            dict(addressid=addressid),
            body=data)
312163
public function getNodeTranslationByNodeId($nodeId, $lang)
    {
        $repo = $this->em->getRepository('KunstmaanNodeBundle:NodeTranslation');

        return $repo->getNodeTranslationByNodeIdQueryBuilder($nodeId, $lang);
    }
278706
public function matchPath($alias, $siteId)
    {
        $nodeId = $this
            ->database
            ->query(
                "SELECT node_id FROM {ucms_seo_route} WHERE route = :route AND site_id = :site",
                [':route' => $alias, ':site' => $siteId]
            )
            ->fetchField()
        ;

        return $nodeId ? ((int)$nodeId) : null;
    }
297335
public function andLeftnodeEquals($leftnode, $alias = null)
    {
        list($alias, $suffix) = $this->getAliasAndSuffix($alias);

        return $this->andWhere($alias.'._leftnode = :leftnode'.$suffix)
                        ->setParameter('leftnode'.$suffix, $leftnode);
    }
1115579
static function calculateSubtreeCacheDir( $nodeID, $cacheFilename )
    {
        $cacheDir = eZTemplateCacheBlock::subtreeCacheSubDirForNode( $nodeID );
        $cacheDir .= '/' . $cacheFilename[0] . '/' . $cacheFilename[1] . '/' . $cacheFilename[2];

        return $cacheDir;
    }
1050974
protected function removeDependedAliases($alias, $id)
    {
        foreach ($this->ids[$id] as $otherAlias) {
            if (isset($this->aliases[$otherAlias]) && $this->aliases[$otherAlias] === $alias) {
                unset($this->aliases[$otherAlias]);
                $aliases = &$this->ids[$id];
                unset($aliases[array_search($otherAlias, $aliases, true)]);
                if (!empty($aliases)) {
                    $this->removeDependedAliases($otherAlias, $id);
                } else {
                    unset($this->ids[$id]);
                }
            }
        }
    }
560724
protected function getSitePagesResourceId($siteId)
    {
        /** @var ResourceName $resourceName */
        $resourceName = $this->getServiceLocator()->get(
            ResourceName::class
        );

        return $resourceName->get(
            ResourceName::RESOURCE_SITES,
            $siteId,
            ResourceName::RESOURCE_PAGES
        );
    }
91741
public function deleteAction($nodeId)
    {
        $siteId = $this->get('open_orchestra_backoffice.context_backoffice_manager')->getSiteId();
        $nodeRepository = $this->get('open_orchestra_model.repository.node');

        $node = $nodeRepository->findOneByNodeAndSite($nodeId, $siteId);
        $this->denyAccessUnlessGranted(ContributionActionInterface::DELETE, $node);

        if (!$this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(BusinessActionInterface::DELETE, $node)) {
            throw new NodeNotDeletableException();
        }

        $nodeRepository->softDeleteNode($nodeId, $siteId);
        $this->dispatchEvent(NodeEvents::NODE_DELETE, new NodeDeleteEvent($nodeId, $siteId));

        return array();
    }
985442
public function getNodeRouteName($nodeId, $language)
    {
        $siteId = $this->currentSiteManager->getSiteId();

        $node = $this->nodeRepository->findOnePublished($nodeId, $language, $siteId);
        if (!$node instanceof ReadNodeInterface) {
            throw new NodeNotFoundException();
        }

        $site = $this->siteRepository->findOneBySiteId($siteId);

        $aliasId = $site->getAliasIdForLanguage($language);

        return $aliasId . '_' . $node->getId();
    }
1023699
public function getNodeIndex($nodeId)
    {
        return isset($this->nodeMap[$nodeId]) ? $this->nodeMap[$nodeId]['index'] : null;
    }
1010581
public function getRedirectList($siteId)
    {
        try {
            $result = $this->getQuery($siteId)->getResult();
        } catch (NoResultException $e) {
            $result = [];
        }

        return $result;
    }
1257342
public function selectTypeAction($siteId = null)
    {
        $contentTypes = $this->get('opifer.content.content_type_manager')->getRepository()->findAll();

        $layouts = $this->get('opifer.content.content_manager')->getRepository()->findBy(['layout' => true]);

        if (!$contentTypes) {
            return $this->redirectToRoute('opifer_content_content_create');
        }

        return $this->render($this->getParameter('opifer_content.content_select_type'), [
            'content_types' => $contentTypes,
            'site_id' => $siteId,
            'layouts' => $layouts
        ]);
    }