class ChainEntityResolver in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/serialization/src/EntityResolver/ChainEntityResolver.php \Drupal\serialization\EntityResolver\ChainEntityResolver
Resolver delegating the entity resolution to a chain of resolvers.
Hierarchy
- class \Drupal\serialization\EntityResolver\ChainEntityResolver implements ChainEntityResolverInterface
Expanded class hierarchy of ChainEntityResolver
2 files declare their use of ChainEntityResolver
- ChainEntityResolverTest.php in core/
modules/ serialization/ tests/ src/ Unit/ EntityResolver/ ChainEntityResolverTest.php - Contains \Drupal\Tests\serialization\Unit\EntityResolver\ChainEntityResolverTest.
- NormalizerTestBase.php in core/
modules/ hal/ src/ Tests/ NormalizerTestBase.php - Contains \Drupal\hal\Tests\NormalizerTestBase.
1 string reference to 'ChainEntityResolver'
- serialization.services.yml in core/
modules/ serialization/ serialization.services.yml - core/modules/serialization/serialization.services.yml
1 service uses ChainEntityResolver
- serializer.entity_resolver in core/
modules/ serialization/ serialization.services.yml - Drupal\serialization\EntityResolver\ChainEntityResolver
File
- core/
modules/ serialization/ src/ EntityResolver/ ChainEntityResolver.php, line 15 - Contains \Drupal\serialization\EntityResolver\ChainEntityResolver.
Namespace
Drupal\serialization\EntityResolverView source
class ChainEntityResolver implements ChainEntityResolverInterface {
/**
* The concrete resolvers.
*
* @var \Drupal\serialization\EntityResolver\EntityResolverInterface[]
*/
protected $resolvers = array();
/**
* Constructs a ChainEntityResolver object.
*
* @param \Drupal\serialization\EntityResolver\EntityResolverInterface[] $resolvers
* The array of concrete resolvers.
*/
public function __construct(array $resolvers = array()) {
$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;
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ChainEntityResolver:: |
protected | property | The concrete resolvers. | |
ChainEntityResolver:: |
public | function |
Adds an entity resolver. Overrides ChainEntityResolverInterface:: |
|
ChainEntityResolver:: |
public | function |
Returns the local ID of an entity referenced by serialized data. Overrides EntityResolverInterface:: |
|
ChainEntityResolver:: |
public | function | Constructs a ChainEntityResolver object. |