本文整理汇总了PHP中eZ\Publish\API\Repository\ContentService::createContentDraft方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentService::createContentDraft方法的具体用法?PHP ContentService::createContentDraft怎么用?PHP ContentService::createContentDraft使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZ\Publish\API\Repository\ContentService
的用法示例。
在下文中一共展示了ContentService::createContentDraft方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createContentDraft
/**
* Creates a draft from a published or archived version.
*
* If no version is given, the current published version is used.
* 4.x: The draft is created with the initialLanguage code of the source version or if not present with the main language.
* It can be changed on updating the version.
*
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to create the draft
*
* @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
* @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo
* @param \eZ\Publish\API\Repository\Values\User\User $user if set given user is used to create the draft - otherwise the current user is used
*
* @return \eZ\Publish\API\Repository\Values\Content\Content - the newly created content draft
*/
public function createContentDraft( ContentInfo $contentInfo, VersionInfo $versionInfo = null, User $user = null )
{
$returnValue = $this->service->createContentDraft( $contentInfo, $versionInfo, $user );
$this->signalDispatcher->emit(
new CreateContentDraftSignal(
array(
'contentId' => $contentInfo->id,
'versionNo' => ( $versionInfo !== null ? $versionInfo->versionNo : null ),
'userId' => ( $user !== null ? $user->id : null ),
)
)
);
return $returnValue;
}