class TargetIdResolver

Same name in other branches
  1. 9 core/modules/serialization/src/EntityResolver/TargetIdResolver.php \Drupal\serialization\EntityResolver\TargetIdResolver
  2. 10 core/modules/serialization/src/EntityResolver/TargetIdResolver.php \Drupal\serialization\EntityResolver\TargetIdResolver
  3. 11.x 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 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 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

Title Sort descending Modifiers Object type Summary Overriden Title
TargetIdResolver::resolve public function Returns the local ID of an entity referenced by serialized data. Overrides EntityResolverInterface::resolve

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.