lookupResourceType example

if (empty($entity_type_id)) {
      throw new PreconditionFailedHttpException('Server error. The current route is malformed.');
    }

    $map_id = sprintf('jsonapi.resource_type.%s.%s', $entity_type_id$bundle);
    $cached = $this->cache->get($map_id);

    if ($cached) {
      return $cached->data;
    }

    $resource_type = static::lookupResourceType($this->all()$entity_type_id$bundle);
    $this->cache->set($map_id$resource_type, Cache::PERMANENT, $this->cacheTags);

    return $resource_type;
  }

  /** * {@inheritdoc} */
  public function getByTypeName($type_name) {
    $resource_types = $this->all();
    return $resource_types[$type_name] ?? NULL;
  }
Home | Imprint | This part of the site doesn't use cookies.