/** * Parse input structure. * * @param array $data * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher * * @return \eZ\Publish\Core\REST\Server\Values\RestLocationUpdateStruct */ public function parse(array $data, ParsingDispatcher $parsingDispatcher) { $locationUpdateStruct = $this->locationService->newLocationUpdateStruct(); if (array_key_exists('priority', $data)) { $locationUpdateStruct->priority = (int) $data['priority']; } if (array_key_exists('remoteId', $data)) { $locationUpdateStruct->remoteId = $data['remoteId']; } $hidden = null; if (array_key_exists('hidden', $data)) { $hidden = $this->parserTools->parseBooleanValue($data['hidden']); } if (!array_key_exists('sortField', $data)) { throw new Exceptions\Parser("Missing 'sortField' element for LocationUpdate."); } $locationUpdateStruct->sortField = $this->parserTools->parseDefaultSortField($data['sortField']); if (!array_key_exists('sortOrder', $data)) { throw new Exceptions\Parser("Missing 'sortOrder' element for LocationUpdate."); } $locationUpdateStruct->sortOrder = $this->parserTools->parseDefaultSortOrder($data['sortOrder']); return new RestLocationUpdateStruct($locationUpdateStruct, $hidden); }
/** * Instantiates a new location update class * * @return \eZ\Publish\API\Repository\Values\Content\LocationUpdateStruct */ public function newLocationUpdateStruct() { return $this->service->newLocationUpdateStruct(); }