Created
February 11, 2014 23:00
-
-
Save blockjon/8946114 to your computer and use it in GitHub Desktop.
This is how I'm trying to create a lazy loaded service.
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
$rollbarServiceDefinition = new \Symfony\Component\DependencyInjection\Definition('\RollbarNotifier'); | |
$rollbarServiceDefinition->addArgument($config['rollbarnotifier']); | |
$rollbarServiceDefinition->setLazy(true); | |
$container->setDefinition('foo.service.rollbarnotifier', $rollbarServiceDefinition); | |
... later on when I do a $container->get('foo.service.rollbarnotifier'), I see it invoking my __construct() function of \RollbarNotifier |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment