|
@@ -13,6 +13,7 @@ use Symfony\Component\Console\Input\ArrayInput;
|
|
|
use Symfony\Component\Console\Output\BufferedOutput;
|
|
|
use WorkflowBundle\Validator\Constraints as WorkflowAssert;
|
|
|
use Symfony\Component\Workflow\Registry;
|
|
|
+// TODO : Remplazar las referencias de "global $kenerl por algo mÃs testeable"
|
|
|
|
|
|
/**
|
|
|
* Workflow
|
|
@@ -456,18 +457,17 @@ class Workflow
|
|
|
}
|
|
|
|
|
|
public function getInitialPlace($subject) {
|
|
|
-
|
|
|
- global $kernel;
|
|
|
-
|
|
|
- try {
|
|
|
- $registry = $kernel->getContainer()->get("workflow.registry");
|
|
|
- $definition = $registry->get($subject, $this->name)->getDefinition();
|
|
|
- } catch (\Exception $e) {
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- return $definition->getInitialPlace();
|
|
|
-
|
|
|
+ global $kernel;
|
|
|
+ if($kernel){
|
|
|
+ try {
|
|
|
+ $registry = $kernel->getContainer()->get("workflow.registry");
|
|
|
+ $definition = $registry->get($subject, $this->name)->getDefinition();
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ return $definition->getInitialPlace();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -507,4 +507,4 @@ class Workflow
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
-}
|
|
|
+}
|