Mercurial > hg > isophonics-drupal-site
view core/modules/serialization/src/EntityResolver/ChainEntityResolver.php @ 13:5fb285c0d0e3
Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've
been lucky to get away with this so far, as we don't support self-registration
which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5
was vulnerable to.
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:33:26 +0100 |
parents | 4c8ae668cc8c |
children |
line wrap: on
line source
<?php namespace Drupal\serialization\EntityResolver; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; /** * Resolver delegating the entity resolution to a chain of resolvers. */ class ChainEntityResolver implements ChainEntityResolverInterface { /** * The concrete resolvers. * * @var \Drupal\serialization\EntityResolver\EntityResolverInterface[] */ protected $resolvers = []; /** * Constructs a ChainEntityResolver object. * * @param \Drupal\serialization\EntityResolver\EntityResolverInterface[] $resolvers * The array of concrete resolvers. */ public function __construct(array $resolvers = []) { $this->resolvers = $resolvers; } /** * {@inheritdoc} */ public function addResolver(EntityResolverInterface $resolver) { $this->resolvers[] = $resolver; } /** * {@inheritdoc} */ 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; } } } }