public function createContentItem($contentTypeIdentifier, array $fields)
    {
        $draft = $this->createDraft($contentTypeIdentifier, $fields);

        $this->currentContent = $this->repository->sudo(
            function () use ($draft) {
                return $this->repository->getContentService()->publishVersion($draft->versionInfo);
            }
        );

        $this->currentDraft = null;

        return $this->currentContent;
    }
public function createContentItem($contentTypeIdentifier, array $fields)
    {
        $draft = $this->createDraft($contentTypeIdentifier, $fields);

        $this->currentContent = $this->repository->sudo(
            function () use ($draft) {
                return $this->repository->getContentService()->publishVersion($draft->versionInfo);
            }
        );

        $this->currentDraft = null;

        return $this->currentContent;
    }
public function createContentItem ( $ contentTypeIdentifier , array $ fields ) { $ draft = $ this -> createDraft ( $ contentTypeIdentifier , $ fields ) ; $ this -> currentContent = $ this -> repository -> sudo ( function ( ) use ( $ draft ) { return $ this -> repository -> getContentService ( ) -> publishVersion ( $ draft -> versionInfo ) ; } ) ; $ this -> currentDraft = null ; return $ this -> currentContent ; }
Uses a content type identifier + a hash of fields values
to create and publish a content item below the root location.

@param string $contentTypeIdentifier
@param array $fields Hash of field def identifier => field value

@return Content the created content item.
Uses a content type identifier + a hash of fields values to create and publish a content item below the root location .