Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bundle/Resources/config/graphql/Item.types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 14 additions & 4 deletions src/lib/Resolver/DomainContentMutationResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down