diff --git a/src/bundle/Resources/config/graphql/Item.types.yaml b/src/bundle/Resources/config/graphql/Item.types.yaml index ccd78cd..57d8510 100644 --- a/src/bundle/Resources/config/graphql/Item.types.yaml +++ b/src/bundle/Resources/config/graphql/Item.types.yaml @@ -41,7 +41,7 @@ AbstractItem: _contentInfo: description: 'Underlying content info item' type: Content - resolve: '@=value.getContentInfo()' + resolve: '@=value.getContent().contentInfo' _location: description: 'Main location' type: Location diff --git a/src/lib/Resolver/DomainContentMutationResolver.php b/src/lib/Resolver/DomainContentMutationResolver.php index 2e4d044..17a9054 100644 --- a/src/lib/Resolver/DomainContentMutationResolver.php +++ b/src/lib/Resolver/DomainContentMutationResolver.php @@ -12,7 +12,9 @@ use Ibexa\Contracts\Core\Repository\Values as RepositoryValues; use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition; use Ibexa\GraphQL\Exception\UnsupportedFieldTypeException; +use Ibexa\GraphQL\ItemFactory; use Ibexa\GraphQL\Schema\Domain\Content\NameHelper; +use Ibexa\GraphQL\Value\Item; use Overblog\GraphQLBundle\Definition\Argument; use Overblog\GraphQLBundle\Error\UserErrors; use Overblog\GraphQLBundle\Relay\Node\GlobalId; @@ -38,11 +40,19 @@ class DomainContentMutationResolver */ private $nameHelper; - public function __construct(API\Repository $repository, array $fieldInputHandlers, NameHelper $nameHelper) - { + /** @var \Ibexa\GraphQL\ItemFactory */ + private $itemFactory; + + public function __construct( + API\Repository $repository, + array $fieldInputHandlers, + NameHelper $nameHelper, + ItemFactory $relatedContentItemFactory + ) { $this->repository = $repository; $this->fieldInputHandlers = $fieldInputHandlers; $this->nameHelper = $nameHelper; + $this->itemFactory = $relatedContentItemFactory; } public function updateDomainContent($input, Argument $args, $versionNo, $language): RepositoryValues\Content\Content @@ -129,7 +139,7 @@ public function updateDomainContent($input, Argument $args, $versionNo, $languag return $this->getContentService()->loadContent($contentDraft->id); } - public function createDomainContent($input, $contentTypeIdentifier, $parentLocationId, $language): RepositoryValues\Content\Content + public function createDomainContent($input, $contentTypeIdentifier, $parentLocationId, $language): Item { try { $contentType = $this->getContentTypeService()->loadContentTypeByIdentifier($contentTypeIdentifier); @@ -165,7 +175,7 @@ public function createDomainContent($input, $contentTypeIdentifier, $parentLocat throw new UserError($e->getMessage(), 0, $e); } - return $content; + return $this->itemFactory->fromContent($content); } public function deleteDomainContent(Argument $args)