public function ChainEntityResolver::resolve

Implements \Drupal\serialization\EntityResolver\EntityResolverInterface::resolve().

Overrides EntityResolverInterface::resolve

File

drupal/core/modules/serialization/lib/Drupal/serialization/EntityResolver/ChainEntityResolver.php, line 37
Contains \Drupal\serialization\EntityResolver\ChainEntityResolver

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) {
    if ($resolved = $resolver
      ->resolve($normalizer, $data, $entity_type)) {
      return $resolved;
    }
  }
  return NULL;
}