- Issue created by @mxr576
- Merge request !9652Issue #3463547 by catch: Use API methods instead of form submissions in... β (Open) created by mxr576
- ππΊHungary mxr576 Hungary
Let's see if this idea and solution stands before test writing.
- π¬π§United Kingdom longwave UK
Is there ever a reason to unset any key from the container definition? If so then that is not possible with merging.
- ππΊHungary mxr576 Hungary
I do not think there is a use case for unsetting, only overriding.
- π¬π§United Kingdom longwave UK
Let's say we want to swap out cache.container for a different backend. We probably want to replace the
arguments
array - butNestedArray::mergeDeep()
will append new arguments instead of replacing:$bootstrap['services']['cache.container'] = [ 'class' => 'Drupal\Core\Cache\DatabaseBackend', 'arguments' => ['@database', '@cache_tags_provider.container', 'container', Drupal\Core\Cache\DatabaseBackend::MAXIMUM_NONE], ]; $bootstrap2['services']['cache.container'] = [ 'class' => 'Other\Service', 'arguments' => ['@other_backend'], ]; > Drupal\Component\Utility\NestedArray::mergeDeep($bootstrap, $bootstrap2); = [ "services" => [ "cache.container" => [ "class" => "Other\Service", "arguments" => [ "@database", "@cache_tags_provider.container", "container", -1, "@other_backend", ], ], ], ]
- πΊπΈUnited States smustgrave
Believe NW is the current status but let me know if I'm wrong.