当前位置: 首页>>代码示例>>PHP>>正文


PHP Generator::startValueElement方法代码示例

本文整理汇总了PHP中eZ\Publish\Core\REST\Common\Output\Generator::startValueElement方法的典型用法代码示例。如果您正苦于以下问题:PHP Generator::startValueElement方法的具体用法?PHP Generator::startValueElement怎么用?PHP Generator::startValueElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZ\Publish\Core\REST\Common\Output\Generator的用法示例。


在下文中一共展示了Generator::startValueElement方法的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 \eZ\Publish\API\Repository\Values\Content\URLAlias $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('UrlAlias');
     $visitor->setHeader('Content-Type', $generator->getMediaType('UrlAlias'));
     $generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadURLAlias', array('urlAliasId' => $data->id)));
     $generator->endAttribute('href');
     $generator->startAttribute('id', $data->id);
     $generator->endAttribute('id');
     $generator->startAttribute('type', $this->serializeType($data->type));
     $generator->endAttribute('type');
     if ($data->type === Values\Content\URLAlias::LOCATION) {
         $generator->startObjectElement('location', 'Location');
         $generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadLocation', array('locationPath' => $data->destination)));
         $generator->endAttribute('href');
         $generator->endObjectElement('location');
     } else {
         $generator->startValueElement('resource', $data->destination);
         $generator->endValueElement('resource');
     }
     $generator->startValueElement('path', $data->path);
     $generator->endValueElement('path');
     $generator->startValueElement('languageCodes', implode(',', $data->languageCodes));
     $generator->endValueElement('languageCodes');
     $generator->startValueElement('alwaysAvailable', $this->serializeBool($generator, $data->alwaysAvailable));
     $generator->endValueElement('alwaysAvailable');
     $generator->startValueElement('isHistory', $this->serializeBool($generator, $data->isHistory));
     $generator->endValueElement('isHistory');
     $generator->startValueElement('forward', $this->serializeBool($generator, $data->forward));
     $generator->endValueElement('forward');
     $generator->startValueElement('custom', $this->serializeBool($generator, $data->isCustom));
     $generator->endValueElement('custom');
     $generator->endObjectElement('UrlAlias');
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:40,代码来源:URLAlias.php

示例2: 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 \Exception $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');
     if ($data instanceof Translatable && $this->translator) {
         /** @Ignore */
         $errorDescription = $this->translator->trans($data->getMessageTemplate(), $data->getParameters(), 'repository_exceptions');
     } else {
         $errorDescription = $data->getMessage();
     }
     $generator->startValueElement('errorDescription', $errorDescription);
     $generator->endValueElement('errorDescription');
     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');
     }
     if ($previous = $data->getPrevious()) {
         $generator->startObjectElement('Previous', 'ErrorMessage');
         $visitor->visitValueObject($previous);
         $generator->endObjectElement('Previous');
     }
     $generator->endObjectElement('ErrorMessage');
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:40,代码来源:Exception.php

示例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 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');
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:33,代码来源:ObjectStateCreateStruct.php

示例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\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');
 }
开发者ID:Heyfara,项目名称:ezpublish-kernel,代码行数:32,代码来源:Policy.php

示例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\Core\REST\Common\Values\RestObjectState $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('ObjectState');
     $visitor->setHeader('Content-Type', $generator->getMediaType('ObjectState'));
     $visitor->setHeader('Accept-Patch', $generator->getMediaType('ObjectStateUpdate'));
     $generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadObjectState', array('objectStateGroupId' => $data->groupId, 'objectStateId' => $data->objectState->id)));
     $generator->endAttribute('href');
     $generator->startValueElement('id', $data->objectState->id);
     $generator->endValueElement('id');
     $generator->startValueElement('identifier', $data->objectState->identifier);
     $generator->endValueElement('identifier');
     $generator->startValueElement('priority', $data->objectState->priority);
     $generator->endValueElement('priority');
     $generator->startObjectElement('ObjectStateGroup');
     $generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadObjectStateGroup', array('objectStateGroupId' => $data->groupId)));
     $generator->endAttribute('href');
     $generator->endObjectElement('ObjectStateGroup');
     $generator->startValueElement('defaultLanguageCode', $data->objectState->defaultLanguageCode);
     $generator->endValueElement('defaultLanguageCode');
     $generator->startValueElement('languageCodes', implode(',', $data->objectState->languageCodes));
     $generator->endValueElement('languageCodes');
     $this->visitNamesList($generator, $data->objectState->getNames());
     $this->visitDescriptionsList($generator, $data->objectState->getDescriptions());
     $generator->endObjectElement('ObjectState');
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:32,代码来源:RestObjectState.php

