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; }