Class

eZ\Publish\Core\REST\Server\Controller\Content

class Content extends Controller

Content controller.

Methods

setInputDispatcher(Dispatcher $inputDispatcher)

from Controller
setRouter(RouterInterface $router)

from Controller
setRepository(Repository $repository)

from Controller
setRequestParser(RequestParser $requestParser)

from Controller
TemporaryRedirect redirectContent(Request $request)

Loads a content info by remote ID.

RestContent loadContent(mixed $contentId, Request $request)

Loads a content info, potentially with the current version embedded.

RestContent updateContentMetadata($contentId, Request $request)

Updates a content's metadata.

TemporaryRedirect redirectCurrentVersion(mixed $contentId)

Loads a specific version of a given content object.

Version loadContentInVersion($contentId, $versionNumber, Request $request)

Loads a specific version of a given content object.

CreatedContent createContent(Request $request)

Creates a new content draft assigned to the authenticated user.

NoContent deleteContent(mixed $contentId)

The content is deleted.

ResourceCreated copyContent($contentId, Request $request)

Creates a new content object as copy under the given parent location given in the destination header.

NoContent deleteContentTranslation(int $contentId, string $languageCode)

Deletes a translation from all the Versions of the given Content Object.

VersionList loadContentVersions($contentId, Request $request)

Returns a list of all versions of the content.

NoContent deleteContentVersion(mixed $contentId, mixed $versionNumber)

The version is deleted.

NoContent deleteTranslationFromDraft(int $contentId, int $versionNumber, string $languageCode)

Remove the given Translation from the given Version Draft.

CreatedVersion createDraftFromVersion(mixed $contentId, mixed $versionNumber)

The system creates a new draft version as a copy from the given version.

CreatedVersion createDraftFromCurrentVersion(mixed $contentId)

The system creates a new draft version as a copy from the current version.

Version updateVersion($contentId, $versionNumber, Request $request)

A specific draft is updated.

NoContent publishVersion(mixed $contentId, mixed $versionNumber)

The content version is published.

TemporaryRedirect redirectCurrentVersionRelations(mixed $contentId)

Redirects to the relations of the current version.

RelationList loadVersionRelations($contentId, $versionNumber, Request $request)

Loads the relations of the given version.

RestRelation loadVersionRelation($contentId, $versionNumber, $relationId, Request $request)

Loads a relation for the given content object and version.

NoContent removeRelation($contentId, $versionNumber, $relationId, Request $request)

Deletes a relation of the given draft.

CreatedRelation createRelation($contentId, $versionNumber, Request $request)

Creates a new relation of type COMMON for the given draft.

RestExecutedView createView()

Creates and executes a content view.

Details

in Controller at line 45
public setInputDispatcher(Dispatcher $inputDispatcher)

Parameters

Dispatcher $inputDispatcher

in Controller at line 50
public setRouter(RouterInterface $router)

Parameters

RouterInterface $router

in Controller at line 55
public setRepository(Repository $repository)

Parameters

Repository $repository

in Controller at line 60
public setRequestParser(RequestParser $requestParser)

Parameters

RequestParser $requestParser

at line 38
public TemporaryRedirect redirectContent(Request $request)

Loads a content info by remote ID.

Parameters

Request $request

Return Value

TemporaryRedirect

Exceptions

BadRequestException

at line 66
public RestContent loadContent(mixed $contentId, Request $request)

Loads a content info, potentially with the current version embedded.

Parameters

mixed $contentId
Request $request

Return Value

RestContent

at line 115
public RestContent updateContentMetadata($contentId, Request $request)

Updates a content's metadata.

Parameters

$contentId
Request $request

Return Value

RestContent

at line 165
public TemporaryRedirect redirectCurrentVersion(mixed $contentId)

Loads a specific version of a given content object.

Parameters

mixed $contentId

Return Value

TemporaryRedirect

at line 188
public Version loadContentInVersion($contentId, $versionNumber, Request $request)

Loads a specific version of a given content object.

Parameters

$contentId
$versionNumber
Request $request

Return Value

Version

at line 232
public CreatedContent createContent(Request $request)

Creates a new content draft assigned to the authenticated user.

