protected function update($step)
    {
        $sectionCollection = $this->matchSections('update', $step);

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

        $sectionService = $this->repository->getSectionService();
        foreach ($sectionCollection as $key => $section) {
            $sectionUpdateStruct = $sectionService->newSectionUpdateStruct();

            if (isset($step->dsl['identifier'])) {
                $sectionUpdateStruct->identifier = $this->referenceResolver->resolveReference($step->dsl['identifier']);
            }
            if (isset($step->dsl['name'])) {
                $sectionUpdateStruct->name = $this->referenceResolver->resolveReference($step->dsl['name']);
            }

            $section = $sectionService->updateSection($section, $sectionUpdateStruct);

            $sectionCollection[$key] = $section;
        }

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

        return $sectionCollection;
    }
protected function update($step)
    {
        $sectionCollection = $this->matchSections('update', $step);

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

        $sectionService = $this->repository->getSectionService();
        foreach ($sectionCollection as $key => $section) {
            $sectionUpdateStruct = $sectionService->newSectionUpdateStruct();

            if (isset($step->dsl['identifier'])) {
                $sectionUpdateStruct->identifier = $this->referenceResolver->resolveReference($step->dsl['identifier']);
            }
            if (isset($step->dsl['name'])) {
                $sectionUpdateStruct->name = $this->referenceResolver->resolveReference($step->dsl['name']);
            }

            $section = $sectionService->updateSection($section, $sectionUpdateStruct);

            $sectionCollection[$key] = $section;
        }

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

        return $sectionCollection;
    }
protected function update ( $ step ) { $ sectionCollection = $ this -> matchSections ( 'update' , $ step ) ; if ( count ( $ sectionCollection ) > 1 && array_key_exists ( 'references' , $ step -> dsl ) ) { throw new \ Exception ( "Can not execute Section update because multiple sections match, and a references section is specified in the dsl. References can be set when only 1 section matches" ) ; } $ sectionService = $ this -> repository -> getSectionService ( ) ; foreach ( $ sectionCollection as $ key => $ section ) { $ sectionUpdateStruct = $ sectionService -> newSectionUpdateStruct ( ) ; if ( isset ( $ step -> dsl [ 'identifier' ] ) ) { $ sectionUpdateStruct -> identifier = $ this -> referenceResolver -> resolveReference ( $ step -> dsl [ 'identifier' ] ) ; } if ( isset ( $ step -> dsl [ 'name' ] ) ) { $ sectionUpdateStruct -> name = $ this -> referenceResolver -> resolveReference ( $ step -> dsl [ 'name' ] ) ; } $ section = $ sectionService -> updateSection ( $ section , $ sectionUpdateStruct ) ; $ sectionCollection [ $ key ] = $ section ; } $ this -> setReferences ( $ sectionCollection , $ step ) ; return $ sectionCollection ; }
Handles the section update migration action
Handles the section update migration action