Skip to content

Commit

Permalink
[SF2] fixed fallback as service
Browse files Browse the repository at this point in the history
  • Loading branch information
liuggio committed Sep 7, 2013
1 parent 54710cf commit 8861eb2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Modify the `app/config/config.yml` only if you need:
godfather:
contexts:
manager:
name: manager
fallback: %manager.standard.class%
interface: %manager.interface.class%
cart: ~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;

Expand Down Expand Up @@ -44,7 +45,10 @@ protected function addContext(array $context, ContainerBuilder $container)

$contextName = $context['name'];
$contextInterface = isset($context['interface'])?$context['interface']:null;
$fallback = isset($context['fallback'])?$context['fallback']:null;
$fallback = null;
if (isset($context['fallback'])) {
$fallback = new Reference($context['fallback']);
}

$godfather->addMethodCall('addContext', array($contextName, $contextInterface, $fallback));
}
Expand Down

0 comments on commit 8861eb2

Please sign in to comment.