protected function JsonApiGenerator::isToManyRelationship in OpenAPI 8
Checks if the relationship is to-many.
Parameters
string $route_name: The route name.
\Drupal\jsonapi\ResourceType\ResourceType $resource_type: The resource type.
Return value
bool Indicates if the relationship is multiple cardinality.
2 calls to JsonApiGenerator::isToManyRelationship()
- JsonApiGenerator::getEntityResponsesJsonApi in src/
Plugin/ openapi/ OpenApiGenerator/ JsonApiGenerator.php - JsonApiGenerator::getMethodParameters in src/
Plugin/ openapi/ OpenApiGenerator/ JsonApiGenerator.php - Get the parameters array for a method on a route.
File
- src/
Plugin/ openapi/ OpenApiGenerator/ JsonApiGenerator.php, line 979
Class
- JsonApiGenerator
- Defines an OpenApi Schema Generator for the JsonApi module.
Namespace
Drupal\openapi\Plugin\openapi\OpenApiGeneratorCode
protected function isToManyRelationship($route_name, ResourceType $resource_type) {
$public_field_name = explode('.', $route_name)[2];
$internal_field_name = $resource_type
->getInternalName($public_field_name);
$field_definitions = $this->fieldManager
->getFieldDefinitions($resource_type
->getEntityTypeId(), $resource_type
->getBundle());
return $field_definitions[$internal_field_name]
->getFieldStorageDefinition()
->getCardinality() !== 1;
}