示例6: visit

 /**
  * @param \eZ\Publish\SPI\Variation\Values\ImageVariation $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('ContentImageVariation');
     $generator->startAttribute('href', $this->router->generate('ezpublish_rest_binaryContent_getImageVariation', array('imageId' => $data->imageId, 'variationIdentifier' => $data->name)));
     $generator->endAttribute('href');
     $generator->startValueElement('uri', $data->uri);
     $generator->endValueElement('uri');
     if ($data->mimeType) {
         $generator->startValueElement('contentType', $data->mimeType);
         $generator->endValueElement('contentType');
     }
     if ($data->width) {
         $generator->startValueElement('width', $data->width);
         $generator->endValueElement('width');
     }
     if ($data->height) {
         $generator->startValueElement('height', $data->height);
         $generator->endValueElement('height');
     }
     if ($data->fileSize) {
         $generator->startValueElement('fileSize', $data->fileSize);
         $generator->endValueElement('fileSize');
     }
     $generator->endObjectElement('ContentImageVariation');
 }
开发者ID:Heyfara,项目名称:ezpublish-kernel,代码行数:28,代码来源:ImageVariation.php

示例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\ContentType\ContentTypeGroup $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('ContentTypeGroup');
     $visitor->setHeader('Content-Type', $generator->getMediaType('ContentTypeGroup'));
     $visitor->setHeader('Accept-Patch', $generator->getMediaType('ContentTypeGroupInput'));
     $generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadContentTypeGroup', array('contentTypeGroupId' => $data->id)));
     $generator->endAttribute('href');
     $generator->startValueElement('id', $data->id);
     $generator->endValueElement('id');
     $generator->startValueElement('identifier', $data->identifier);
     $generator->endValueElement('identifier');
     $generator->startValueElement('created', $data->creationDate->format('c'));
     $generator->endValueElement('created');
     $generator->startValueElement('modified', $data->modificationDate->format('c'));
     $generator->endValueElement('modified');
     $generator->startObjectElement('Creator', 'User');
     $generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadUser', array('userId' => $data->creatorId)));
     $generator->endAttribute('href');
     $generator->endObjectElement('Creator');
     $generator->startObjectElement('Modifier', 'User');
     $generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadUser', array('userId' => $data->modifierId)));
     $generator->endAttribute('href');
     $generator->endObjectElement('Modifier');
     $generator->startObjectElement('ContentTypes', 'ContentTypeInfoList');
     $generator->startAttribute('href', $this->router->generate('ezpublish_rest_listContentTypesForGroup', array('contentTypeGroupId' => $data->id)));
     $generator->endAttribute('href');
     $generator->endObjectElement('ContentTypes');
     $generator->endObjectElement('ContentTypeGroup');
 }
开发者ID:dfritschy,项目名称:ezpublish-kernel,代码行数:36,代码来源:ContentTypeGroup.php

示例8: 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 Result metadata
     $generator->startValueElement('count', $data->searchResults->totalCount);
     $generator->endValueElement('count');
     $generator->startValueElement('time', $data->searchResults->time);
     $generator->endValueElement('time');
     $generator->startValueElement('timedOut', $generator->serializeBool($data->searchResults->timedOut));
     $generator->endValueElement('timedOut');
     $generator->startValueElement('maxScore', $data->searchResults->maxScore);
     $generator->endValueElement('maxScore');
     // END Result metadata
     // 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');
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:66,代码来源:RestExecutedView.php

示例9: 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('SessionInput');
     $visitor->setHeader('Content-Type', $generator->getMediaType('SessionInput'));
     $generator->startValueElement('login', $data->login);
     $generator->endValueElement('login');
     $generator->startValueElement('password', $data->password);
     $generator->endValueElement('password');
     $generator->endObjectElement('SessionInput');
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:17,代码来源:SessionInput.php

示例10: 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');
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:17,代码来源:RestContentCreateStruct.php

示例11: 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('SectionInput');
     $visitor->setHeader('Content-Type', $generator->getMediaType('SectionInput'));
     $generator->startValueElement('identifier', $data->identifier);
     $generator->endValueElement('identifier');
     $generator->startValueElement('name', $data->name);
     $generator->endValueElement('name');
     $generator->endObjectElement('SectionInput');
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:17,代码来源:SectionCreateStruct.php

示例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\RestLocation $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('Location');
     $visitor->setHeader('Content-Type', $generator->getMediaType('Location'));
     $visitor->setHeader('Accept-Patch', $generator->getMediaType('LocationUpdate'));
     $location = $data->location;
     $contentInfo = $location->getContentInfo();
     $generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadLocation', array('locationPath' => trim($location->pathString, '/'))));
     $generator->endAttribute('href');
     $generator->startValueElement('id', $location->id);
     $generator->endValueElement('id');
     $generator->startValueElement('priority', $location->priority);
     $generator->endValueElement('priority');
     $generator->startValueElement('hidden', $this->serializeBool($generator, $location->hidden));
     $generator->endValueElement('hidden');
     $generator->startValueElement('invisible', $this->serializeBool($generator, $location->invisible));
     $generator->endValueElement('invisible');
     $generator->startObjectElement('ParentLocation', 'Location');
     if (trim($location->pathString, '/') !== '1') {
         $generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadLocation', array('locationPath' => implode('/', array_slice($location->path, 0, count($location->path) - 1)))));
         $generator->endAttribute('href');
     }
     $generator->endObjectElement('ParentLocation');
     $generator->startValueElement('pathString', $location->pathString);
     $generator->endValueElement('pathString');
     $generator->startValueElement('depth', $location->depth);
     $generator->endValueElement('depth');
     $generator->startValueElement('childCount', $data->childCount);
     $generator->endValueElement('childCount');
     $generator->startValueElement('remoteId', $location->remoteId);
     $generator->endValueElement('remoteId');
     $generator->startObjectElement('Children', 'LocationList');
     $generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadLocationChildren', array('locationPath' => trim($location->pathString, '/'))));
     $generator->endAttribute('href');
     $generator->endObjectElement('Children');
     $generator->startObjectElement('Content');
     $generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadContent', array('contentId' => $contentInfo->id)));
     $generator->endAttribute('href');
     $generator->endObjectElement('Content');
     $generator->startValueElement('sortField', $this->serializeSortField($location->sortField));
     $generator->endValueElement('sortField');
     $generator->startValueElement('sortOrder', $this->serializeSortOrder($location->sortOrder));
     $generator->endValueElement('sortOrder');
     $generator->startObjectElement('UrlAliases', 'UrlAliasRefList');
     $generator->startAttribute('href', $this->router->generate('ezpublish_rest_listLocationURLAliases', array('locationPath' => trim($location->pathString, '/'))));
     $generator->endAttribute('href');
     $generator->endObjectElement('UrlAliases');
     $generator->startObjectElement('ContentInfo', 'ContentInfo');
     $generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadContent', array('contentId' => $contentInfo->id)));
     $generator->endAttribute('href');
     $visitor->visitValueObject(new RestContentValue($contentInfo));
     $generator->endObjectElement('ContentInfo');
     $generator->endObjectElement('Location');
 }
开发者ID:kuborgh,项目名称:ezpublish-kernel,代码行数:61,代码来源:RestLocation.php

示例13: 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');
 }
开发者ID:sdaoudi,项目名称:EzSystemsRecommendationBundle,代码行数:55,代码来源:ContentData.php

示例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 mixed $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('LocationUpdate');
     $visitor->setHeader('Content-Type', $generator->getMediaType('LocationUpdate'));
     $generator->startValueElement('priority', $data->priority);
     $generator->endValueElement('priority');
     $generator->startValueElement('remoteId', $data->remoteId);
     $generator->endValueElement('remoteId');
     $generator->startValueElement('sortField', $this->getSortFieldName($data->sortField));
     $generator->endValueElement('sortField');
     $generator->startValueElement('sortOrder', $data->sortOrder == Location::SORT_ORDER_ASC ? 'ASC' : 'DESC');
     $generator->endValueElement('sortOrder');
     $generator->endObjectElement('LocationUpdate');
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:21,代码来源:LocationUpdateStruct.php

示例15: 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\Section $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('Section');
     $visitor->setHeader('Content-Type', $generator->getMediaType('Section'));
     $visitor->setHeader('Accept-Patch', $generator->getMediaType('SectionInput'));
     $generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadSection', array('sectionId' => $data->id)));
     $generator->endAttribute('href');
     $generator->startValueElement('sectionId', $data->id);
     $generator->endValueElement('sectionId');
     $generator->startValueElement('identifier', $data->identifier);
     $generator->endValueElement('identifier');
     $generator->startValueElement('name', $data->name);
     $generator->endValueElement('name');
     $generator->endObjectElement('Section');
 }
开发者ID:Heyfara,项目名称:ezpublish-kernel,代码行数:22,代码来源:Section.php


注:本文中的eZ\Publish\Core\REST\Common\Output\Generator::startValueElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。