public function setRelatableResourceTypes(array
$relatable_resource_types) { $this->fields =
array_reduce(array_keys($relatable_resource_types),
function D
$fields,
$public_field_name) use ($relatable_resource_types) { if (!
isset($this->fieldMapping
[$public_field_name])) { throw new \
LogicException('A field must exist for relatable resource types to be set on it.'
);
} $internal_field_name =
$this->fieldMapping
[$public_field_name];
$field =
$fields[$internal_field_name];
assert($field instanceof ResourceTypeRelationship
);
$fields[$internal_field_name] =
$field->
withRelatableResourceTypes($relatable_resource_types[$public_field_name]);
return $fields;
},
$this->fields
);
} /**
* Get all resource types with which this type may have a relationship.
*
* @return array
* The relatable resource types, keyed by relationship field names.
*
* @see self::setRelatableResourceTypes()
*/