function RegisterEntityResolversCompilerPass::sort
Same name in other branches
- 9 core/modules/serialization/src/RegisterEntityResolversCompilerPass.php \Drupal\serialization\RegisterEntityResolversCompilerPass::sort()
- 10 core/modules/serialization/src/RegisterEntityResolversCompilerPass.php \Drupal\serialization\RegisterEntityResolversCompilerPass::sort()
- 11.x core/modules/serialization/src/RegisterEntityResolversCompilerPass.php \Drupal\serialization\RegisterEntityResolversCompilerPass::sort()
Sorts by priority.
Order services from highest priority number to lowest (reverse sorting).
Parameters
array $services: A nested array keyed on priority number. For each priority number, the value is an array of Symfony\Component\DependencyInjection\Reference objects, each a reference to a normalizer or encoder service.
Return value
array A flattened array of Reference objects from $services, ordered from high to low priority.
1 call to RegisterEntityResolversCompilerPass::sort()
- RegisterEntityResolversCompilerPass::process in core/
modules/ serialization/ src/ RegisterEntityResolversCompilerPass.php - Adds services to the Serializer.
File
-
core/
modules/ serialization/ src/ RegisterEntityResolversCompilerPass.php, line 50
Class
- RegisterEntityResolversCompilerPass
- Adds services tagged 'entity_resolver' to the Serializer.
Namespace
Drupal\serializationCode
protected function sort($services) {
$sorted = [];
krsort($services);
// Flatten the array.
foreach ($services as $a) {
$sorted = array_merge($sorted, $a);
}
return $sorted;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.