eZ\Bundle\EzPublishCoreBundle\Features\Context\ContentContext::createContentItem PHP Method

createContentItem() public method

Uses a content type identifier + a hash of fields values to create and publish a content item below the root location.
public createContentItem ( string $contentTypeIdentifier, array $fields ) : eZ\Publish\API\Repository\Values\Content\Content
$contentTypeIdentifier string
$fields array Hash of field def identifier => field value
return eZ\Publish\API\Repository\Values\Content\Content the created content item.
    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;
    }