Inheritance: implements eZ\Publish\API\Repository\ContentService, implements eZ\Publish\Core\REST\Client\Sessionable
Exemplo n.º 1
0
 /**
  * Parse input structure.
  *
  * @param array $data
  * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
  *
  * @return \eZ\Publish\Core\REST\Server\Values\Version
  */
 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
 {
     $contentId = $this->requestParser->parseHref($data['VersionInfo']['Content']['_href'], 'contentId');
     $content = $this->contentService->loadContent($contentId, null, $data['VersionInfo']['versionNo']);
     $contentType = $this->contentTypeService->loadContentType($content->contentInfo->contentTypeId);
     $relations = $this->contentService->loadRelations($content->versionInfo);
     return new VersionValue($content, $contentType, $relations);
 }
 /**
  * Tests the section parser
  *
  * @return \eZ\Publish\API\Repository\Values\Content\Content
  */
 public function testParse()
 {
     $fieldDefinitionListParser = $this->getParser();
     $inputArray = array('_media-type' => 'application/vnd.ez.api.FieldDefinitionList+json', '_href' => '/content/types/1/fieldDefinitions', 'FieldDefinition' => array(0 => array('_media-type' => 'application/vnd.ez.api.FieldDefinition+json', '_href' => '/content/types/1/fieldDefinitions/23'), 1 => array('_media-type' => 'application/vnd.ez.api.FieldDefinition+json', '_href' => '/content/types/1/fieldDefinitions/42')));
     $this->contentTypeServiceMock->expects($this->exactly(2))->method('loadFieldDefinition')->with($this->isType('string'));
     $result = $fieldDefinitionListParser->parse($inputArray, $this->getParsingDispatcherMock());
     $fieldDefinitionArray = $result->getFieldDefinitions();
     $this->assertInternalType('array', $fieldDefinitionArray);
 }
Exemplo n.º 3
0
 /**
  * Content of the content this version belongs to.
  *
  * @return ContentInfo
  */
 public function getContentInfo()
 {
     return $this->contentService->loadContentInfo($this->contentInfoId);
 }