Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Commit

Permalink
Remove the global config array to ArrayObject conversion
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
geerteltink committed Sep 3, 2016
1 parent 4ee8d34 commit 29f2044
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 29f2044

Please sign in to comment.