Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. TargetIdResolver.php

function TargetIdResolver::resolve

Overrides EntityResolverInterface::resolve

File

core/modules/serialization/src/EntityResolver/TargetIdResolver.php, line 15

Class

TargetIdResolver
Resolves entities from data that contains an entity target ID.

Namespace

Drupal\serialization\EntityResolver

Code

public function resolve(NormalizerInterface $normalizer, $data, $entity_type) {
    if (isset($data['target_id'])) {
        return $data['target_id'];
    }
    return NULL;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal