ModelBundle/Repository/NodeRepository.php
public function countOtherNodeWithSameSpecialPageName($nodeId, $siteId, $language, $name)
    {
        $qa = $this->createAggregationQueryBuilderWithSiteIdAndLanguage($siteId, $language);
        $qa->match(
            array(
                'nodeId'   => array('$ne' => $nodeId),
                'deleted'  => false,
                'specialPageName' => $name
            )
        );

        return $this->countDocumentAggregateQuery($qa);
    }
public function countOtherNodeWithSameSpecialPageName($nodeId, $siteId, $language, $name)
    {
        $qa = $this->createAggregationQueryBuilderWithSiteIdAndLanguage($siteId, $language);
        $qa->match(
            array(
                'nodeId'   => array('$ne' => $nodeId),
                'deleted'  => false,
                'specialPageName' => $name
            )
        );

        return $this->countDocumentAggregateQuery($qa);
    }
@param string $nodeId
@param string $siteId
@param string $language
@param string $name

@return int