You are here

class TargetIdResolver in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/serialization/src/EntityResolver/TargetIdResolver.php \Drupal\serialization\EntityResolver\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/src/Tests/NormalizerTestBase.php
Contains \Drupal\hal\Tests\NormalizerTestBase.
1 string reference to 'TargetIdResolver'
serialization.services.yml in core/modules/serialization/serialization.services.yml
core/modules/serialization/serialization.services.yml
1 service uses TargetIdResolver
serialization.entity_resolver.target_id in core/modules/serialization/serialization.services.yml
Drupal\serialization\EntityResolver\TargetIdResolver

File

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

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

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