|
@@ -1,10 +1,11 @@
|
|
|
<?php
|
|
|
-
|
|
|
namespace WorkflowBundle\Twig;
|
|
|
|
|
|
use Symfony\Component\Workflow\Registry;
|
|
|
use Symfony\Component\Translation\TranslatorInterface;
|
|
|
|
|
|
+use Symfony\Component\Workflow\Exception\InvalidArgumentException;
|
|
|
+
|
|
|
class WorkflowExtension extends \Twig_Extension
|
|
|
{
|
|
|
private $workflowRegistry;
|
|
@@ -90,7 +91,11 @@ class WorkflowExtension extends \Twig_Extension
|
|
|
$nodes = array();
|
|
|
$links = array();
|
|
|
|
|
|
+ try{
|
|
|
$definition = $this->workflowRegistry->get($object, $name)->getDefinition();
|
|
|
+ }catch (InvalidArgumentException $e){
|
|
|
+ return json_encode(array());
|
|
|
+ }
|
|
|
$places = $definition->getPlaces();
|
|
|
$initial = $definition->getInitialPlace();
|
|
|
$transitions = $definition->getTransitions();
|