@@ -677,9 +677,17 @@ public function getMutation() {
677677 public function addFieldDefs () {
678678 $ this ->collectTimeMetric (__METHOD__ );
679679 foreach (field_info_fields () as $ field => $ field_info ) {
680+ $ field_properties = [];
680681 if (!empty ($ field_info ['columns ' ])) {
682+ $ field_properties = $ field_info ['columns ' ];
683+ }
684+ if (!empty ($ field_info ['property info ' ])) {
685+ $ field_properties = $ field_info ['property info ' ];
686+ }
687+
688+ if (!empty ($ field_properties )) {
681689 $ graphql_fields = [];
682- foreach ($ field_info [ ' columns ' ] as $ column => $ info ) {
690+ foreach ($ field_properties as $ column => $ info ) {
683691 $ graphql_fields [$ column ] = [
684692 'type ' => $ this ->drupalToGqlFieldType ($ info ['type ' ]),
685693 'description ' => ''
@@ -699,6 +707,7 @@ public function addFieldDefs() {
699707 $ this ->addObjectType ($ field_info ['type ' ], $ objectDef );
700708 }
701709 }
710+
702711 }
703712 $ this ->collectTimeMetric (__METHOD__ );
704713 }
@@ -1472,13 +1481,17 @@ public function getFields($entity_type, $bundle = '') {
14721481 if ($ field_info ['type ' ] === 'a_field_relation_reference ' ) {
14731482 continue ;
14741483 }
1475-
1476- $ fieldType = $ this ->gqlFieldType ($ field_info ['type ' ], [
1477- 'entity_type ' => $ entity_type ,
1478- 'bundle ' => $ bundle ,
1479- 'property ' => $ field ,
1480- 'info ' => $ field_info
1481- ]);
1484+
1485+ if (isset ($ this ->objectTypes [$ field ])) {
1486+ $ fieldType = $ this ->objectTypes [$ field ];
1487+ } else {
1488+ $ fieldType = $ this ->gqlFieldType ($ field_info ['type ' ], [
1489+ 'entity_type ' => $ entity_type ,
1490+ 'bundle ' => $ bundle ,
1491+ 'property ' => $ field ,
1492+ 'info ' => $ field_info
1493+ ]);
1494+ }
14821495
14831496 if (!$ fieldType ) {
14841497 $ this ->addError ("Cannot detect field type of {$ field }" );
@@ -1750,10 +1763,6 @@ public function drupalToGqlFieldType($drupalType, $context = []) {
17501763 // @fixme datetime should have object defs
17511764 $ type = Type::string ();
17521765 break ;
1753- case 'struct ' :
1754- // @fixme struct should have object defs
1755- $ type = Type::string ();
1756- break ;
17571766 case 'array ' :
17581767 $ type = ListOfType::string ();
17591768 break ;
0 commit comments