From 0acada198c61bbdff4a63448af4a6787f1b70aec Mon Sep 17 00:00:00 2001 From: Divesh Pahuja Date: Wed, 13 Sep 2023 15:05:40 +0200 Subject: [PATCH] [Mutation] Fix CreateAsset mutation not considering required field filename - resolves #791 --- src/GraphQL/Mutation/MutationType.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/GraphQL/Mutation/MutationType.php b/src/GraphQL/Mutation/MutationType.php index 570567d8..dab5a5d7 100644 --- a/src/GraphQL/Mutation/MutationType.php +++ b/src/GraphQL/Mutation/MutationType.php @@ -990,11 +990,13 @@ public function buildCreateAssetMutation(&$config, $context) } $type = $args['type']; + $filename = $args['filename']; $className = 'Pimcore\\Model\\Asset\\' . ucfirst($type); - /** @var Concrete $newInstance */ + /** @var Asset $newInstance */ $newInstance = new $className(); $newInstance->setParentId($parent->getId()); + $newInstance->setFilename($filename); $tags = []; if (isset($args['input'])) { @@ -1029,7 +1031,7 @@ public function buildCreateAssetMutation(&$config, $context) } catch (\Exception $e) { return [ 'success' => false, - 'message' => 'saving failed' + 'message' => 'saving failed: ' . $e->getMessage() ]; }