protected function setFields($createOrUpdateStruct, array $fields, ContentType $contentType, $step)
    {
        $fields = $this->normalizeFieldDefs($fields, $step);

        foreach ($fields as $fieldIdentifier => $fieldLanguages) {
            foreach ($fieldLanguages as $language => $fieldValue) {
                if (!isset($contentType->fieldDefinitionsByIdentifier[$fieldIdentifier])) {
                    throw new \Exception("Field '$fieldIdentifier' is not present in content type '{$contentType->identifier}'");
                }

                $fieldDefinition = $contentType->fieldDefinitionsByIdentifier[$fieldIdentifier];
                $fieldValue = $this->getFieldValue($fieldValue, $fieldDefinition, $contentType->identifier, $step->context);
                $createOrUpdateStruct->setField($fieldIdentifier, $fieldValue, $language);
            }
        }
    }
protected function setFields($createOrUpdateStruct, array $fields, ContentType $contentType, $step)
    {
        $fields = $this->normalizeFieldDefs($fields, $step);

        foreach ($fields as $fieldIdentifier => $fieldLanguages) {
            foreach ($fieldLanguages as $language => $fieldValue) {
                if (!isset($contentType->fieldDefinitionsByIdentifier[$fieldIdentifier])) {
                    throw new \Exception("Field '$fieldIdentifier' is not present in content type '{$contentType->identifier}'");
                }

                $fieldDefinition = $contentType->fieldDefinitionsByIdentifier[$fieldIdentifier];
                $fieldValue = $this->getFieldValue($fieldValue, $fieldDefinition, $contentType->identifier, $step->context);
                $createOrUpdateStruct->setField($fieldIdentifier, $fieldValue, $language);
            }
        }
    }
protected function setFields ( $ createOrUpdateStruct , array $ fields , ContentType $ contentType , $ step ) { $ fields = $ this -> normalizeFieldDefs ( $ fields , $ step ) ; foreach ( $ fields as $ fieldIdentifier => $ fieldLanguages ) { foreach ( $ fieldLanguages as $ language => $ fieldValue ) { if ( ! isset ( $ contentType -> fieldDefinitionsByIdentifier [ $ fieldIdentifier ] ) ) { throw new \ Exception ( "Field '$fieldIdentifier' is not present in content type '{$contentType->identifier}'" ) ; } $ fieldDefinition = $ contentType -> fieldDefinitionsByIdentifier [ $ fieldIdentifier ] ; $ fieldValue = $ this -> getFieldValue ( $ fieldValue , $ fieldDefinition , $ contentType -> identifier , $ step -> context ) ; $ createOrUpdateStruct -> setField ( $ fieldIdentifier , $ fieldValue , $ language ) ; } } }
Helper function to set the fields of a ContentCreateStruct based on the DSL attribute settings.

@param ContentCreateStruct|ContentUpdateStruct $createOrUpdateStruct
@param array $fields see description of expected format in code below
@param ContentType $contentType
@param $step
@throws \Exception
Helper function to set the fields of a ContentCreateStruct based on the DSL attribute settings .