本文整理汇总了PHP中eZ\Publish\Core\REST\Common\Output\Generator::startHashElement方法的典型用法代码示例。如果您正苦于以下问题:PHP Generator::startHashElement方法的具体用法?PHP Generator::startHashElement怎么用?PHP Generator::startHashElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZ\Publish\Core\REST\Common\Output\Generator
的用法示例。
在下文中一共展示了Generator::startHashElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: visit
/**
* Visit struct returned by controllers
*
* @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
* @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
* @param mixed $data
*/
public function visit(Visitor $visitor, Generator $generator, $data)
{
$generator->startObjectElement('ObjectStateCreate');
$visitor->setHeader('Content-Type', $generator->getMediaType('ObjectStateCreate'));
$generator->startValueElement('identifier', $data->identifier);
$generator->endValueElement('identifier');
$generator->startValueElement('priority', $data->priority);
$generator->endValueElement('priority');
$generator->startValueElement('defaultLanguageCode', $data->defaultLanguageCode);
$generator->endValueElement('defaultLanguageCode');
$generator->startHashElement('names');
$generator->startList('value');
foreach ($data->names as $languageCode => $name) {
$generator->startValueElement('value', $name, array('languageCode' => $languageCode));
$generator->endValueElement('value');
}
$generator->endList('value');
$generator->endHashElement('names');
$generator->startHashElement('descriptions');
foreach ($data->descriptions as $languageCode => $description) {
$generator->startValueElement('value', $description, array('languageCode' => $languageCode));
$generator->endValueElement('value');
}
$generator->endHashElement('descriptions');
$generator->endObjectElement('ObjectStateCreate');
}
示例2: visit
public function visit(Visitor $visitor, Generator $generator, $data)
{
if ($data instanceof LocationQueryValue) {
$rootObjectElement = 'LocationQuery';
} else {
if ($data instanceof ContentQueryValue) {
$rootObjectElement = 'ContentQuery';
} else {
throw new Exceptions\InvalidArgumentException("ViewInput Query", "No content nor location query found in ViewInput");
}
}
$generator->startObjectElement($rootObjectElement, 'Query');
if (isset($data->filter)) {
$generator->startHashElement('Filter');
$visitor->visitValueObject($data->filter);
$generator->endHashElement('Filter');
}
if (isset($data->query)) {
$generator->startHashElement('Query');
$visitor->visitValueObject($data->query);
$generator->endhashElement('Query');
}
// $generator->startObjectElement('SortClauses');
// foreach ($data->sortClauses as $sortClause) {
// $visitor->visitValueObject($sortClause);
// }
// $generator->endObjectElement('SortClauses');
$generator->endObjectElement($rootObjectElement);
}
示例3: visit
/**
* Visit struct returned by controllers.
*
* @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
* @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
* @param \eZ\Publish\Core\REST\Server\Exceptions\ContentFieldValidationException $data
*/
public function visit(Visitor $visitor, Generator $generator, $data)
{
$generator->startObjectElement('ErrorMessage');
$statusCode = $this->getStatus();
$visitor->setStatus($statusCode);
$visitor->setHeader('Content-Type', $generator->getMediaType('ErrorMessage'));
$generator->startValueElement('errorCode', $statusCode);
$generator->endValueElement('errorCode');
$generator->startValueElement('errorMessage', $this->httpStatusCodes[$statusCode]);
$generator->endValueElement('errorMessage');
$generator->startValueElement('errorDescription', $data->getMessage());
$generator->endValueElement('errorDescription');
$generator->startHashElement('errorDetails');
$generator->startList('fields');
foreach ($data->getFieldErrors() as $fieldTypeId => $translations) {
foreach ($translations as $languageCode => $validationErrors) {
if (!is_array($validationErrors)) {
$validationErrors = [$validationErrors];
}
foreach ($validationErrors as $validationError) {
$generator->startHashElement('field');
$generator->startAttribute('fieldTypeId', $fieldTypeId);
$generator->endAttribute('fieldTypeId');
$generator->startList('errors');
$generator->startHashElement('error');
$generator->startValueElement('type', $validationError->getTarget());
$generator->endValueElement('type');
$translation = $validationError->getTranslatableMessage();
$generator->startValueElement('message', $this->translator->trans($this->translationToString($translation), $translation->values, 'repository_exceptions'));
$generator->endValueElement('message');
$generator->endHashElement('error');
$generator->endList('errors');
$generator->endHashElement('field');
}
}
}
$generator->endList('fields');
$generator->endHashElement('errorDetails');
if ($this->debug) {
$generator->startValueElement('trace', $data->getTraceAsString());
$generator->endValueElement('trace');
$generator->startValueElement('file', $data->getFile());
$generator->endValueElement('file');
$generator->startValueElement('line', $data->getLine());
$generator->endValueElement('line');
}
$generator->endObjectElement('ErrorMessage');
}
示例4: visit
/**
* Visit struct returned by controllers.
*
* @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
* @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
* @param \eZ\Publish\Core\REST\Server\Values\UserGroupRefList $data
*/
public function visit(Visitor $visitor, Generator $generator, $data)
{
$generator->startObjectElement('UserGroupRefList');
$visitor->setHeader('Content-Type', $generator->getMediaType('UserGroupRefList'));
//@todo Needs refactoring, disabling certain headers should not be done this way
$visitor->setHeader('Accept-Patch', false);
$generator->startAttribute('href', $data->path);
$generator->endAttribute('href');
$groupCount = count($data->userGroups);
$generator->startList('UserGroup');
foreach ($data->userGroups as $userGroup) {
$generator->startObjectElement('UserGroup');
$generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadUserGroup', array('groupPath' => trim($userGroup->mainLocation->pathString, '/'))));
$generator->endAttribute('href');
if ($data->userId !== null && $groupCount > 1) {
$generator->startHashElement('unassign');
$generator->startAttribute('href', $this->router->generate('ezpublish_rest_unassignUserFromUserGroup', array('userId' => $data->userId, 'groupPath' => $userGroup->mainLocation->path[count($userGroup->mainLocation->path) - 1])));
$generator->endAttribute('href');
$generator->startAttribute('method', 'DELETE');
$generator->endAttribute('method');
$generator->endHashElement('unassign');
}
$generator->endObjectElement('UserGroup');
}
$generator->endList('UserGroup');
$generator->endObjectElement('UserGroupRefList');
}
示例5: visit
/**
* Visit struct returned by controllers.
*
* @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
* @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
* @param \eZ\Publish\API\Repository\Values\User\Policy $data
*/
public function visit(Visitor $visitor, Generator $generator, $data)
{
$generator->startObjectElement('Policy');
$visitor->setHeader('Content-Type', $generator->getMediaType('Policy'));
$visitor->setHeader('Accept-Patch', $generator->getMediaType('PolicyUpdate'));
$generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadPolicy', array('roleId' => $data->roleId, 'policyId' => $data->id)));
$generator->endAttribute('href');
$generator->startValueElement('id', $data->id);
$generator->endValueElement('id');
$generator->startValueElement('module', $data->module);
$generator->endValueElement('module');
$generator->startValueElement('function', $data->function);
$generator->endValueElement('function');
$limitations = $data->getLimitations();
if (!empty($limitations)) {
$generator->startHashElement('limitations');
$generator->startList('limitation');
foreach ($limitations as $limitation) {
$this->visitLimitation($generator, $limitation);
}
$generator->endList('limitation');
$generator->endHashElement('limitations');
}
$generator->endObjectElement('Policy');
}
示例6: visit
/**
* Visit struct returned by controllers.
*
* @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
* @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
* @param \eZ\Publish\Core\REST\Server\Values\ContentTypeGroupRefList $data
*/
public function visit(Visitor $visitor, Generator $generator, $data)
{
$generator->startObjectElement('ContentTypeGroupRefList');
$visitor->setHeader('Content-Type', $generator->getMediaType('ContentTypeGroupRefList'));
$generator->startAttribute('href', $this->router->generate('ezpublish_rest_listContentTypesForGroup', array('contentTypeGroupId' => $data->contentType->id)));
$generator->endAttribute('href');
$groupCount = count($data->contentTypeGroups);
$generator->startList('ContentTypeGroupRef');
foreach ($data->contentTypeGroups as $contentTypeGroup) {
$generator->startObjectElement('ContentTypeGroupRef', 'ContentTypeGroup');
$generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadContentTypeGroup', array('contentTypeGroupId' => $contentTypeGroup->id)));
$generator->endAttribute('href');
// Unlinking last group is not allowed
if ($groupCount > 1) {
$generator->startHashElement('unlink');
$generator->startAttribute('href', $this->router->generate('ezpublish_rest_unlinkContentTypeFromGroup', array('contentTypeId' => $data->contentType->id, 'contentTypeGroupId' => $contentTypeGroup->id)));
$generator->endAttribute('href');
$generator->startAttribute('method', 'DELETE');
$generator->endAttribute('method');
$generator->endHashElement('unlink');
}
$generator->endObjectElement('ContentTypeGroupRef');
}
$generator->endList('ContentTypeGroupRef');
$generator->endObjectElement('ContentTypeGroupRefList');
}
示例7: visit
/**
* Visit struct returned by controllers
*
* @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
* @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
* @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $data
*/
public function visit(Visitor $visitor, Generator $generator, $data)
{
$versionInfo = $data;
$generator->startHashElement('VersionInfo');
$generator->startValueElement('id', $versionInfo->id);
$generator->endValueElement('id');
$generator->startValueElement('versionNo', $versionInfo->versionNo);
$generator->endValueElement('versionNo');
$generator->startValueElement('status', $this->getStatusString($versionInfo->status));
$generator->endValueElement('status');
$generator->startValueElement('modificationDate', $versionInfo->modificationDate->format('c'));
$generator->endValueElement('modificationDate');
$generator->startObjectElement('Creator', 'User');
$generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadUser', array('userId' => $versionInfo->creatorId)));
$generator->endAttribute('href');
$generator->endObjectElement('Creator');
$generator->startValueElement('creationDate', $versionInfo->creationDate->format('c'));
$generator->endValueElement('creationDate');
$generator->startValueElement('initialLanguageCode', $versionInfo->initialLanguageCode);
$generator->endValueElement('initialLanguageCode');
$generator->startValueElement('languageCodes', implode(',', $versionInfo->languageCodes));
$generator->endValueElement('languageCodes');
$this->visitNamesList($generator, $versionInfo->names);
$generator->startObjectElement('Content', 'ContentInfo');
$generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadContent', array('contentId' => $versionInfo->getContentInfo()->id)));
$generator->endAttribute('href');
$generator->endObjectElement('Content');
$generator->endHashElement('VersionInfo');
}
示例8: visitField
/**
* Visits a single content field and generates its content.
*
* @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
* @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType
* @param \eZ\Publish\API\Repository\Values\Content\Field $field
*/
public function visitField(Generator $generator, ContentType $contentType, Field $field)
{
$generator->startHashElement('field');
$generator->startValueElement('fieldDefinitionIdentifier', $field->fieldDefIdentifier);
$generator->endValueElement('fieldDefinitionIdentifier');
$generator->startValueElement('languageCode', $field->languageCode);
$generator->endValueElement('languageCode');
$this->fieldTypeSerializer->serializeFieldValue($generator, $contentType, $field);
$generator->endHashElement('field');
}
示例9: visit
/**
* @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
* @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
* @param mixed $data
*/
public function visit(Visitor $visitor, Generator $generator, $data)
{
$visitor->setHeader('Content-Type', $generator->getMediaType('ContentList'));
if (empty($data->contents)) {
$visitor->setStatus(204);
return;
}
$generator->startObjectElement('contentList');
$generator->startList('content');
foreach ($data->contents as $content) {
$generator->startObjectElement('content');
$generator->startValueElement('contentId', $content['contentId']);
$generator->endValueElement('contentId');
$generator->startValueElement('contentTypeId', $content['contentTypeId']);
$generator->endValueElement('contentTypeId');
$generator->startValueElement('identifier', $content['identifier']);
$generator->endValueElement('identifier');
$generator->startValueElement('language', $content['language']);
$generator->endValueElement('language');
$generator->startValueElement('publishedDate', $content['publishedDate']);
$generator->endValueElement('publishedDate');
$generator->startValueElement('author', $content['author']);
$generator->endValueElement('author');
$generator->startValueElement('uri', $content['uri']);
$generator->endValueElement('uri');
$generator->startValueElement('categoryPath', $content['categoryPath']);
$generator->endValueElement('categoryPath');
$generator->startObjectElement('mainLocation');
$generator->startAttribute('href', $content['mainLocation']['href']);
$generator->endAttribute('href');
$generator->endObjectElement('mainLocation');
$generator->startObjectElement('locations');
$generator->startAttribute('href', $content['locations']['href']);
$generator->endAttribute('href');
$generator->endObjectElement('locations');
$generator->startList('fields');
foreach ($content['fields'] as $field) {
$generator->startHashElement('fields');
$generator->startValueElement('key', $field['key']);
$generator->endValueElement('key');
$generator->startValueElement('value', $field['value']);
$generator->endValueElement('value');
$generator->endHashElement('fields');
}
$generator->endList('fields');
$generator->endObjectElement('content');
}
$generator->endList('content');
$generator->endObjectElement('contentList');
}
示例10: visit
/**
* Visit struct returned by controllers.
*
* @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
* @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
* @param \eZ\Publish\Core\REST\Server\Values\RestExecutedView $data
*/
public function visit(Visitor $visitor, Generator $generator, $data)
{
$generator->startObjectElement('View');
$visitor->setHeader('Content-Type', $generator->getMediaType('View'));
$generator->startAttribute('href', $this->router->generate('ezpublish_rest_views_load', array('viewId' => $data->identifier)));
$generator->endAttribute('href');
$generator->startValueElement('identifier', $data->identifier);
$generator->endValueElement('identifier');
// BEGIN Query
$generator->startObjectElement('Query');
$generator->endObjectElement('Query');
// END Query
// BEGIN Result
$generator->startObjectElement('Result', 'ViewResult');
$generator->startAttribute('href', $this->router->generate('ezpublish_rest_views_load_results', array('viewId' => $data->identifier)));
$generator->endAttribute('href');
// BEGIN searchHits
$generator->startHashElement('searchHits');
$generator->startList('searchHit');
foreach ($data->searchResults->searchHits as $searchHit) {
$generator->startObjectElement('searchHit');
$generator->startAttribute('score', 0);
$generator->endAttribute('score');
$generator->startAttribute('index', 0);
$generator->endAttribute('index');
$generator->startObjectElement('value');
// @todo Refactor
if ($searchHit->valueObject instanceof ApiValues\Content) {
/** @var \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo */
$contentInfo = $searchHit->valueObject->contentInfo;
$valueObject = new RestContentValue($contentInfo, $this->locationService->loadLocation($contentInfo->mainLocationId), $searchHit->valueObject, $this->contentTypeService->loadContentType($contentInfo->contentTypeId), $this->contentService->loadRelations($searchHit->valueObject->getVersionInfo()));
} elseif ($searchHit->valueObject instanceof ApiValues\Location) {
$valueObject = $searchHit->valueObject;
} elseif ($searchHit->valueObject instanceof ApiValues\ContentInfo) {
$valueObject = new RestContentValue($searchHit->valueObject);
} else {
throw new Exceptions\InvalidArgumentException('Unhandled object type');
}
$visitor->visitValueObject($valueObject);
$generator->endObjectElement('value');
$generator->endObjectElement('searchHit');
}
$generator->endList('searchHit');
$generator->endHashElement('searchHits');
// END searchHits
$generator->endObjectElement('Result');
// END Result
$generator->endObjectElement('View');
}
示例11: generateElement
/**
* @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
* @param array $contentList
*
* @return Generator
*/
public function generateElement(Generator $generator, array $contentList = [])
{
$generator->startObjectElement('contentList');
$generator->startList('content');
foreach ($contentList as $content) {
$generator->startObjectElement('content');
$generator->startValueElement('contentId', $content['contentId']);
$generator->endValueElement('contentId');
$generator->startValueElement('contentTypeId', $content['contentTypeId']);
$generator->endValueElement('contentTypeId');
$generator->startValueElement('identifier', $content['identifier']);
$generator->endValueElement('identifier');
$generator->startValueElement('language', $content['language']);
$generator->endValueElement('language');
$generator->startValueElement('publishedDate', $content['publishedDate']);
$generator->endValueElement('publishedDate');
$generator->startValueElement('author', $content['author']);
$generator->endValueElement('author');
$generator->startValueElement('uri', $content['uri']);
$generator->endValueElement('uri');
$generator->startValueElement('categoryPath', $content['categoryPath']);
$generator->endValueElement('categoryPath');
$generator->startObjectElement('mainLocation');
$generator->startAttribute('href', $content['mainLocation']['href']);
$generator->endAttribute('href');
$generator->endObjectElement('mainLocation');
$generator->startObjectElement('locations');
$generator->startAttribute('href', $content['locations']['href']);
$generator->endAttribute('href');
$generator->endObjectElement('locations');
$generator->startList('fields');
foreach ($content['fields'] as $field) {
$generator->startHashElement('fields');
$generator->startValueElement('key', $field['key']);
$generator->endValueElement('key');
$generator->startValueElement('value', $field['value']);
$generator->endValueElement('value');
$generator->endHashElement('fields');
}
$generator->endList('fields');
$generator->endObjectElement('content');
}
$generator->endList('content');
$generator->endObjectElement('contentList');
return $generator;
}
示例12: visit
/**
* Visit struct returned by controllers.
*
* @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
* @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
* @param \eZ\Publish\Core\REST\Server\Values\VersionList $data
*/
public function visit(Visitor $visitor, Generator $generator, $data)
{
$generator->startObjectElement('VersionList');
$visitor->setHeader('Content-Type', $generator->getMediaType('VersionList'));
//@todo Needs refactoring, disabling certain headers should not be done this way
$visitor->setHeader('Accept-Patch', false);
$generator->startAttribute('href', $data->path);
$generator->endAttribute('href');
$generator->startList('VersionItem');
foreach ($data->versions as $version) {
$generator->startHashElement('VersionItem');
$generator->startObjectElement('Version');
$generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadContentInVersion', array('contentId' => $version->getContentInfo()->id, 'versionNumber' => $version->versionNo)));
$generator->endAttribute('href');
$generator->endObjectElement('Version');
$visitor->visitValueObject($version);
$generator->endHashElement('VersionItem');
}
$generator->endList('VersionItem');
$generator->endObjectElement('VersionList');
}
示例13: visit
/**
* Visit struct returned by controllers.
*
* @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
* @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
* @param \eZ\Publish\Core\REST\Common\Values\Root $data
*/
public function visit(Visitor $visitor, Generator $generator, $data)
{
$generator->startObjectElement('Root');
$visitor->setHeader('Content-Type', $generator->getMediaType('Root'));
foreach ($data->getResources() as $resource) {
if ($resource->mediaType === '') {
$generator->startHashElement($resource->name);
$generator->startAttribute('media-type', $resource->mediaType);
$generator->endAttribute('media-type');
} else {
$generator->startObjectElement($resource->name, $resource->mediaType);
}
$generator->startAttribute('href', $resource->href);
$generator->endAttribute('href');
if ($resource->mediaType === '') {
$generator->endHashElement($resource->name);
} else {
$generator->endObjectElement($resource->name);
}
}
$generator->endObjectElement('Root');
}
示例14: visit
/**
* Visit struct returned by controllers
*
* @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
* @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
* @param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeCreateStruct $contentTypeCreateStruct
*/
public function visit(Visitor $visitor, Generator $generator, $contentTypeCreateStruct)
{
$generator->startObjectElement("ContentTypeCreate");
$visitor->setHeader("Content-Type", $generator->getMediaType("ContentTypeCreate"));
$generator->startValueElement("identifier", $contentTypeCreateStruct->identifier);
$generator->endValueElement("identifier");
$generator->startValueElement("remoteId", $contentTypeCreateStruct->remoteId);
$generator->endValueElement("remoteId");
$generator->startValueElement("urlAliasSchema", $contentTypeCreateStruct->urlAliasSchema);
$generator->endValueElement("urlAliasSchema");
$generator->startValueElement("nameSchema", $contentTypeCreateStruct->nameSchema);
$generator->endValueElement("nameSchema");
$generator->startValueElement("isContainer", $contentTypeCreateStruct->isContainer ? "true" : "false");
$generator->endValueElement("isContainer");
$generator->startValueElement("mainLanguageCode", $contentTypeCreateStruct->mainLanguageCode);
$generator->endValueElement("mainLanguageCode");
$generator->startValueElement("defaultAlwaysAvailable", $contentTypeCreateStruct->defaultAlwaysAvailable ? "true" : "false");
$generator->endValueElement("defaultAlwaysAvailable");
$generator->startValueElement("defaultSortField", $this->serializeSortField($contentTypeCreateStruct->defaultSortField));
$generator->endValueElement("defaultSortField");
$generator->startValueElement("defaultSortOrder", $this->serializeSortOrder($contentTypeCreateStruct->defaultSortOrder));
$generator->endValueElement("defaultSortOrder");
if (!empty($contentTypeCreateStruct->names)) {
$generator->startHashElement("names");
$generator->startList('value');
foreach ($contentTypeCreateStruct->names as $languageCode => $name) {
$generator->startValueElement("value", $name, array("languageCode" => $languageCode));
$generator->endValueElement("value");
}
$generator->endList('value');
$generator->endHashElement("names");
}
if (!empty($contentTypeCreateStruct->descriptions)) {
$generator->startHashElement("descriptions");
$generator->startList('value');
foreach ($contentTypeCreateStruct->descriptions as $languageCode => $description) {
$generator->startValueElement("value", $description, array("languageCode" => $languageCode));
$generator->endValueElement("value");
}
$generator->endList('value');
$generator->endHashElement("descriptions");
}
if ($contentTypeCreateStruct->creationDate !== null) {
$generator->startValueElement("modificationDate", $contentTypeCreateStruct->creationDate->format("c"));
$generator->endValueElement("modificationDate");
}
if ($contentTypeCreateStruct->creatorId !== null) {
$generator->startObjectElement("User");
$generator->startAttribute("href", $contentTypeCreateStruct->creatorId);
$generator->endAttribute("href");
$generator->endObjectElement("User");
}
if (!empty($contentTypeCreateStruct->fieldDefinitions)) {
$generator->startHashElement("FieldDefinitions");
$generator->startList("FieldDefinition");
foreach ($contentTypeCreateStruct->fieldDefinitions as $fieldDefinitionCreateStruct) {
$visitor->visitValueObject($fieldDefinitionCreateStruct);
}
$generator->endList("FieldDefinition");
$generator->endHashElement("FieldDefinitions");
}
$generator->endObjectElement("ContentTypeCreate");
}
示例15: visitLimitation
/**
* Visits a limitation
*
* @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
* @param \eZ\Publish\API\Repository\Values\User\Limitation $limitation
*/
protected function visitLimitation(Generator $generator, Limitation $limitation)
{
$generator->startHashElement('limitation');
$generator->startAttribute('identifier', $limitation->getIdentifier());
$generator->endAttribute('identifier');
$generator->startHashElement('values');
$generator->startList('ref');
foreach ($limitation->limitationValues as $limitationValue) {
$generator->startObjectElement('ref');
$generator->startAttribute('href', $limitationValue);
$generator->endAttribute('href');
$generator->endObjectElement('ref');
}
$generator->endList('ref');
$generator->endHashElement('values');
$generator->endHashElement('limitation');
}