コード例 #1
0
 /**
  * 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;
 }
コード例 #2
0
 /**
  * Instantiates a new Object State Group Create Struct and sets $identified in it.
  *
  * @param string $identifier
  *
  * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroupCreateStruct
  */
 public function newObjectStateGroupCreateStruct($identifier)
 {
     return $this->service->newObjectStateGroupCreateStruct($identifier);
 }