1. 8.3.x core/modules/serialization/src/EntityResolver/TargetIdResolver.php TargetIdResolver
  2. 8.0.x core/modules/serialization/src/EntityResolver/TargetIdResolver.php TargetIdResolver
  3. 8.1.x core/modules/serialization/src/EntityResolver/TargetIdResolver.php TargetIdResolver
  4. 8.2.x core/modules/serialization/src/EntityResolver/TargetIdResolver.php TargetIdResolver
  5. 8.4.x core/modules/serialization/src/EntityResolver/TargetIdResolver.php TargetIdResolver

Resolves entities from data that contains an entity target ID.

Hierarchy

Expanded class hierarchy of TargetIdResolver

1 file declares its use of TargetIdResolver
NormalizerTestBase.php in core/modules/hal/tests/src/Kernel/NormalizerTestBase.php
1 string reference to 'TargetIdResolver'
serialization.services.yml in core/modules/serialization/serialization.services.yml
core/modules/serialization/serialization.services.yml

File

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

Namespace

Drupal\serialization\EntityResolver
View source
class TargetIdResolver implements EntityResolverInterface {

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

}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
TargetIdResolver::resolve public function Returns the local ID of an entity referenced by serialized data. Overrides EntityResolverInterface::resolve