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


PHP ParserTools::parseTranslatableList方法代码示例

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


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

示例1: parse

 /**
  * Parse input structure.
  *
  * @param array $data
  * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
  *
  * @return \Netgen\TagsBundle\API\Repository\Values\Tags\TagCreateStruct
  */
 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
 {
     if (!array_key_exists('ParentTag', $data) || !is_array($data['ParentTag'])) {
         throw new Exceptions\Parser("Missing or invalid 'ParentTag' element for TagCreate.");
     }
     if (!array_key_exists('_href', $data['ParentTag'])) {
         throw new Exceptions\Parser("Missing '_href' attribute for ParentTag element in TagCreate.");
     }
     if (!array_key_exists('mainLanguageCode', $data)) {
         throw new Exceptions\Parser("Missing 'mainLanguageCode' element for TagCreate.");
     }
     $tagHrefParts = explode('/', $this->requestParser->parseHref($data['ParentTag']['_href'], 'tagPath'));
     $tagCreateStruct = $this->tagsService->newTagCreateStruct(array_pop($tagHrefParts), $data['mainLanguageCode']);
     if (array_key_exists('remoteId', $data)) {
         $tagCreateStruct->remoteId = $data['remoteId'];
     }
     if (array_key_exists('alwaysAvailable', $data)) {
         $tagCreateStruct->alwaysAvailable = $this->parserTools->parseBooleanValue($data['alwaysAvailable']);
     }
     if (array_key_exists('names', $data)) {
         if (!is_array($data['names']) || !array_key_exists('value', $data['names']) || !is_array($data['names']['value'])) {
             throw new Exceptions\Parser("Invalid 'names' element for TagCreate.");
         }
         $keywords = $this->parserTools->parseTranslatableList($data['names']);
         foreach ($keywords as $languageCode => $keyword) {
             $tagCreateStruct->setKeyword($keyword, $languageCode);
         }
     }
     return $tagCreateStruct;
 }
开发者ID:netgen,项目名称:tagsbundle,代码行数:38,代码来源:TagCreate.php

