public function createAsset(string $name, ImageValue $image, string $languageCode): Content
    {
        $contentType = $this->contentTypeService->loadContentTypeByIdentifier(
            $this->mappings['content_type_identifier']
        );

        $contentCreateStruct = $this->contentService->newContentCreateStruct($contentType, $languageCode);
        $contentCreateStruct->setField($this->mappings['name_field_identifier'], $name);
        $contentCreateStruct->setField($this->mappings['content_field_identifier'], $image);

        $contentDraft = $this->contentService->createContent($contentCreateStruct, [
            $this->locationService->newLocationCreateStruct($this->mappings['parent_location_id']),
        ]);

        return $this->contentService->publishVersion($contentDraft->versionInfo);
    }
public function createAsset(string $name, ImageValue $image, string $languageCode): Content
    {
        $contentType = $this->contentTypeService->loadContentTypeByIdentifier(
            $this->mappings['content_type_identifier']
        );

        $contentCreateStruct = $this->contentService->newContentCreateStruct($contentType, $languageCode);
        $contentCreateStruct->setField($this->mappings['name_field_identifier'], $name);
        $contentCreateStruct->setField($this->mappings['content_field_identifier'], $image);

        $contentDraft = $this->contentService->createContent($contentCreateStruct, [
            $this->locationService->newLocationCreateStruct($this->mappings['parent_location_id']),
        ]);

        return $this->contentService->publishVersion($contentDraft->versionInfo);
    }
public function createAsset ( string $ name , ImageValue $ image , string $ languageCode ) : Content { $ contentType = $ this -> contentTypeService -> loadContentTypeByIdentifier ( $ this -> mappings [ 'content_type_identifier' ] ) ; $ contentCreateStruct = $ this -> contentService -> newContentCreateStruct ( $ contentType , $ languageCode ) ; $ contentCreateStruct -> setField ( $ this -> mappings [ 'name_field_identifier' ] , $ name ) ; $ contentCreateStruct -> setField ( $ this -> mappings [ 'content_field_identifier' ] , $ image ) ; $ contentDraft = $ this -> contentService -> createContent ( $ contentCreateStruct , [ $ this -> locationService -> newLocationCreateStruct ( $ this -> mappings [ 'parent_location_id' ] ) , ] ) ; return $ this -> contentService -> publishVersion ( $ contentDraft -> versionInfo ) ; }
Creates an Image Asset.

@param string $name
@param \eZ\Publish\Core\FieldType\Image\Value $image
@param string $languageCode

@return \eZ\Publish\API\Repository\Values\Content\Content
Creates an Image Asset .