protected function update($step)
    {
        if (isset($step->dsl['lang'])) {
            // BC
            $step->dsl['match'] = array('language_code' => $step->dsl['lang']);
        }

        $languageCollection = $this->matchLanguages('delete', $step);

        if (count($languageCollection) > 1 && array_key_exists('references', $step->dsl)) {
            throw new \Exception("Can not execute Language update because multiple languages match, and a references section is specified in the dsl. References can be set when only 1 language matches");
        }

        $languageService = $this->repository->getContentLanguageService();

        foreach ($languageCollection as $key => $language) {

            if (isset($step->dsl['name'])) {
                $languageService->updateLanguageName($language, $this->referenceResolver->resolveReference($step->dsl['name']));
            }

            if (isset($step->dsl['enabled'])) {
                if ($this->referenceResolver->resolveReference($step->dsl['enabled'])) {
                    $languageService->enableLanguage($language);
                } else {
                    $languageService->disableLanguage($language);
                };
            }

            $languageCollection[$key] = $languageService->loadLanguageById($key);
        }

        $this->setReferences($languageCollection, $step);

        return $languageCollection;
    }
protected function update($step)
    {
        if (isset($step->dsl['lang'])) {
            // BC
            $step->dsl['match'] = array('language_code' => $step->dsl['lang']);
        }

        $languageCollection = $this->matchLanguages('delete', $step);

        if (count($languageCollection) > 1 && array_key_exists('references', $step->dsl)) {
            throw new \Exception("Can not execute Language update because multiple languages match, and a references section is specified in the dsl. References can be set when only 1 language matches");
        }

        $languageService = $this->repository->getContentLanguageService();

        foreach ($languageCollection as $key => $language) {

            if (isset($step->dsl['name'])) {
                $languageService->updateLanguageName($language, $this->referenceResolver->resolveReference($step->dsl['name']));
            }

            if (isset($step->dsl['enabled'])) {
                if ($this->referenceResolver->resolveReference($step->dsl['enabled'])) {
                    $languageService->enableLanguage($language);
                } else {
                    $languageService->disableLanguage($language);
                };
            }

            $languageCollection[$key] = $languageService->loadLanguageById($key);
        }

        $this->setReferences($languageCollection, $step);

        return $languageCollection;
    }
protected function update ( $ step ) { if ( isset ( $ step -> dsl [ 'lang' ] ) ) { // BC $ step -> dsl [ 'match' ] = array ( 'language_code' => $ step -> dsl [ 'lang' ] ) ; } $ languageCollection = $ this -> matchLanguages ( 'delete' , $ step ) ; if ( count ( $ languageCollection ) > 1 && array_key_exists ( 'references' , $ step -> dsl ) ) { throw new \ Exception ( "Can not execute Language update because multiple languages match, and a references section is specified in the dsl. References can be set when only 1 language matches" ) ; } $ languageService = $ this -> repository -> getContentLanguageService ( ) ; foreach ( $ languageCollection as $ key => $ language ) { if ( isset ( $ step -> dsl [ 'name' ] ) ) { $ languageService -> updateLanguageName ( $ language , $ this -> referenceResolver -> resolveReference ( $ step -> dsl [ 'name' ] ) ) ; } if ( isset ( $ step -> dsl [ 'enabled' ] ) ) { if ( $ this -> referenceResolver -> resolveReference ( $ step -> dsl [ 'enabled' ] ) ) { $ languageService -> enableLanguage ( $ language ) ; } else { $ languageService -> disableLanguage ( $ language ) ; } ; } $ languageCollection [ $ key ] = $ languageService -> loadLanguageById ( $ key ) ; } $ this -> setReferences ( $ languageCollection , $ step ) ; return $ languageCollection ; }
Handles the language update migration action
Handles the language update migration action