public function locationSwapped($location1Id, $location1ParentId, $location2Id, $location2ParentId)
    {
        $location1 = new SwappedLocationProperties($location1Id, $location1ParentId);
        $location2 = new SwappedLocationProperties($location2Id, $location2ParentId);

        $location1->entries = $this->gateway->loadLocationEntries($location1Id);
        $location2->entries = $this->gateway->loadLocationEntries($location2Id);

        $location1->mainLanguageId = $this->gateway->getLocationContentMainLanguageId($location1Id);
        $location2->mainLanguageId = $this->gateway->getLocationContentMainLanguageId($location2Id);

        // Load autogenerated entries to find alias ID
        $location1->autogeneratedId = $this->gateway->loadAutogeneratedEntry("eznode:{$location1Id}")['id'];
        $location2->autogeneratedId = $this->gateway->loadAutogeneratedEntry("eznode:{$location2Id}")['id'];

        $contentInfo1 = $this->contentGateway->loadContentInfoByLocationId($location1Id);
        $contentInfo2 = $this->contentGateway->loadContentInfoByLocationId($location2Id);

        $names1 = $this->getNamesForAllLanguages($contentInfo1);
        $names2 = $this->getNamesForAllLanguages($contentInfo2);

        $location1->isAlwaysAvailable = $this->maskGenerator->isAlwaysAvailable($contentInfo1['language_mask']);
        $location2->isAlwaysAvailable = $this->maskGenerator->isAlwaysAvailable($contentInfo2['language_mask']);

        $languages = $this->languageHandler->loadAll();

        // Historize everything first to avoid name conflicts in case swapped Locations are siblings
        $this->historizeBeforeSwap($location1->entries, $location2->entries);

        foreach ($languages as $languageCode => $language) {
            $location1->name = isset($names1[$languageCode]) ? $names1[$languageCode] : null;
            $location2->name = isset($names2[$languageCode]) ? $names2[$languageCode] : null;
            $urlAliasesForSwappedLocations = $this->getUrlAliasesForSwappedLocations(
                $language,
                $location1,
                $location2
            );
            foreach ($urlAliasesForSwappedLocations as $urlAliasForLocation) {
                $this->internalPublishUrlAliasForLocation(
                    $urlAliasForLocation->id,
                    $urlAliasForLocation->parentId,
                    $urlAliasForLocation->name,
                    $language->id,
                    $urlAliasForLocation->isAlwaysAvailable,
                    $urlAliasForLocation->isPathIdentificationStringModified,
                    $urlAliasForLocation->newId
                );
            }
        }
    }
public function locationSwapped($location1Id, $location1ParentId, $location2Id, $location2ParentId)
    {
        $location1 = new SwappedLocationProperties($location1Id, $location1ParentId);
        $location2 = new SwappedLocationProperties($location2Id, $location2ParentId);

        $location1->entries = $this->gateway->loadLocationEntries($location1Id);
        $location2->entries = $this->gateway->loadLocationEntries($location2Id);

        $location1->mainLanguageId = $this->gateway->getLocationContentMainLanguageId($location1Id);
        $location2->mainLanguageId = $this->gateway->getLocationContentMainLanguageId($location2Id);

        // Load autogenerated entries to find alias ID
        $location1->autogeneratedId = $this->gateway->loadAutogeneratedEntry("eznode:{$location1Id}")['id'];
        $location2->autogeneratedId = $this->gateway->loadAutogeneratedEntry("eznode:{$location2Id}")['id'];

        $contentInfo1 = $this->contentGateway->loadContentInfoByLocationId($location1Id);
        $contentInfo2 = $this->contentGateway->loadContentInfoByLocationId($location2Id);

        $names1 = $this->getNamesForAllLanguages($contentInfo1);
        $names2 = $this->getNamesForAllLanguages($contentInfo2);

        $location1->isAlwaysAvailable = $this->maskGenerator->isAlwaysAvailable($contentInfo1['language_mask']);
        $location2->isAlwaysAvailable = $this->maskGenerator->isAlwaysAvailable($contentInfo2['language_mask']);

        $languages = $this->languageHandler->loadAll();

        // Historize everything first to avoid name conflicts in case swapped Locations are siblings
        $this->historizeBeforeSwap($location1->entries, $location2->entries);

        foreach ($languages as $languageCode => $language) {
            $location1->name = isset($names1[$languageCode]) ? $names1[$languageCode] : null;
            $location2->name = isset($names2[$languageCode]) ? $names2[$languageCode] : null;
            $urlAliasesForSwappedLocations = $this->getUrlAliasesForSwappedLocations(
                $language,
                $location1,
                $location2
            );
            foreach ($urlAliasesForSwappedLocations as $urlAliasForLocation) {
                $this->internalPublishUrlAliasForLocation(
                    $urlAliasForLocation->id,
                    $urlAliasForLocation->parentId,
                    $urlAliasForLocation->name,
                    $language->id,
                    $urlAliasForLocation->isAlwaysAvailable,
                    $urlAliasForLocation->isPathIdentificationStringModified,
                    $urlAliasForLocation->newId
                );
            }
        }
    }
