Unverified Commit 6339e35f authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3225034 by bbrala: Simplify ResourceTypeRepository control flow for returning cached data

(cherry picked from commit c1ceedb7)
parent dfd50471
Loading
Loading
Loading
Loading
+20 −17
Original line number Diff line number Diff line
@@ -118,7 +118,10 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager, Ent
   */
  public function all() {
    $cached = $this->cache->get('jsonapi.resource_types', FALSE);
    if ($cached === FALSE) {
    if ($cached) {
      return $cached->data;
    }

    $resource_types = [];
    foreach ($this->entityTypeManager->getDefinitions() as $entity_type) {
      $bundles = array_keys($this->entityTypeBundleInfo->getBundleInfo($entity_type->id()));
@@ -134,8 +137,8 @@ public function all() {
      $resource_type->setRelatableResourceTypes($relatable_resource_types);
    }
    $this->cache->set('jsonapi.resource_types', $resource_types, Cache::PERMANENT, $this->cacheTags);
    }
    return $cached ? $cached->data : $resource_types;

    return $resource_types;
  }

  /**