function ChainEntityResolver::resolve

Same name in other branches
  1. 9 core/modules/serialization/src/EntityResolver/ChainEntityResolver.php \Drupal\serialization\EntityResolver\ChainEntityResolver::resolve()
  2. 10 core/modules/serialization/src/EntityResolver/ChainEntityResolver.php \Drupal\serialization\EntityResolver\ChainEntityResolver::resolve()
  3. 11.x core/modules/serialization/src/EntityResolver/ChainEntityResolver.php \Drupal\serialization\EntityResolver\ChainEntityResolver::resolve()

Overrides EntityResolverInterface::resolve

File

core/modules/serialization/src/EntityResolver/ChainEntityResolver.php, line 39

Class

ChainEntityResolver
Resolver delegating the entity resolution to a chain of resolvers.

Namespace

Drupal\serialization\EntityResolver

Code

public function resolve(NormalizerInterface $normalizer, $data, $entity_type) {
    foreach ($this->resolvers as $resolver) {
        $resolved = $resolver->resolve($normalizer, $data, $entity_type);
        if (isset($resolved)) {
            return $resolved;
        }
    }
}

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