public static function checkDuplicateAlias($currentNavId, $parentNavId)
    {
        $currentNavItems = NavItem::find()->where(['nav_id' => $currentNavId])->asArray()->all();
        foreach (self::find()->where(['parent_nav_id' => $parentNavId, 'is_deleted' => false])->andWhere(['<>', 'id', $currentNavId])->asArray()->all() as $item) {
            foreach ($currentNavItems as $currentNavItem) {
                $itemNavItem = NavItem::find()->asArray()->where(['nav_id' => $item['id'], 'lang_id' => $currentNavItem['lang_id']])->one();
                if ($itemNavItem && $currentNavItem['alias'] == $itemNavItem['alias']) {
                    return $itemNavItem;
                }
            }
        }
        return true;
    }
public static function checkDuplicateAlias($currentNavId, $parentNavId)
    {
        $currentNavItems = NavItem::find()->where(['nav_id' => $currentNavId])->asArray()->all();
        foreach (self::find()->where(['parent_nav_id' => $parentNavId, 'is_deleted' => false])->andWhere(['<>', 'id', $currentNavId])->asArray()->all() as $item) {
            foreach ($currentNavItems as $currentNavItem) {
                $itemNavItem = NavItem::find()->asArray()->where(['nav_id' => $item['id'], 'lang_id' => $currentNavItem['lang_id']])->one();
                if ($itemNavItem && $currentNavItem['alias'] == $itemNavItem['alias']) {
                    return $itemNavItem;
                }
            }
        }
        return true;
    }
public static function checkDuplicateAlias ( $ currentNavId , $ parentNavId ) { $ currentNavItems = NavItem :: find ( ) -> where ( [ 'nav_id' => $ currentNavId ] ) -> asArray ( ) -> all ( ) ; foreach ( self :: find ( ) -> where ( [ 'parent_nav_id' => $ parentNavId , 'is_deleted' => false ] ) -> andWhere ( [ '<>' , 'id' , $ currentNavId ] ) -> asArray ( ) -> all ( ) as $ item ) { foreach ( $ currentNavItems as $ currentNavItem ) { $ itemNavItem = NavItem :: find ( ) -> asArray ( ) -> where ( [ 'nav_id' => $ item [ 'id' ] , 'lang_id' => $ currentNavItem [ 'lang_id' ] ] ) -> one ( ) ; if ( $ itemNavItem && $ currentNavItem [ 'alias' ] == $ itemNavItem [ 'alias' ] ) { return $ itemNavItem ; } } } return true ; }
Check for duplicate alias in same parent_nav_id context of targetNav, comparing with currentNav item.
Additional this checks for matching language contexts when comparing aliases.

@param $currentNavId
@param $parentNavId
@return boolean|mixed returns `true` if no duplication has been found, otherwhise returns an array with the duplicated existing item.
Check for duplicate alias in same parent_nav_id context of targetNav comparing with currentNav item . Additional this checks for matching language contexts when comparing aliases .