@@ -48,7 +48,7 @@ class Schema {
48
48
*
49
49
* @var array
50
50
*/
51
- private $ errors = [];
51
+ public $ errors = [];
52
52
53
53
54
54
private $ allArgTypes = [];
@@ -314,7 +314,7 @@ public function entityToGqlQueryArg($entity_type, $bundle = NULL) {
314
314
if ($ field_info ['type ' ] instanceof ListOfType) {
315
315
if (isset ($ this ->objectTypes [$ field ])) {
316
316
$ field_info ['type ' ] = $ this ->objectTypes [$ field ];
317
- }
317
+ }
318
318
else {
319
319
if (!($ field_info ['type ' ]->ofType instanceof \Closure) && !($ field_info ['type ' ]->ofType instanceof InterfaceType)) {
320
320
$ args [$ field ] = [
@@ -323,10 +323,6 @@ public function entityToGqlQueryArg($entity_type, $bundle = NULL) {
323
323
];
324
324
$ this ->allArgTypes [get_class ($ field_info ['type ' ]->ofType )] = get_class ($ field_info ['type ' ]->ofType );
325
325
}
326
- else {
327
- $ type = get_class ($ field_info ['type ' ]->ofType );
328
- $ this ->addError ("Type {$ type } cannot be used as args for {$ field }" );
329
- }
330
326
}
331
327
}
332
328
@@ -518,8 +514,9 @@ public function getFields($entity_type, $bundle = '') {
518
514
]) : Type::string ();
519
515
520
516
if (!$ fieldType ) {
521
- dump ($ info );
522
- die ("Cannot detect fieldType for {$ entity_type } {$ property }" );
517
+ // dump($info);
518
+ // die("Cannot detect fieldType for {$entity_type} {$property}");
519
+ $ this ->addError ("Cannot detect fieldType for {$ entity_type } {$ property }" );
523
520
continue ;
524
521
}
525
522
@@ -563,9 +560,9 @@ public function getFields($entity_type, $bundle = '') {
563
560
]);
564
561
565
562
if (!$ fieldType ) {
566
- dump ($ fieldType , $ field_info );
567
- die ("Cannot detect field type of {$ field }" );
568
- $ this ->addError ("Cannot detect field type of {$ field }" );
563
+ // dump($fieldType, $field_info);
564
+ // die("Cannot detect field type of {$field}");
565
+ $ this ->addError ("Cannot convert Drupal field type ' {$ field }' -> GrahpQL field type. " );
569
566
continue ;
570
567
}
571
568
@@ -741,9 +738,9 @@ public function drupalToGqlFieldType($drupalType, $context = []) {
741
738
}
742
739
743
740
if (!$ type ) {
744
- dump ($ context );
745
- die ("Cannot convert {$ drupalType } to GraphQL type. " );
746
- $ this ->addError ("Cannot convert {$ drupalType } to GraphQL type. " . print_r ( $ context , TRUE ) );
741
+ // dump($context, debug_backtrace() );
742
+ // die("Cannot convert {$drupalType} to GraphQL type.");
743
+ $ this ->addError ("Cannot convert Drupal property type ' {$ drupalType }' -> GraphQL type. Please register this type with hook_graphql_api_info() " );
747
744
}
748
745
749
746
return $ type ;
0 commit comments