Skip to content

Commit

Permalink
fixing error where recursion would kill categories that implemente en…
Browse files Browse the repository at this point in the history
…tries linking back to categories
  • Loading branch information
markhuot committed Jan 5, 2018
1 parent b984f48 commit 3ff58c0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Types/CategoryGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ class CategoryGroup extends ObjectType {
static $type;

function __construct($group, $token) {
$fieldService = \Yii::$container->get(\markhuot\CraftQL\Services\FieldService::class);
$fields = array_merge(\markhuot\CraftQL\Types\Category::baseFields(), $fieldService->getFields($group->fieldLayoutId, $token));

parent::__construct([
'name' => ucfirst($group->handle).'Category',
'interfaces' => [
\markhuot\CraftQL\Types\Category::interface()
],
'fields' => $fields,
'fields' => function () use ($group, $token) {
$fieldService = \Yii::$container->get(\markhuot\CraftQL\Services\FieldService::class);
$fields = array_merge(\markhuot\CraftQL\Types\Category::baseFields(), $fieldService->getFields($group->fieldLayoutId, $token));
return $fields;
},
'id' => $group->id,
]);
}
Expand Down

0 comments on commit 3ff58c0

Please sign in to comment.