Skip to content

Commit

Permalink
Field Collections not working with Locale Switcher #328
Browse files Browse the repository at this point in the history
  • Loading branch information
weisswurstkanone committed Apr 28, 2021
1 parent f7499e0 commit 2d11e2c
Showing 1 changed file with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@

class Fieldcollections extends Base
{

/** @var array */
public static $typeCache = [];

/** {@inheritdoc } */
public function getGraphQlMutationFieldConfig($nodeDef, $class, $container = null, $params = [])
{
Expand Down Expand Up @@ -79,16 +83,23 @@ public function getGraphQlMutationFieldConfig($nodeDef, $class, $container = nul
]);

$inputTypeName = "fieldcollections_" . $fieldName . "_input";
$inputType = new InputObjectType([
'name' => $inputTypeName,
'fields' => [
'replace' => [
'type' => Type::boolean(),
'description' => "if true then the entire item list will be overwritten"
],
'items' => $groupsInputType
]
]);

$inputType = self::$typeCache[$inputTypeName] ?? null;

if (!$inputType) {

$inputType = new InputObjectType([
'name' => $inputTypeName,
'fields' => [
'replace' => [
'type' => Type::boolean(),
'description' => "if true then the entire item list will be overwritten"
],
'items' => $groupsInputType
]
]);
self::$typeCache[$inputTypeName] = $inputType;
}

$processor = new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectInputProcessor\Fieldcollections($nodeDef, $fieldProcessors);
$processor->setGraphQLService($this->getGraphQlService());
Expand Down

0 comments on commit 2d11e2c

Please sign in to comment.