Skip to content

Commit

Permalink
fixed sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
liuggio committed Jan 14, 2014
1 parent 6da14c2 commit 837ea01
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions example/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ services:
class: PUGX\Godfather\Godfather
arguments: [@container, 'godfather']

godfather.context:
class: PUGX\Godfather\Context\Context

container:
class: PUGX\Godfather\Container\SymfonyContainerBuilder
arguments: [@service_container]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,20 @@ protected function addInstance($name, array $parameters, ContainerBuilder $conta
*/
protected function addContext(ContainerBuilder $container, $prefix, $name, array $context)
{
$fallback = null;
$serviceName = $prefix.'.'.$name;
$default = 'godfather.context';
if (isset($context['fallback']) || isset($context['class'])) {
$fallback = $context['fallback'];
$context = new Definition($context['class'], array($fallback));

if (!isset($context['class'])) {
$context['class'] = 'PUGX\Godfather\Context\Context';
}

$context = new Definition($context['class'], array($context['fallback']));
$container->setDefinition($serviceName, $context);

return ;
}

$container->setAlias($serviceName, $default);
$container->setAlias($serviceName, 'godfather.context');
}

/**
Expand Down

0 comments on commit 837ea01

Please sign in to comment.