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


PHP Generator::endList方法代码示例

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


在下文中一共展示了Generator::endList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例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 \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');
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:55,代码来源:ContentFieldValidationException.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 \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');
 }
开发者ID:Heyfara,项目名称:ezpublish-kernel,代码行数:34,代码来源:UserGroupRefList.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\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');
 }
开发者ID:Heyfara,项目名称:ezpublish-kernel,代码行数:33,代码来源:ContentTypeGroupRefList.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 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

示例6: 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;
 }
开发者ID:kamilmusial,项目名称:EzSystemsRecommendationBundle,代码行数:52,代码来源:ContentListElementGenerator.php

示例7: visit

 /**
  * @param Visitor $visitor
  * @param Generator $generator
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion\ContentTypeIdentifier $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $contentTypeIdentifiers = is_array($data->value) ? $data->value : [$data->value];
     $generator->startList('ContentTypeIdentifierCriterion');
     foreach ($contentTypeIdentifiers as $contentTypeIdentifier) {
         $generator->startValueElement('ContentTypeIdentifierCriterion', $contentTypeIdentifier);
         $generator->endValueElement('ContentTypeIdentifierCriterion');
     }
     $generator->endList('ContentTypeIdentifierCriterion');
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:15,代码来源:ContentTypeIdentifier.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\Trash $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('Trash');
     $visitor->setHeader('Content-Type', $generator->getMediaType('Trash'));
     $generator->startAttribute('href', $data->path);
     $generator->endAttribute('href');
     $generator->startList('TrashItem');
     foreach ($data->trashItems as $trashItem) {
         $visitor->visitValueObject($trashItem);
     }
     $generator->endList('TrashItem');
     $generator->endObjectElement('Trash');
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:20,代码来源:Trash.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 \eZ\Publish\Core\REST\Server\Values\URLAliasList $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('UrlAliasList');
     $visitor->setHeader('Content-Type', $generator->getMediaType('UrlAliasList'));
     $generator->startAttribute('href', $data->path);
     $generator->endAttribute('href');
     $generator->startList('UrlAlias');
     foreach ($data->urlAliases as $urlAlias) {
         $visitor->visitValueObject($urlAlias);
     }
     $generator->endList('UrlAlias');
     $generator->endObjectElement('UrlAliasList');
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:20,代码来源:URLAliasList.php

示例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\URLWildcardList $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('UrlWildcardList');
     $visitor->setHeader('Content-Type', $generator->getMediaType('UrlWildcardList'));
     $generator->startAttribute('href', $this->router->generate('ezpublish_rest_listURLWildcards'));
     $generator->endAttribute('href');
     $generator->startList('UrlWildcard');
     foreach ($data->urlWildcards as $urlWildcard) {
         $visitor->visitValueObject($urlWildcard);
     }
     $generator->endList('UrlWildcard');
     $generator->endObjectElement('UrlWildcardList');
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:20,代码来源:URLWildcardList.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 \eZ\Publish\Core\REST\Server\Values\RoleAssignmentList $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('RoleAssignmentList');
     $visitor->setHeader('Content-Type', $generator->getMediaType('RoleAssignmentList'));
     $generator->startAttribute('href', $data->isGroupAssignment ? $this->router->generate('ezpublish_rest_loadRoleAssignmentsForUserGroup', array('groupPath' => $data->id)) : $this->router->generate('ezpublish_rest_loadRoleAssignmentsForUser', array('userId' => $data->id)));
     $generator->endAttribute('href');
     $generator->startList('RoleAssignment');
     foreach ($data->roleAssignments as $roleAssignment) {
         $visitor->visitValueObject($data->isGroupAssignment ? new Values\RestUserGroupRoleAssignment($roleAssignment, $data->id) : new Values\RestUserRoleAssignment($roleAssignment, $data->id));
     }
     $generator->endList('RoleAssignment');
     $generator->endObjectElement('RoleAssignmentList');
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:20,代码来源:RoleAssignmentList.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 mixed $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('ContentObjectStates');
     $visitor->setHeader('Content-Type', $generator->getMediaType('ContentObjectStates'));
     $generator->startList('ObjectState');
     foreach ($data->states as $state) {
         $generator->startObjectElement('ObjectState');
         $generator->startAttribute('href', $this->requestParser->generate('objectstate', array('objectstategroup' => $state->groupId, 'objectstate' => $state->objectState->id)));
         $generator->endAttribute('href');
         $generator->endObjectElement('ObjectState');
     }
     $generator->endList('ObjectState');
     $generator->endObjectElement('ContentObjectStates');
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:21,代码来源:ContentObjectStates.php

示例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\Server\Values\ObjectStateList $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('ObjectStateList');
     $visitor->setHeader('Content-Type', $generator->getMediaType('ObjectStateList'));
     //@todo Needs refactoring, disabling certain headers should not be done this way
     $visitor->setHeader('Accept-Patch', false);
     $generator->startAttribute('href', $this->router->generate('ezpublish_rest_loadObjectStates', array('objectStateGroupId' => $data->groupId)));
     $generator->endAttribute('href');
     $generator->startList('ObjectState');
     foreach ($data->states as $state) {
         $visitor->visitValueObject(new RestObjectStateValue($state, $data->groupId));
     }
     $generator->endList('ObjectState');
     $generator->endObjectElement('ObjectStateList');
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:22,代码来源:ObjectStateList.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 \eZ\Publish\Core\REST\Server\Values\ContentList $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('ContentList');
     $visitor->setHeader('Content-Type', $generator->getMediaType('ContentList'));
     //@todo Needs refactoring, disabling certain headers should not be done this way
     $visitor->setHeader('Accept-Patch', false);
     $generator->startAttribute('href', $this->router->generate('ezpublish_rest_redirectContent'));
     $generator->endAttribute('href');
     $generator->startList('ContentInfo');
     foreach ($data->contents as $content) {
         $visitor->visitValueObject($content);
     }
     $generator->endList('ContentInfo');
     $generator->endObjectElement('ContentList');
 }
开发者ID:dfritschy,项目名称:ezpublish-kernel,代码行数:22,代码来源:ContentList.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\Core\REST\Server\Values\ContentTypeInfoList $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('ContentTypeInfoList');
     $visitor->setHeader('Content-Type', $generator->getMediaType('ContentTypeInfoList'));
     //@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('ContentType');
     foreach ($data->contentTypes as $contentType) {
         $visitor->visitValueObject(new Values\RestContentType($contentType));
     }
     $generator->endList('ContentType');
     $generator->endObjectElement('ContentTypeInfoList');
 }
开发者ID:dfritschy,项目名称:ezpublish-kernel,代码行数:22,代码来源:ContentTypeInfoList.php


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