Skip to content

Commit

Permalink
[Mutation] Fix CreateAsset mutation not considering required field fi…
Browse files Browse the repository at this point in the history
…lename - resolves #791
  • Loading branch information
dvesh3 committed Sep 13, 2023
1 parent 9a06238 commit 0acada1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/GraphQL/Mutation/MutationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'])) {
Expand Down Expand Up @@ -1029,7 +1031,7 @@ public function buildCreateAssetMutation(&$config, $context)
} catch (\Exception $e) {
return [
'success' => false,
'message' => 'saving failed'
'message' => 'saving failed: ' . $e->getMessage()
];
}

Expand Down

0 comments on commit 0acada1

Please sign in to comment.