From 251cb534ac227a4f9d833176c29129b58fca84bb Mon Sep 17 00:00:00 2001 From: Bertrand Dunogier Date: Tue, 9 Apr 2019 18:12:19 +0200 Subject: [PATCH] Fixed a schema error when type in multiple groups (EZP-30419) --- .../Content/Worker/ContentType/DefineDomainContentMutation.php | 3 ++- .../AddFieldDefinitionToDomainContentMutation.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Schema/Domain/Content/Worker/ContentType/DefineDomainContentMutation.php b/src/Schema/Domain/Content/Worker/ContentType/DefineDomainContentMutation.php index 1ae5527c..66990280 100644 --- a/src/Schema/Domain/Content/Worker/ContentType/DefineDomainContentMutation.php +++ b/src/Schema/Domain/Content/Worker/ContentType/DefineDomainContentMutation.php @@ -104,7 +104,8 @@ public function canWork(Builder $schema, array $args) { return isset($args['ContentType']) && $args['ContentType'] instanceof ContentType - && !isset($args['FieldDefinition']); + && !isset($args['FieldDefinition']) + && !$schema->hasType($this->getCreateInputName($args['ContentType'])); } /** diff --git a/src/Schema/Domain/Content/Worker/FieldDefinition/AddFieldDefinitionToDomainContentMutation.php b/src/Schema/Domain/Content/Worker/FieldDefinition/AddFieldDefinitionToDomainContentMutation.php index 7db99f6a..b7e00810 100644 --- a/src/Schema/Domain/Content/Worker/FieldDefinition/AddFieldDefinitionToDomainContentMutation.php +++ b/src/Schema/Domain/Content/Worker/FieldDefinition/AddFieldDefinitionToDomainContentMutation.php @@ -55,7 +55,8 @@ public function canWork(Builder $schema, array $args): bool isset($args['ContentType']) && $args['ContentType'] instanceof ContentType && isset($args['FieldDefinition']) - && $args['FieldDefinition'] instanceof FieldDefinition; + && $args['FieldDefinition'] instanceof FieldDefinition + && !$schema->hasTypeWithField($this->getCreateInputName($args['ContentType']), $this->getFieldDefinitionField($args['FieldDefinition'])); } /**