示例2: parse

 /**
  * Parse input structure.
  *
  * @param array $data
  * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
  *
  * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateCreateStruct
  */
 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
 {
     if (!array_key_exists('identifier', $data)) {
         throw new Exceptions\Parser("Missing 'identifier' attribute for ObjectStateCreate.");
     }
     $objectStateCreateStruct = $this->objectStateService->newObjectStateCreateStruct($data['identifier']);
     if (!array_key_exists('priority', $data)) {
         throw new Exceptions\Parser("Missing 'priority' attribute for ObjectStateCreate.");
     }
     $objectStateCreateStruct->priority = (int) $data['priority'];
     if (!array_key_exists('defaultLanguageCode', $data)) {
         throw new Exceptions\Parser("Missing 'defaultLanguageCode' attribute for ObjectStateCreate.");
     }
     $objectStateCreateStruct->defaultLanguageCode = $data['defaultLanguageCode'];
     if (!array_key_exists('names', $data) || !is_array($data['names'])) {
         throw new Exceptions\Parser("Missing or invalid 'names' element for ObjectStateCreate.");
     }
     if (!array_key_exists('value', $data['names']) || !is_array($data['names']['value'])) {
         throw new Exceptions\Parser("Missing or invalid 'names' element for ObjectStateCreate.");
     }
     $objectStateCreateStruct->names = $this->parserTools->parseTranslatableList($data['names']);
     // @todo XSD says that descriptions field is mandatory. Does that make sense?
     if (array_key_exists('descriptions', $data) && is_array($data['descriptions'])) {
         $objectStateCreateStruct->descriptions = $this->parserTools->parseTranslatableList($data['descriptions']);
     }
     return $objectStateCreateStruct;
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:35,代码来源:ObjectStateCreate.php

示例3: parse

 /**
  * Parse input structure
  *
  * @param array $data
  * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
  *
  * @return \eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionUpdateStruct
  */
 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
 {
     $fieldDefinitionUpdate = $this->contentTypeService->newFieldDefinitionUpdateStruct();
     if (array_key_exists('identifier', $data)) {
         $fieldDefinitionUpdate->identifier = $data['identifier'];
     }
     // @todo XSD says that descriptions is mandatory, but field definition can be updated without it
     if (array_key_exists('names', $data)) {
         if (!is_array($data['names']) || !array_key_exists('value', $data['names']) || !is_array($data['names']['value'])) {
             throw new Exceptions\Parser("Invalid 'names' element for FieldDefinitionUpdate.");
         }
         $fieldDefinitionUpdate->names = $this->parserTools->parseTranslatableList($data['names']);
     }
     // @todo XSD says that descriptions is mandatory, but field definition can be updated without it
     if (array_key_exists('descriptions', $data)) {
         if (!is_array($data['descriptions']) || !array_key_exists('value', $data['descriptions']) || !is_array($data['descriptions']['value'])) {
             throw new Exceptions\Parser("Invalid 'descriptions' element for FieldDefinitionUpdate.");
         }
         $fieldDefinitionUpdate->descriptions = $this->parserTools->parseTranslatableList($data['descriptions']);
     }
     // @todo XSD says that fieldGroup is mandatory, but field definition can be updated without it
     if (array_key_exists('fieldGroup', $data)) {
         $fieldDefinitionUpdate->fieldGroup = $data['fieldGroup'];
     }
     // @todo XSD says that position is mandatory, but field definition can be updated without it
     if (array_key_exists('position', $data)) {
         $fieldDefinitionUpdate->position = (int) $data['position'];
     }
     // @todo XSD says that isTranslatable is mandatory, but field definition can be updated without it
     if (array_key_exists('isTranslatable', $data)) {
         $fieldDefinitionUpdate->isTranslatable = $this->parserTools->parseBooleanValue($data['isTranslatable']);
     }
     // @todo XSD says that isRequired is mandatory, but field definition can be updated without it
     if (array_key_exists('isRequired', $data)) {
         $fieldDefinitionUpdate->isRequired = $this->parserTools->parseBooleanValue($data['isRequired']);
     }
     // @todo XSD says that isInfoCollector is mandatory, but field definition can be updated without it
     if (array_key_exists('isInfoCollector', $data)) {
         $fieldDefinitionUpdate->isInfoCollector = $this->parserTools->parseBooleanValue($data['isInfoCollector']);
     }
     // @todo XSD says that isSearchable is mandatory, but field definition can be updated without it
     if (array_key_exists('isSearchable', $data)) {
         $fieldDefinitionUpdate->isSearchable = $this->parserTools->parseBooleanValue($data['isSearchable']);
     }
     $fieldDefinition = $this->getFieldDefinition($data);
     // @todo XSD says that defaultValue is mandatory, but content type can be created without it
     if (array_key_exists('defaultValue', $data)) {
         $fieldDefinitionUpdate->defaultValue = $this->fieldTypeParser->parseValue($fieldDefinition->fieldTypeIdentifier, $data['defaultValue']);
     }
     if (array_key_exists('validatorConfiguration', $data)) {
         $fieldDefinitionUpdate->validatorConfiguration = $this->fieldTypeParser->parseValidatorConfiguration($fieldDefinition->fieldTypeIdentifier, $data['validatorConfiguration']);
     }
     if (array_key_exists('fieldSettings', $data)) {
         $fieldDefinitionUpdate->fieldSettings = $this->fieldTypeParser->parseFieldSettings($fieldDefinition->fieldTypeIdentifier, $data['fieldSettings']);
     }
     return $fieldDefinitionUpdate;
 }
开发者ID:dfritschy,项目名称:ezpublish-kernel,代码行数:65,代码来源:FieldDefinitionUpdate.php

示例4: parse

 /**
  * Parse input structure
  *
  * @param array $data
  * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
  *
  * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType
  * @todo Error handling
  * @todo What about missing properties? Set them here, using the service to
  *       load? Or better set them in the service, since loading is really
  *       unsuitable here?
  */
 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
 {
     $creatorId = $this->parserTools->parseObjectElement($data['Creator'], $parsingDispatcher);
     $modifierId = $this->parserTools->parseObjectElement($data['Modifier'], $parsingDispatcher);
     $fieldDefinitionListReference = $this->parserTools->parseObjectElement($data['FieldDefinitions'], $parsingDispatcher);
     $contentType = new Values\ContentType\ContentType($this->contentTypeService, array('id' => $data['_href'], 'status' => $this->parserTools->parseStatus($data['status']), 'identifier' => $data['identifier'], 'names' => isset($data['names']) ? $this->parserTools->parseTranslatableList($data['names']) : null, 'descriptions' => isset($data['descriptions']) ? $this->parserTools->parseTranslatableList($data['descriptions']) : null, 'creationDate' => new \DateTime($data['creationDate']), 'modificationDate' => new \DateTime($data['modificationDate']), 'creatorId' => $creatorId, 'modifierId' => $modifierId, 'remoteId' => $data['remoteId'], 'urlAliasSchema' => $data['urlAliasSchema'], 'nameSchema' => $data['nameSchema'], 'isContainer' => $this->parserTools->parseBooleanValue($data['isContainer']), 'mainLanguageCode' => $data['mainLanguageCode'], 'defaultAlwaysAvailable' => $this->parserTools->parseBooleanValue($data['defaultAlwaysAvailable']), 'defaultSortOrder' => $this->parserTools->parseDefaultSortOrder($data['defaultSortOrder']), 'defaultSortField' => $this->parserTools->parseDefaultSortField($data['defaultSortField']), 'fieldDefinitionListReference' => $fieldDefinitionListReference));
     if ($contentType->status === Values\ContentType\ContentType::STATUS_DRAFT) {
         return new Values\ContentType\ContentTypeDraft($contentType);
     }
     return $contentType;
 }
开发者ID:dfritschy,项目名称:ezpublish-kernel,代码行数:23,代码来源:ContentType.php

示例5: parse

 /**
  * Parse input structure.
  *
  * @param array $data
  * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
  *
  * @return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeUpdateStruct
  */
 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
 {
     $contentTypeUpdateStruct = $this->contentTypeService->newContentTypeUpdateStruct();
     if (array_key_exists('identifier', $data)) {
         $contentTypeUpdateStruct->identifier = $data['identifier'];
     }
     if (array_key_exists('mainLanguageCode', $data)) {
         $contentTypeUpdateStruct->mainLanguageCode = $data['mainLanguageCode'];
     }
     if (array_key_exists('remoteId', $data)) {
         $contentTypeUpdateStruct->remoteId = $data['remoteId'];
     }
     if (array_key_exists('urlAliasSchema', $data)) {
         $contentTypeUpdateStruct->urlAliasSchema = $data['urlAliasSchema'];
     }
     if (array_key_exists('nameSchema', $data)) {
         $contentTypeUpdateStruct->nameSchema = $data['nameSchema'];
     }
     if (array_key_exists('isContainer', $data)) {
         $contentTypeUpdateStruct->isContainer = $this->parserTools->parseBooleanValue($data['isContainer']);
     }
     if (array_key_exists('defaultSortField', $data)) {
         $contentTypeUpdateStruct->defaultSortField = $this->parserTools->parseDefaultSortField($data['defaultSortField']);
     }
     if (array_key_exists('defaultSortOrder', $data)) {
         $contentTypeUpdateStruct->defaultSortOrder = $this->parserTools->parseDefaultSortOrder($data['defaultSortOrder']);
     }
     if (array_key_exists('defaultAlwaysAvailable', $data)) {
         $contentTypeUpdateStruct->defaultAlwaysAvailable = $this->parserTools->parseBooleanValue($data['defaultAlwaysAvailable']);
     }
     if (array_key_exists('names', $data)) {
         if (!is_array($data['names']) || !array_key_exists('value', $data['names']) || !is_array($data['names']['value'])) {
             throw new Exceptions\Parser("Invalid 'names' element for ContentTypeUpdate.");
         }
         $contentTypeUpdateStruct->names = $this->parserTools->parseTranslatableList($data['names']);
     }
     if (array_key_exists('descriptions', $data)) {
         if (!is_array($data['descriptions']) || !array_key_exists('value', $data['descriptions']) || !is_array($data['descriptions']['value'])) {
             throw new Exceptions\Parser("Invalid 'descriptions' element for ContentTypeUpdate.");
         }
         $contentTypeUpdateStruct->descriptions = $this->parserTools->parseTranslatableList($data['descriptions']);
     }
     if (array_key_exists('modificationDate', $data)) {
         $contentTypeUpdateStruct->modificationDate = new DateTime($data['modificationDate']);
     }
     if (array_key_exists('User', $data)) {
         if (!array_key_exists('_href', $data['User'])) {
             throw new Exceptions\Parser("Missing '_href' attribute for User element in ContentTypeUpdate.");
         }
         $contentTypeUpdateStruct->modifierId = $this->requestParser->parseHref($data['User']['_href'], 'userId');
     }
     return $contentTypeUpdateStruct;
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:61,代码来源:ContentTypeUpdate.php

示例6: parse

 /**
  * Parse input structure.
  *
  * @param array $data
  * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
  *
  * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroupCreateStruct
  */
 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
 {
     if (!array_key_exists('identifier', $data)) {
         throw new Exceptions\Parser("Missing 'identifier' attribute for ObjectStateGroupCreate.");
     }
     $objectStateGroupCreateStruct = $this->objectStateService->newObjectStateGroupCreateStruct($data['identifier']);
     if (!array_key_exists('defaultLanguageCode', $data)) {
         throw new Exceptions\Parser("Missing 'defaultLanguageCode' attribute for ObjectStateGroupCreate.");
     }
     $objectStateGroupCreateStruct->defaultLanguageCode = $data['defaultLanguageCode'];
     if (!array_key_exists('names', $data) || !is_array($data['names'])) {
         throw new Exceptions\Parser("Missing or invalid 'names' element for ObjectStateGroupCreate.");
     }
     if (!array_key_exists('value', $data['names']) || !is_array($data['names']['value'])) {
         throw new Exceptions\Parser("Missing or invalid 'names' element for ObjectStateGroupCreate.");
     }
     $objectStateGroupCreateStruct->names = $this->parserTools->parseTranslatableList($data['names']);
     if (array_key_exists('descriptions', $data) && is_array($data['descriptions'])) {
         $objectStateGroupCreateStruct->descriptions = $this->parserTools->parseTranslatableList($data['descriptions']);
     }
     return $objectStateGroupCreateStruct;
 }
开发者ID:Heyfara,项目名称:ezpublish-kernel,代码行数:30,代码来源:ObjectStateGroupCreate.php

示例7: parse

 /**
  * Parse input structure.
  *
  * @param array $data
  * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
  *
  * @return \Netgen\TagsBundle\API\Repository\Values\Tags\SynonymCreateStruct
  */
 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
 {
     if (!array_key_exists('mainLanguageCode', $data)) {
         throw new Exceptions\Parser("Missing 'mainLanguageCode' element for SynonymCreate.");
     }
     $synonymCreateStruct = $this->tagsService->newSynonymCreateStruct(null, $data['mainLanguageCode']);
     if (array_key_exists('remoteId', $data)) {
         $synonymCreateStruct->remoteId = $data['remoteId'];
     }
     if (array_key_exists('alwaysAvailable', $data)) {
         $synonymCreateStruct->alwaysAvailable = $this->parserTools->parseBooleanValue($data['alwaysAvailable']);
     }
     if (array_key_exists('names', $data)) {
         if (!is_array($data['names']) || !array_key_exists('value', $data['names']) || !is_array($data['names']['value'])) {
             throw new Exceptions\Parser("Invalid 'names' element for SynonymCreate.");
         }
         $keywords = $this->parserTools->parseTranslatableList($data['names']);
         foreach ($keywords as $languageCode => $keyword) {
             $synonymCreateStruct->setKeyword($keyword, $languageCode);
         }
     }
     return $synonymCreateStruct;
 }
开发者ID:netgen,项目名称:tagsbundle,代码行数:31,代码来源:TagSynonymCreate.php

示例8: parse

 /**
  * Parse input structure
  *
  * @param array $data
  * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
  *
  * @todo Error handling
  *
  * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectState
  */
 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
 {
     $names = $this->parserTools->parseTranslatableList($data['names']);
     $descriptions = isset($data['descriptions']) ? $this->parserTools->parseTranslatableList($data['descriptions']) : array();
     return new CoreObjectState(array('id' => $data['_href'], 'identifier' => $data['identifier'], 'priority' => (int) $data['priority'], 'defaultLanguageCode' => $data['defaultLanguageCode'], 'languageCodes' => explode(',', $data['languageCodes']), 'names' => $names, 'descriptions' => $descriptions));
 }
开发者ID:dfritschy,项目名称:ezpublish-kernel,代码行数:16,代码来源:ObjectState.php

示例9: parse

 /**
  * Parse input structure.
  *
  * @param array $data
  * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
  *
  * @todo Error handling
  *
  * @return \eZ\Publish\API\Repository\Values\ContentType\FieldDefinition
  */
 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
 {
     return new Values\ContentType\FieldDefinition(array('id' => $data['_href'], 'identifier' => $data['identifier'], 'fieldTypeIdentifier' => $data['fieldType'], 'fieldGroup' => $data['fieldGroup'], 'position' => (int) $data['position'], 'isTranslatable' => $this->parserTools->parseBooleanValue($data['isTranslatable']), 'isRequired' => $this->parserTools->parseBooleanValue($data['isRequired']), 'isInfoCollector' => $this->parserTools->parseBooleanValue($data['isInfoCollector']), 'isSearchable' => $this->parserTools->parseBooleanValue($data['isSearchable']), 'names' => isset($data['names']) ? $this->parserTools->parseTranslatableList($data['names']) : null, 'descriptions' => isset($data['descriptions']) ? $this->parserTools->parseTranslatableList($data['descriptions']) : null, 'defaultValue' => $this->fieldTypeParser->parseValue($data['fieldType'], $data['defaultValue']), 'fieldSettings' => $this->fieldTypeParser->parseFieldSettings($data['fieldType'], $data['fieldSettings']), 'validators' => $this->fieldTypeParser->parseValidatorConfiguration($data['fieldType'], $data['validatorConfiguration'])));
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:14,代码来源:FieldDefinition.php

示例10: parse

 /**
  * Parse input structure.
  *
  * @param array $data
  * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
  *
  * @return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeCreateStruct
  */
 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
 {
     if (!array_key_exists('identifier', $data)) {
         throw new Exceptions\Parser("Missing 'identifier' element for ContentTypeCreate.");
     }
     $contentTypeCreateStruct = $this->contentTypeService->newContentTypeCreateStruct($data['identifier']);
     if (!array_key_exists('mainLanguageCode', $data)) {
         throw new Exceptions\Parser("Missing 'mainLanguageCode' element for ContentTypeCreate.");
     }
     $contentTypeCreateStruct->mainLanguageCode = $data['mainLanguageCode'];
     if (array_key_exists('remoteId', $data)) {
         $contentTypeCreateStruct->remoteId = $data['remoteId'];
     }
     if (array_key_exists('urlAliasSchema', $data)) {
         $contentTypeCreateStruct->urlAliasSchema = $data['urlAliasSchema'];
     }
     // @todo XSD says that nameSchema is mandatory, but it is not in create struct
     if (array_key_exists('nameSchema', $data)) {
         $contentTypeCreateStruct->nameSchema = $data['nameSchema'];
     }
     // @todo XSD says that isContainer is mandatory, but it is not in create struct
     if (array_key_exists('isContainer', $data)) {
         $contentTypeCreateStruct->isContainer = $this->parserTools->parseBooleanValue($data['isContainer']);
     }
     // @todo XSD says that defaultSortField is mandatory, but it is not in create struct
     if (array_key_exists('defaultSortField', $data)) {
         $contentTypeCreateStruct->defaultSortField = $this->parserTools->parseDefaultSortField($data['defaultSortField']);
     }
     // @todo XSD says that defaultSortOrder is mandatory, but it is not in create struct
     if (array_key_exists('defaultSortOrder', $data)) {
         $contentTypeCreateStruct->defaultSortOrder = $this->parserTools->parseDefaultSortOrder($data['defaultSortOrder']);
     }
     // @todo XSD says that defaultAlwaysAvailable is mandatory, but it is not in create struct
     if (array_key_exists('defaultAlwaysAvailable', $data)) {
         $contentTypeCreateStruct->defaultAlwaysAvailable = $this->parserTools->parseBooleanValue($data['defaultAlwaysAvailable']);
     }
     if (array_key_exists('names', $data)) {
         if (!is_array($data['names']) || !array_key_exists('value', $data['names']) || !is_array($data['names']['value'])) {
             throw new Exceptions\Parser("Invalid 'names' element for ContentTypeCreate.");
         }
         $contentTypeCreateStruct->names = $this->parserTools->parseTranslatableList($data['names']);
     }
     // @todo XSD says that descriptions is mandatory, but content type can be created without descriptions
     if (array_key_exists('descriptions', $data)) {
         if (!is_array($data['descriptions']) || !array_key_exists('value', $data['descriptions']) || !is_array($data['descriptions']['value'])) {
             throw new Exceptions\Parser("Invalid 'descriptions' element for ContentTypeCreate.");
         }
         $contentTypeCreateStruct->descriptions = $this->parserTools->parseTranslatableList($data['descriptions']);
     }
     // @todo 1: XSD says that modificationDate is mandatory, but it is not in create struct
     // @todo 2: mismatch between XSD naming and create struct naming
     if (array_key_exists('modificationDate', $data)) {
         $contentTypeCreateStruct->creationDate = new DateTime($data['modificationDate']);
     }
     if (array_key_exists('User', $data)) {
         if (!array_key_exists('_href', $data['User'])) {
             throw new Exceptions\Parser("Missing '_href' attribute for User element in ContentTypeCreate.");
         }
         $contentTypeCreateStruct->creatorId = $this->requestParser->parseHref($data['User']['_href'], 'userId');
     }
     if (!array_key_exists('FieldDefinitions', $data)) {
         throw new Exceptions\Parser("Missing 'FieldDefinitions' element for ContentTypeCreate.");
     }
     if (!is_array($data['FieldDefinitions']) || !array_key_exists('FieldDefinition', $data['FieldDefinitions']) || !is_array($data['FieldDefinitions']['FieldDefinition'])) {
         throw new Exceptions\Parser("Invalid 'FieldDefinitions' element for ContentTypeCreate.");
     }
     // With no field definitions given and when ContentType is immediately published we must return HTTP 400 BadRequest,
     // instead of relying on service to throw InvalidArgumentException
     if (isset($data['__publish']) && $data['__publish'] === true && empty($data['FieldDefinitions']['FieldDefinition'])) {
         throw new Exceptions\Parser('ContentTypeCreate should provide at least one field definition.');
     }
     foreach ($data['FieldDefinitions']['FieldDefinition'] as $fieldDefinitionData) {
         if (!is_array($fieldDefinitionData)) {
             throw new Exceptions\Parser("Invalid 'FieldDefinition' element for ContentTypeCreate.");
         }
         $contentTypeCreateStruct->addFieldDefinition($this->fieldDefinitionCreateParser->parse($fieldDefinitionData, $parsingDispatcher));
     }
     return $contentTypeCreateStruct;
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:87,代码来源:ContentTypeCreate.php

示例11: parse

 /**
  * Parse input structure.
  *
  * @param array $data
  * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
  *
  * @todo Error handling
  *
  * @return \eZ\Publish\API\Repository\Values\Content\VersionInfo
  */
 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
 {
     $contentInfoId = $this->requestParser->parseHref($data['Content']['_href'], 'contentId');
     return new Values\Content\VersionInfo($this->contentService, array('id' => $data['id'], 'versionNo' => $data['versionNo'], 'status' => $this->convertVersionStatus($data['status']), 'modificationDate' => new \DateTime($data['modificationDate']), 'creatorId' => $data['Creator']['_href'], 'creationDate' => new \DateTime($data['creationDate']), 'initialLanguageCode' => $data['initialLanguageCode'], 'languageCodes' => explode(',', $data['languageCodes']), 'names' => $this->parserTools->parseTranslatableList($data['names']), 'contentInfoId' => $contentInfoId));
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:15,代码来源:VersionInfo.php


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