protected function RestInspectionTrait::getEntityType in OpenAPI for REST 8.2
Gets the entity type if any for REST resource.
Parameters
\Drupal\rest\RestResourceConfigInterface $resource_config: The REST config resource.
Return value
\Drupal\Core\Entity\EntityTypeInterface|null The Entity Type or null.
2 calls to RestInspectionTrait::getEntityType()
- RestGenerator::getPaths in src/
Plugin/ openapi/ OpenApiGenerator/ RestGenerator.php - RestInspectionTrait::getRestEnabledEntityTypes in src/
RestInspectionTrait.php - Gets entity types that are enabled for rest.
File
- src/
RestInspectionTrait.php, line 87
Class
- RestInspectionTrait
- Common functions for inspecting REST resources.
Namespace
Drupal\openapi_restCode
protected function getEntityType(RestResourceConfigInterface $resource_config) {
if ($this
->isEntityResource($resource_config)) {
$resource_plugin = $resource_config
->getResourcePlugin();
return $this->entityTypeManager
->getDefinition($resource_plugin
->getPluginDefinition()['entity_type']);
}
return NULL;
}