If a different userId is given in the input it is assigned to the given user but this required special rights for the authenticated user (this is useful for content staging where the transfer process does not have to authenticate with the user which created the content object in the source server). The user has to publish the content if it should be visible.

Parameters

Request $request

Return Value

CreatedContent

at line 284
public NoContent deleteContent(mixed $contentId)

The content is deleted.

If the content has locations (which is required in 4.x) on delete all locations assigned the content object are deleted via delete subtree.

Parameters

mixed $contentId

Return Value

NoContent

at line 300
public ResourceCreated copyContent($contentId, Request $request)

Creates a new content object as copy under the given parent location given in the destination header.

Parameters

$contentId
Request $request

Return Value

ResourceCreated

at line 330
public NoContent deleteContentTranslation(int $contentId, string $languageCode)

Deletes a translation from all the Versions of the given Content Object.

If any non-published Version contains only the Translation to be deleted, that entire Version will be deleted

Parameters

int $contentId
string $languageCode

Return Value

NoContent

Exceptions

Exception

at line 359
public VersionList loadContentVersions($contentId, Request $request)

Returns a list of all versions of the content.

This method does not include fields and relations in the Version elements of the response.

Parameters

$contentId
Request $request

Return Value

VersionList

at line 379
public NoContent deleteContentVersion(mixed $contentId, mixed $versionNumber)

The version is deleted.

Parameters

mixed $contentId
mixed $versionNumber

Return Value

NoContent

Exceptions

ForbiddenException

at line 408
public NoContent deleteTranslationFromDraft(int $contentId, int $versionNumber, string $languageCode)

Remove the given Translation from the given Version Draft.

Parameters

int $contentId
int $versionNumber
string $languageCode

Return Value

NoContent

Exceptions

ForbiddenException

at line 430
public CreatedVersion createDraftFromVersion(mixed $contentId, mixed $versionNumber)

The system creates a new draft version as a copy from the given version.

Parameters

mixed $contentId
mixed $versionNumber

Return Value

CreatedVersion

at line 459
public CreatedVersion createDraftFromCurrentVersion(mixed $contentId)

The system creates a new draft version as a copy from the current version.

Parameters

mixed $contentId

Return Value

CreatedVersion

Exceptions

ForbiddenException if the current version is already a draft

at line 495
public Version updateVersion($contentId, $versionNumber, Request $request)

A specific draft is updated.

Parameters

$contentId
$versionNumber
Request $request

Return Value

Version

Exceptions

ForbiddenException
BadRequestException

at line 563
public NoContent publishVersion(mixed $contentId, mixed $versionNumber)

The content version is published.

Parameters

mixed $contentId
mixed $versionNumber

Return Value

NoContent

Exceptions

ForbiddenException if version $versionNumber isn't a draft

at line 588
public TemporaryRedirect redirectCurrentVersionRelations(mixed $contentId)

Redirects to the relations of the current version.

Parameters

mixed $contentId

Return Value

TemporaryRedirect

at line 611
public RelationList loadVersionRelations($contentId, $versionNumber, Request $request)

Loads the relations of the given version.

Parameters

$contentId
$versionNumber
Request $request

Return Value

RelationList

at line 655
public RestRelation loadVersionRelation($contentId, $versionNumber, $relationId, Request $request)

Loads a relation for the given content object and version.

Parameters

$contentId
$versionNumber
$relationId
Request $request

Return Value

RestRelation

Exceptions

NotFoundException

at line 692
public NoContent removeRelation($contentId, $versionNumber, $relationId, Request $request)

Deletes a relation of the given draft.

Parameters

$contentId
$versionNumber
$relationId
Request $request

Return Value

NoContent

Exceptions

ForbiddenException
NotFoundException

at line 730
public CreatedRelation createRelation($contentId, $versionNumber, Request $request)

Creates a new relation of type COMMON for the given draft.

Parameters

$contentId
$versionNumber
Request $request

Return Value

CreatedRelation

Exceptions

ForbiddenException if version $versionNumber isn't a draft
ForbiddenException if a relation to the same content already exists

at line 774
public RestExecutedView createView()

Creates and executes a content view.

Return Value

RestExecutedView