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


PHP Output\Generator类代码示例

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


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

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

示例2: visit

 /**
  * @param \eZ\Publish\Core\REST\Common\Output\Visitor $visitor
  * @param \eZ\Publish\Core\REST\Common\Output\Generator $generator
  * @param mixed $data
  * @return mixed
  * @throws \EzSystems\RecommendationBundle\Rest\Exception\ResponseClassNotImplementedException
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $visitor->setHeader('Content-Type', $generator->getMediaType('ContentList'));
     if (empty($data->contents)) {
         $visitor->setStatus(204);
         return;
     }
     if (!isset($this->responseRenderers[$data->options['responseType']])) {
         throw new ResponseClassNotImplementedException(sprintf('Renderer for %s response not implemented.', $data->options['responseType']));
     }
     return $this->responseRenderers[$data->options['responseType']]->render($generator, $data);
 }
开发者ID:kamilmusial,项目名称:EzSystemsRecommendationBundle,代码行数:19,代码来源:ContentData.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('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

示例4: visit

 /**
  * @param Visitor $visitor
  * @param Generator $generator
  * @param \eZ\Publish\Core\REST\Client\Values\ViewInput $data
  * @throws Exceptions\InvalidArgumentException
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('ViewInput');
     $generator->startValueElement('identifier', $data->identifier);
     $generator->endValueElement('identifier');
     if ($data->locationQuery !== null) {
         $queryElementName = 'locationQuery';
     } elseif ($data->contentQuery !== null) {
         $queryElementName = 'contentQuery';
     } else {
         throw new Exceptions\InvalidArgumentException("ViewInput Query", "No content nor location query found in ViewInput");
     }
     $visitor->visitValueObject($data->{$queryElementName});
     $generator->endObjectElement('ViewInput');
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:21,代码来源:ViewInput.php

示例5: 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('id', $field->id);
     $generator->endValueElement('id');
     $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:CG77,项目名称:ezpublish-kernel,代码行数:19,代码来源:Version.php

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

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

示例8: 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);
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:29,代码来源:Query.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\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

示例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\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

示例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\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

示例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 mixed $data
  */
 public function visit(Visitor $visitor, Generator $generator, $data)
 {
     $generator->startObjectElement('RoleAssignInput');
     $visitor->setHeader('Content-Type', $generator->getMediaType('RoleAssignInput'));
     $generator->startObjectElement('Role');
     $generator->startAttribute('href', $this->requestParser->generate('role', array('role' => $data->getRole()->id)));
     $generator->endAttribute('href');
     $generator->endObjectElement('Role');
     $roleLimitation = $data->getRoleLimitation();
     if ($roleLimitation !== null) {
         $visitor->visitValueObject($roleLimitation);
     }
     $generator->endObjectElement('RoleAssignInput');
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:21,代码来源:RoleAssignment.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\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

示例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\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


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