protected function create($step)
    {
        foreach (array('names', 'identifier') as $key) {
            if (!isset($step->dsl[$key])) {
                throw new \Exception("The '$key' key is missing in a object state group creation definition");
            }
        }

        $objectStateService = $this->repository->getObjectStateService();

        $objectStateGroupIdentifier = $this->referenceResolver->resolveReference($step->dsl['identifier']);
        $objectStateGroupCreateStruct = $objectStateService->newObjectStateGroupCreateStruct($objectStateGroupIdentifier);
        $objectStateGroupCreateStruct->defaultLanguageCode = $this->getLanguageCode($step); // was: self::DEFAULT_LANGUAGE_CODE;

        foreach ($step->dsl['names'] as $languageCode => $name) {
            $objectStateGroupCreateStruct->names[$languageCode] = $name;
        }
        if (isset($step->dsl['descriptions'])) {
            foreach ($step->dsl['descriptions'] as $languageCode => $description) {
                $objectStateGroupCreateStruct->descriptions[$languageCode] = $description;
            }
        }

        $objectStateGroup = $objectStateService->createObjectStateGroup($objectStateGroupCreateStruct);

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

        return $objectStateGroup;
    }
protected function create($step)
    {
        foreach (array('names', 'identifier') as $key) {
            if (!isset($step->dsl[$key])) {
                throw new \Exception("The '$key' key is missing in a object state group creation definition");
            }
        }

        $objectStateService = $this->repository->getObjectStateService();

        $objectStateGroupIdentifier = $this->referenceResolver->resolveReference($step->dsl['identifier']);
        $objectStateGroupCreateStruct = $objectStateService->newObjectStateGroupCreateStruct($objectStateGroupIdentifier);
        $objectStateGroupCreateStruct->defaultLanguageCode = $this->getLanguageCode($step); // was: self::DEFAULT_LANGUAGE_CODE;

        foreach ($step->dsl['names'] as $languageCode => $name) {
            $objectStateGroupCreateStruct->names[$languageCode] = $name;
        }
        if (isset($step->dsl['descriptions'])) {
            foreach ($step->dsl['descriptions'] as $languageCode => $description) {
                $objectStateGroupCreateStruct->descriptions[$languageCode] = $description;
            }
        }

        $objectStateGroup = $objectStateService->createObjectStateGroup($objectStateGroupCreateStruct);

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

        return $objectStateGroup;
    }
protected function create ( $ step ) { foreach ( array ( 'names' , 'identifier' ) as $ key ) { if ( ! isset ( $ step -> dsl [ $ key ] ) ) { throw new \ Exception ( "The '$key' key is missing in a object state group creation definition" ) ; } } $ objectStateService = $ this -> repository -> getObjectStateService ( ) ; $ objectStateGroupIdentifier = $ this -> referenceResolver -> resolveReference ( $ step -> dsl [ 'identifier' ] ) ; $ objectStateGroupCreateStruct = $ objectStateService -> newObjectStateGroupCreateStruct ( $ objectStateGroupIdentifier ) ; $ objectStateGroupCreateStruct -> defaultLanguageCode = $ this -> getLanguageCode ( $ step ) ; // was: self::DEFAULT_LANGUAGE_CODE; foreach ( $ step -> dsl [ 'names' ] as $ languageCode => $ name ) { $ objectStateGroupCreateStruct -> names [ $ languageCode ] = $ name ; } if ( isset ( $ step -> dsl [ 'descriptions' ] ) ) { foreach ( $ step -> dsl [ 'descriptions' ] as $ languageCode => $ description ) { $ objectStateGroupCreateStruct -> descriptions [ $ languageCode ] = $ description ; } } $ objectStateGroup = $ objectStateService -> createObjectStateGroup ( $ objectStateGroupCreateStruct ) ; $ this -> setReferences ( $ objectStateGroup , $ step ) ; return $ objectStateGroup ; }
Handles the create step of object state group migrations
Handles the create step of object state group migrations