Skip to content
Snippets Groups Projects
Unverified Commit e24676b7 authored by Malik Kotob's avatar Malik Kotob Committed by Mateu Aguiló Bosch
Browse files

Issue #2948512 by malik.kotob, gabesullice, e0ipso: All resource configs...

Issue #2948512 by malik.kotob, gabesullice, e0ipso: All resource configs loaded for each individual resource config
parent 46801173
No related branches found
Tags 7.x-4.0-rc1
No related merge requests found
......@@ -57,6 +57,13 @@ class ConfigurableResourceTypeRepository extends ResourceTypeRepository {
*/
protected $enabledResourceTypes;
/**
* A list of all resource configuration entities.
*
* @var \Drupal\jsonapi_extras\Entity\JsonapiResourceConfig[]
*/
protected $resourceConfigs;
/**
* {@inheritdoc}
*/
......@@ -120,16 +127,17 @@ class ConfigurableResourceTypeRepository extends ResourceTypeRepository {
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
*/
function getResourceConfigs() {
$resource_config_ids = [];
foreach ($this->getEntityTypeBundleTuples() as $tuple) {
list($entity_type_id, $bundle) = $tuple;
$resource_config_ids[] = sprintf('%s--%s', $entity_type_id, $bundle);
if (!$this->resourceConfigs) {
$resource_config_ids = [];
foreach ($this->getEntityTypeBundleTuples() as $tuple) {
list($entity_type_id, $bundle) = $tuple;
$resource_config_ids[] = sprintf('%s--%s', $entity_type_id, $bundle);
}
$this->resourceConfigs = $this->entityTypeManager
->getStorage('jsonapi_resource_config')
->loadMultiple($resource_config_ids);
}
/** @var \Drupal\jsonapi_extras\Entity\JsonapiResourceConfig[] $resource_configs */
$resource_configs = $this->entityTypeManager
->getStorage('jsonapi_resource_config')
->loadMultiple($resource_config_ids);
return $resource_configs;
return $this->resourceConfigs;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment