Last active
May 30, 2017 10:08
-
-
Save carteni/3480d9ae6662995d42aa524c99996de2 to your computer and use it in GitHub Desktop.
Symfony Dependency Injection. Simple ClosureLoader usage.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Symfony\Component\DependencyInjection\Loader | |
{ | |
$resource = function ($container) { | |
$config = new namespace\AppBundle\DI\ClosureConfig(); | |
$config($container); | |
}; | |
$loader->resolve($resource, null)->load($resource, null); | |
} | |
namespace Symfony\Component\DependencyInjection\Loader\AppBundle\DI | |
{ | |
class ClosureConfig | |
{ | |
public function __invoke($container) | |
{ | |
$container->setParameter("app.config.closure", "value"); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
imports: | |
- { resource: config.php } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment