private function createAndPublishContent($field, $value)
    {
        $languageCode = self::DEFAULT_LANGUAGE;

        $locationCreateStruct = $this->locationService->newLocationCreateStruct('2');
        $contentType = $this->fieldConstructionObject['contentType'];
        $contentCreateStruct = $this->contentService->newContentCreateStruct($contentType, $languageCode);
        if ($field != null && $value != null) {
            $value = ($value == 'empty') ? null : $value;
            $value = is_numeric($value) ? $value + 0 : $value;
            $contentCreateStruct->setField($field, $value);
        }
        $draft = $this->contentService->createContent($contentCreateStruct, array($locationCreateStruct));
        $content = $this->contentService->publishVersion($draft->versionInfo);

        $this->fieldConstructionObject['content'] = $content;
        $this->fieldConstructionObject['objectState'] = self::CONTENT_PUBLISHED;
    }
private function createAndPublishContent($field, $value)
    {
        $languageCode = self::DEFAULT_LANGUAGE;

        $locationCreateStruct = $this->locationService->newLocationCreateStruct('2');
        $contentType = $this->fieldConstructionObject['contentType'];
        $contentCreateStruct = $this->contentService->newContentCreateStruct($contentType, $languageCode);
        if ($field != null && $value != null) {
            $value = ($value == 'empty') ? null : $value;
            $value = is_numeric($value) ? $value + 0 : $value;
            $contentCreateStruct->setField($field, $value);
        }
        $draft = $this->contentService->createContent($contentCreateStruct, array($locationCreateStruct));
        $content = $this->contentService->publishVersion($draft->versionInfo);

        $this->fieldConstructionObject['content'] = $content;
        $this->fieldConstructionObject['objectState'] = self::CONTENT_PUBLISHED;
    }
private function createAndPublishContent ( $ field , $ value ) { $ languageCode = self :: DEFAULT_LANGUAGE ; $ locationCreateStruct = $ this -> locationService -> newLocationCreateStruct ( '2' ) ; $ contentType = $ this -> fieldConstructionObject [ 'contentType' ] ; $ contentCreateStruct = $ this -> contentService -> newContentCreateStruct ( $ contentType , $ languageCode ) ; if ( $ field != null && $ value != null ) { $ value = ( $ value == 'empty' ) ? null : $ value ; $ value = is_numeric ( $ value ) ? $ value + 0 : $ value ; $ contentCreateStruct -> setField ( $ field , $ value ) ; } $ draft = $ this -> contentService -> createContent ( $ contentCreateStruct , array ( $ locationCreateStruct ) ) ; $ content = $ this -> contentService -> publishVersion ( $ draft -> versionInfo ) ; $ this -> fieldConstructionObject [ 'content' ] = $ content ; $ this -> fieldConstructionObject [ 'objectState' ] = self :: CONTENT_PUBLISHED ; }
Creates and publishes the content with a given field and
based on the internal ContentType.

@param string The field name
@param mixed The field value
Creates and publishes the content with a given field and based on the internal ContentType .