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


PHP ContentService::newContentUpdateStruct方法代码示例

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


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

示例1: parse

 /**
  * Parse input structure
  *
  * @param array $data
  * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
  *
  * @return \eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct
  */
 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
 {
     $contentUpdateStruct = $this->contentService->newContentUpdateStruct();
     // Missing initial language code
     if (array_key_exists('initialLanguageCode', $data)) {
         $contentUpdateStruct->initialLanguageCode = $data['initialLanguageCode'];
     }
     // @todo Where to set the user?
     // @todo Where to set modification date?
     if (array_key_exists('fields', $data)) {
         if (!is_array($data['fields']) || !array_key_exists('field', $data['fields']) || !is_array($data['fields']['field'])) {
             throw new Exceptions\Parser("Invalid 'fields' element for VersionUpdate.");
         }
         $contentId = $this->requestParser->parseHref($data['__url'], 'contentId');
         foreach ($data['fields']['field'] as $fieldData) {
             if (!array_key_exists('fieldDefinitionIdentifier', $fieldData)) {
                 throw new Exceptions\Parser("Missing 'fieldDefinitionIdentifier' element in field data for VersionUpdate.");
             }
             if (!array_key_exists('fieldValue', $fieldData)) {
                 throw new Exceptions\Parser("Missing 'fieldValue' element for '{$fieldData['fieldDefinitionIdentifier']}' identifier in VersionUpdate.");
             }
             $fieldValue = $this->fieldTypeParser->parseFieldValue($contentId, $fieldData['fieldDefinitionIdentifier'], $fieldData['fieldValue']);
             $languageCode = null;
             if (array_key_exists('languageCode', $fieldData)) {
                 $languageCode = $fieldData['languageCode'];
             }
             $contentUpdateStruct->setField($fieldData['fieldDefinitionIdentifier'], $fieldValue, $languageCode);
         }
     }
     return $contentUpdateStruct;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:39,代码来源:VersionUpdate.php

示例2: iCreateAnEditRequestForThisDraft

 /**
  * @When /^I create an edit request for this draft$/
  */
 public function iCreateAnEditRequestForThisDraft()
 {
     $url = sprintf('/content/objects/%d/versions/%d', $this->currentDraft->content->id, $this->currentDraft->content->versionInfo->versionNo);
     $this->restContext->createRequest('patch', $url);
     $this->restContext->requestObject = new VersionUpdate(['contentUpdateStruct' => $this->contentService->newContentUpdateStruct(), 'contentType' => $this->currentDraft->contentType]);
     $this->restContext->setHeaderWithObject('content-type', 'VersionUpdate');
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:10,代码来源:UserContentContext.php

示例3: parse

 /**
  * Parse input structure.
  *
  * @param array $data
  * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
  *
  * @return \eZ\Publish\Core\REST\Server\Values\RestUserGroupUpdateStruct
  */
 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
 {
     $parsedData = array();
     if (array_key_exists('mainLanguageCode', $data)) {
         $parsedData['mainLanguageCode'] = $data['mainLanguageCode'];
     }
     if (array_key_exists('Section', $data) && is_array($data['Section'])) {
         if (!array_key_exists('_href', $data['Section'])) {
             throw new Exceptions\Parser("Missing '_href' attribute for Section element in UserGroupUpdate.");
         }
         $parsedData['sectionId'] = $this->requestParser->parseHref($data['Section']['_href'], 'sectionId');
     }
     if (array_key_exists('remoteId', $data)) {
         $parsedData['remoteId'] = $data['remoteId'];
     }
     if (array_key_exists('fields', $data)) {
         $groupLocationParts = explode('/', $this->requestParser->parseHref($data['__url'], 'groupPath'));
         $groupLocation = $this->locationService->loadLocation(array_pop($groupLocationParts));
         if (!is_array($data['fields']) || !array_key_exists('field', $data['fields']) || !is_array($data['fields']['field'])) {
             throw new Exceptions\Parser("Invalid 'fields' element for UserGroupUpdate.");
         }
         $parsedData['fields'] = array();
         foreach ($data['fields']['field'] as $fieldData) {
             if (!array_key_exists('fieldDefinitionIdentifier', $fieldData)) {
                 throw new Exceptions\Parser("Missing 'fieldDefinitionIdentifier' element in field data for UserGroupUpdate.");
             }
             if (!array_key_exists('fieldValue', $fieldData)) {
                 throw new Exceptions\Parser("Missing 'fieldValue' element for '{$fieldData['fieldDefinitionIdentifier']}' identifier in UserGroupUpdate.");
             }
             $fieldValue = $this->fieldTypeParser->parseFieldValue($groupLocation->contentId, $fieldData['fieldDefinitionIdentifier'], $fieldData['fieldValue']);
             $languageCode = null;
             if (array_key_exists('languageCode', $fieldData)) {
                 $languageCode = $fieldData['languageCode'];
             }
             $parsedData['fields'][$fieldData['fieldDefinitionIdentifier']] = array('fieldValue' => $fieldValue, 'languageCode' => $languageCode);
         }
     }
     $userGroupUpdateStruct = $this->userService->newUserGroupUpdateStruct();
     if (!empty($parsedData)) {
         if (array_key_exists('mainLanguageCode', $parsedData) || array_key_exists('remoteId', $parsedData)) {
             $userGroupUpdateStruct->contentMetadataUpdateStruct = $this->contentService->newContentMetadataUpdateStruct();
             if (array_key_exists('mainLanguageCode', $parsedData)) {
                 $userGroupUpdateStruct->contentMetadataUpdateStruct->mainLanguageCode = $parsedData['mainLanguageCode'];
             }
             if (array_key_exists('remoteId', $parsedData)) {
                 $userGroupUpdateStruct->contentMetadataUpdateStruct->remoteId = $parsedData['remoteId'];
             }
         }
         if (array_key_exists('fields', $parsedData)) {
             $userGroupUpdateStruct->contentUpdateStruct = $this->contentService->newContentUpdateStruct();
             foreach ($parsedData['fields'] as $fieldDefinitionIdentifier => $fieldValue) {
                 $userGroupUpdateStruct->contentUpdateStruct->setField($fieldDefinitionIdentifier, $fieldValue['fieldValue'], $fieldValue['languageCode']);
             }
         }
     }
     return new RestUserGroupUpdateStruct($userGroupUpdateStruct, array_key_exists('sectionId', $parsedData) ? $parsedData['sectionId'] : null);
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:65,代码来源:UserGroupUpdate.php

示例4: newContentUpdateStruct

 /**
  * Instantiates a new content update struct
  * @return \eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct
  */
 public function newContentUpdateStruct()
 {
     return $this->service->newContentUpdateStruct();
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:8,代码来源:ContentService.php

示例5: parse

 /**
  * Parse input structure
  *
  * @param array $data
  * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
  *
  * @return \eZ\Publish\Core\REST\Server\Values\RestUserUpdateStruct
  */
 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
 {
     $parsedData = array();
     //@todo XSD has a login element, but it's not possible to update login
     if (array_key_exists('email', $data)) {
         $parsedData['email'] = $data['email'];
     }
     if (array_key_exists('password', $data)) {
         $parsedData['password'] = $data['password'];
     }
     if (array_key_exists('enabled', $data)) {
         $parsedData['enabled'] = $this->parserTools->parseBooleanValue($data['enabled']);
     }
     if (array_key_exists('mainLanguageCode', $data)) {
         $parsedData['mainLanguageCode'] = $data['mainLanguageCode'];
     }
     if (array_key_exists('Section', $data) && is_array($data['Section'])) {
         if (!array_key_exists('_href', $data['Section'])) {
             throw new Exceptions\Parser("Missing '_href' attribute for Section element in UserUpdate.");
         }
         $parsedData['sectionId'] = $this->requestParser->parseHref($data['Section']['_href'], 'sectionId');
     }
     if (array_key_exists('remoteId', $data)) {
         $parsedData['remoteId'] = $data['remoteId'];
     }
     if (array_key_exists('fields', $data)) {
         $userId = $this->requestParser->parseHref($data['__url'], 'userId');
         if (!is_array($data['fields']) || !array_key_exists('field', $data['fields']) || !is_array($data['fields']['field'])) {
             throw new Exceptions\Parser("Invalid 'fields' element for UserUpdate.");
         }
         $parsedData['fields'] = array();
         foreach ($data['fields']['field'] as $fieldData) {
             if (!array_key_exists('fieldDefinitionIdentifier', $fieldData)) {
                 throw new Exceptions\Parser("Missing 'fieldDefinitionIdentifier' element in field data for UserUpdate.");
             }
             if (!array_key_exists('fieldValue', $fieldData)) {
                 throw new Exceptions\Parser("Missing 'fieldValue' element for '{$fieldData['fieldDefinitionIdentifier']}' identifier in UserUpdate.");
             }
             $fieldValue = $this->fieldTypeParser->parseFieldValue($userId, $fieldData['fieldDefinitionIdentifier'], $fieldData['fieldValue']);
             $languageCode = null;
             if (array_key_exists('languageCode', $fieldData)) {
                 $languageCode = $fieldData['languageCode'];
             }
             $parsedData['fields'][$fieldData['fieldDefinitionIdentifier']] = array('fieldValue' => $fieldValue, 'languageCode' => $languageCode);
         }
     }
     $userUpdateStruct = $this->userService->newUserUpdateStruct();
     if (!empty($parsedData)) {
         if (array_key_exists('email', $parsedData)) {
             $userUpdateStruct->email = $parsedData['email'];
         }
         if (array_key_exists('password', $parsedData)) {
             $userUpdateStruct->password = $parsedData['password'];
         }
         if (array_key_exists('enabled', $parsedData)) {
             $userUpdateStruct->enabled = $parsedData['enabled'];
         }
         if (array_key_exists('mainLanguageCode', $parsedData) || array_key_exists('remoteId', $parsedData)) {
             $userUpdateStruct->contentMetadataUpdateStruct = $this->contentService->newContentMetadataUpdateStruct();
             if (array_key_exists('mainLanguageCode', $parsedData)) {
                 $userUpdateStruct->contentMetadataUpdateStruct->mainLanguageCode = $parsedData['mainLanguageCode'];
             }
             if (array_key_exists('remoteId', $parsedData)) {
                 $userUpdateStruct->contentMetadataUpdateStruct->remoteId = $parsedData['remoteId'];
             }
         }
         if (array_key_exists('fields', $parsedData)) {
             $userUpdateStruct->contentUpdateStruct = $this->contentService->newContentUpdateStruct();
             foreach ($parsedData['fields'] as $fieldDefinitionIdentifier => $fieldValue) {
                 $userUpdateStruct->contentUpdateStruct->setField($fieldDefinitionIdentifier, $fieldValue['fieldValue'], $fieldValue['languageCode']);
             }
         }
     }
     return new RestUserUpdateStruct($userUpdateStruct, array_key_exists('sectionId', $parsedData) ? $parsedData['sectionId'] : null);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:83,代码来源:UserUpdate.php


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