public function createContentDraft($parentLocationId, $contentTypeIdentifier, $fields, $languageCode = null)
    {
        $languageCode = $languageCode ?: self::DEFAULT_LANGUAGE;
        $repository = $this->getRepository();
        $locationCreateStruct = $repository->getLocationService()->newLocationCreateStruct($parentLocationId);
        $contentTypeIdentifier = $this->contentTypeService->loadContentTypeByIdentifier($contentTypeIdentifier);
        $contentCreateStruct = $this->contentService->newContentCreateStruct($contentTypeIdentifier, $languageCode);
        foreach (array_keys($fields) as $key) {
            $contentCreateStruct->setField($key, $fields[$key]);
        }

        return $this->contentService->createContent($contentCreateStruct, array($locationCreateStruct));
    }
public function createContentDraft($parentLocationId, $contentTypeIdentifier, $fields, $languageCode = null)
    {
        $languageCode = $languageCode ?: self::DEFAULT_LANGUAGE;
        $repository = $this->getRepository();
        $locationCreateStruct = $repository->getLocationService()->newLocationCreateStruct($parentLocationId);
        $contentTypeIdentifier = $this->contentTypeService->loadContentTypeByIdentifier($contentTypeIdentifier);
        $contentCreateStruct = $this->contentService->newContentCreateStruct($contentTypeIdentifier, $languageCode);
        foreach (array_keys($fields) as $key) {
            $contentCreateStruct->setField($key, $fields[$key]);
        }

        return $this->contentService->createContent($contentCreateStruct, array($locationCreateStruct));
    }
public function createContentDraft ( $ parentLocationId , $ contentTypeIdentifier , $ fields , $ languageCode = null ) { $ languageCode = $ languageCode ? : self :: DEFAULT_LANGUAGE ; $ repository = $ this -> getRepository ( ) ; $ locationCreateStruct = $ repository -> getLocationService ( ) -> newLocationCreateStruct ( $ parentLocationId ) ; $ contentTypeIdentifier = $ this -> contentTypeService -> loadContentTypeByIdentifier ( $ contentTypeIdentifier ) ; $ contentCreateStruct = $ this -> contentService -> newContentCreateStruct ( $ contentTypeIdentifier , $ languageCode ) ; foreach ( array_keys ( $ fields ) as $ key ) { $ contentCreateStruct -> setField ( $ key , $ fields [ $ key ] ) ; } return $ this -> contentService -> createContent ( $ contentCreateStruct , array ( $ locationCreateStruct ) ) ; }
Creates a content draft.

@param eZ\Publish\API\Repository\Values\Content\Location $parentLocationId
@param string $contentTypeIdentifier
@param string $languageCode
@param array $fields Fields, as primitives understood by setField

@return eZ\Publish\API\Repository\Values\Content\Content an unpublished Content draft
Creates a content draft .