diff --git a/src/Model/Resolver/Image/BlogCategoryImagesQuery.php b/src/Model/Resolver/Image/BlogCategoryImagesQuery.php new file mode 100644 index 000000000..89885c1fb --- /dev/null +++ b/src/Model/Resolver/Image/BlogCategoryImagesQuery.php @@ -0,0 +1,23 @@ +mainImageByEntityIdPromiseQuery($blogCategory->getId(), static::ENTITY_NAME, $type); + } +} diff --git a/src/Resources/config/graphql-types/ModelType/Blog/Category/BlogCategoryDecorator.types.yaml b/src/Resources/config/graphql-types/ModelType/Blog/Category/BlogCategoryDecorator.types.yaml index d266ea4bb..d12375d97 100644 --- a/src/Resources/config/graphql-types/ModelType/Blog/Category/BlogCategoryDecorator.types.yaml +++ b/src/Resources/config/graphql-types/ModelType/Blog/Category/BlogCategoryDecorator.types.yaml @@ -42,6 +42,14 @@ BlogCategoryDecorator: slug: type: "String!" description: "The blog category URL slug" + mainImage: + type: "Image" + description: "Blog category image" + resolve: '@=query("mainImageByBlogCategoryPromiseQuery", value, args["type"])' + args: + type: + type: "String" + defaultValue: null breadcrumb: type: "[Link!]!" description: "Hierarchy of the current element in relation to the structure" diff --git a/src/Resources/config/services.yaml b/src/Resources/config/services.yaml index 0b8a3036b..38cbba833 100644 --- a/src/Resources/config/services.yaml +++ b/src/Resources/config/services.yaml @@ -101,6 +101,11 @@ services: $imagesBatchLoader: '@images_batch_loader' $firstImageBatchLoader: '@first_image_batch_loader' + Shopsys\FrontendApiBundle\Model\Resolver\Image\BlogCategoryImagesQuery: + arguments: + $imagesBatchLoader: '@images_batch_loader' + $firstImageBatchLoader: '@first_image_batch_loader' + Shopsys\FrontendApiBundle\Model\Resolver\Image\ImagesQuery: arguments: $imagesBatchLoader: '@images_batch_loader'