Skip to content

Commit

Permalink
GraphQL Mutation createAssetFolder always said "unable to resolve par…
Browse files Browse the repository at this point in the history
…ent" #208
  • Loading branch information
weisswurstkanone committed Apr 29, 2020
1 parent d1dcf62 commit 97e2c77
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/GraphQL/Mutation/MutationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -672,10 +672,25 @@ public function getCreateFolderResolver($elementType)
return static function ($value, $args, $context, ResolveInfo $info) use ($elementType, $me) {
$parent = null;

if (isset($args["parentId"])) {
$parent = AbstractObject::getById($args["parentId"]);
} else if (isset($args["path"])) {
$parent = AbstractObject::getByPath($args["path"]);

if ($elementType == "asset") {
if (isset($args["parentId"])) {
$parent = Asset::getById($args["parentId"]);
} else if (isset($args["path"])) {
$parent = Asset::getByPath($args["path"]);
}
} else if ($elementType == "document") {
if (isset($args["parentId"])) {
$parent = Document::getById($args["parentId"]);
} else if (isset($args["path"])) {
$parent = Document::getByPath($args["path"]);
}
} else {
if (isset($args["parentId"])) {
$parent = AbstractObject::getById($args["parentId"]);
} else if (isset($args["path"])) {
$parent = AbstractObject::getByPath($args["path"]);
}
}

if (!$parent) {
Expand Down

0 comments on commit 97e2c77

Please sign in to comment.