public function locationSwapped ( $ location1Id , $ location1ParentId , $ location2Id , $ location2ParentId ) { $ location1 = new SwappedLocationProperties ( $ location1Id , $ location1ParentId ) ; $ location2 = new SwappedLocationProperties ( $ location2Id , $ location2ParentId ) ; $ location1 -> entries = $ this -> gateway -> loadLocationEntries ( $ location1Id ) ; $ location2 -> entries = $ this -> gateway -> loadLocationEntries ( $ location2Id ) ; $ location1 -> mainLanguageId = $ this -> gateway -> getLocationContentMainLanguageId ( $ location1Id ) ; $ location2 -> mainLanguageId = $ this -> gateway -> getLocationContentMainLanguageId ( $ location2Id ) ; // Load autogenerated entries to find alias ID $ location1 -> autogeneratedId = $ this -> gateway -> loadAutogeneratedEntry ( "eznode:{$location1Id}" ) [ 'id' ] ; $ location2 -> autogeneratedId = $ this -> gateway -> loadAutogeneratedEntry ( "eznode:{$location2Id}" ) [ 'id' ] ; $ contentInfo1 = $ this -> contentGateway -> loadContentInfoByLocationId ( $ location1Id ) ; $ contentInfo2 = $ this -> contentGateway -> loadContentInfoByLocationId ( $ location2Id ) ; $ names1 = $ this -> getNamesForAllLanguages ( $ contentInfo1 ) ; $ names2 = $ this -> getNamesForAllLanguages ( $ contentInfo2 ) ; $ location1 -> isAlwaysAvailable = $ this -> maskGenerator -> isAlwaysAvailable ( $ contentInfo1 [ 'language_mask' ] ) ; $ location2 -> isAlwaysAvailable = $ this -> maskGenerator -> isAlwaysAvailable ( $ contentInfo2 [ 'language_mask' ] ) ; $ languages = $ this -> languageHandler -> loadAll ( ) ; // Historize everything first to avoid name conflicts in case swapped Locations are siblings $ this -> historizeBeforeSwap ( $ location1 -> entries , $ location2 -> entries ) ; foreach ( $ languages as $ languageCode => $ language ) { $ location1 -> name = isset ( $ names1 [ $ languageCode ] ) ? $ names1 [ $ languageCode ] : null ; $ location2 -> name = isset ( $ names2 [ $ languageCode ] ) ? $ names2 [ $ languageCode ] : null ; $ urlAliasesForSwappedLocations = $ this -> getUrlAliasesForSwappedLocations ( $ language , $ location1 , $ location2 ) ; foreach ( $ urlAliasesForSwappedLocations as $ urlAliasForLocation ) { $ this -> internalPublishUrlAliasForLocation ( $ urlAliasForLocation -> id , $ urlAliasForLocation -> parentId , $ urlAliasForLocation -> name , $ language -> id , $ urlAliasForLocation -> isAlwaysAvailable , $ urlAliasForLocation -> isPathIdentificationStringModified , $ urlAliasForLocation -> newId ) ; } } }
Notify the underlying engine that a Location has been swapped.

This method triggers the change of the autogenerated aliases.

@param int $location1Id
@param int $location1ParentId
@param int $location2Id
@param int $location2ParentId
Notify the underlying engine that a Location has been swapped .