protected function completeContentType(ContentType $contentType)
{
// TODO: currently no way to fetch groups of a type draft
if ($contentType instanceof ContentTypeDraft) {
return $contentType;
}
$response = $this->client->request('GET', $this->requestParser->generate('groupsOfType', $this->requestParser->parse('type', $contentType->id)), new Message(array('Accept' => $this->outputVisitor->getMediaType('ContentTypeGroupRefList'))));
/** @var $referenceList \eZ\Publish\Core\REST\Client\Values\ContentTypeGroupRefList */
$referenceList = $this->inputDispatcher->parse($response);
return new RestContentType($this, array('id' => $contentType->id, 'remoteId' => $contentType->remoteId, 'identifier' => $contentType->identifier, 'creatorId' => $contentType->creatorId, 'modifierId' => $contentType->modifierId, 'creationDate' => $contentType->creationDate, 'modificationDate' => $contentType->modificationDate, 'defaultSortField' => $contentType->defaultSortField, 'defaultSortOrder' => $contentType->defaultSortOrder, 'defaultAlwaysAvailable' => $contentType->defaultAlwaysAvailable, 'names' => $contentType->names, 'descriptions' => $contentType->descriptions, 'isContainer' => $contentType->isContainer, 'mainLanguageCode' => $contentType->mainLanguageCode, 'nameSchema' => $contentType->nameSchema, 'urlAliasSchema' => $contentType->urlAliasSchema, 'status' => $contentType->status, 'fieldDefinitionListReference' => $contentType->fieldDefinitionListReference, 'contentTypeGroupListReference' => $referenceList->listReference));
}