Permalink
Browse files

[dependency_injection] fixed the Graphviz dumper when some services d…

…o not exist

git-svn-id: http://svn.symfony-project.com/components/dependency_injection/trunk@19676 ee427ae8-e902-0410-961c-c3ed070cd9f9
  • Loading branch information...
1 parent 3bf7609 commit 14e20cd785b4d5715299ebdf4e59fd9a236134c2 fabien committed Jun 29, 2009
Showing with 12 additions and 7 deletions.
  1. +12 −7 lib/sfServiceContainerDumperGraphviz.php
@@ -126,17 +126,22 @@ protected function findEdges($id, $arguments, $required, $name)
protected function findNodes()
{
$nodes = array();
- foreach ($this->container as $id => $service)
+
+ $container = clone $this->container;
+
+ foreach ($container->getServiceDefinitions() as $id => $definition)
{
- if (!$this->container->hasServiceDefinition($id))
- {
- $nodes[$id] = array('class' => get_class($service), 'attributes' => $this->options['node.instance']);
- }
+ $nodes[$id] = array('class' => $this->getValue($definition->getClass()), 'attributes' => array_merge($this->options['node.definition'], array('style' => $definition->isShared() ? 'filled' : 'dotted')));
+
+ $container->setServiceDefinition($id, new sfServiceDefinition('stdClass'));
}
- foreach ($this->container->getServiceDefinitions() as $id => $definition)
+ foreach ($container as $id => $service)
{
- $nodes[$id] = array('class' => $this->getValue($definition->getClass()), 'attributes' => array_merge($this->options['node.definition'], array('style' => $definition->isShared() ? 'filled' : 'dotted')));
+ if (!$container->hasServiceDefinition($id))
+ {
+ $nodes[$id] = array('class' => get_class($service), 'attributes' => $this->options['node.instance']);
+ }
}
return $nodes;

0 comments on commit 14e20cd

Please sign in to comment.