From 29f20449b8c660b2b02dbe1c94f915476feb4cfb Mon Sep 17 00:00:00 2001 From: Geert Eltink Date: Sat, 3 Sep 2016 16:18:51 +0200 Subject: [PATCH] Remove the global config array to ArrayObject conversion The config array to object conversion is Aura.Di specific only. Other containers like Disco can't handle this. It's better to convert the config array only where needed. Aura.Di needs this since it's the only way to inject the config into the container as it only accepts objects. --- config/config.php | 4 +--- .../Resources/config/container-aura-di.php | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/config/config.php b/config/config.php index a5446be..0abfc5e 100644 --- a/config/config.php +++ b/config/config.php @@ -30,6 +30,4 @@ } } -// Return an ArrayObject so we can inject the config as a service in Aura.Di -// and still use array checks like ``is_array``. -return new ArrayObject($config, ArrayObject::ARRAY_AS_PROPS); +return $config; diff --git a/src/ExpressiveInstaller/Resources/config/container-aura-di.php b/src/ExpressiveInstaller/Resources/config/container-aura-di.php index 7a3f712..6da2fa7 100644 --- a/src/ExpressiveInstaller/Resources/config/container-aura-di.php +++ b/src/ExpressiveInstaller/Resources/config/container-aura-di.php @@ -9,8 +9,8 @@ $builder = new ContainerBuilder(); $container = $builder->newInstance(); -// Inject config -$container->set('config', $config); +// Convert config to an object and inject it +$container->set('config', new ArrayObject($config, ArrayObject::ARRAY_AS_PROPS)); // Inject factories foreach ($config['dependencies']['factories'] as $name => $object) {