diff --git a/config/workflow.php b/config/workflow.php index 7c6fd39..8ce43d4 100644 --- a/config/workflow.php +++ b/config/workflow.php @@ -1,7 +1,7 @@ [ + 'straight' => [ 'type' => 'state_machine', 'marking_store' => [ 'type' => 'single_state', @@ -16,7 +16,10 @@ 't2' => [ 'from' => 'b', 'to' => 'c', - ] + ], + ], + 'options' => [ + 'node' => ['fontname' => 'SimHei'], ], - ] + ], ]; diff --git a/src/Commands/WorkflowDumpCommand.php b/src/Commands/WorkflowDumpCommand.php index fa008e1..73ed733 100644 --- a/src/Commands/WorkflowDumpCommand.php +++ b/src/Commands/WorkflowDumpCommand.php @@ -7,7 +7,6 @@ use Illuminate\Console\Command; use Symfony\Component\Process\Process; use Symfony\Component\Workflow\Dumper\GraphvizDumper; -use Symfony\Component\Workflow\Workflow as SynfonyWorkflow; use Workflow; /** @@ -40,10 +39,10 @@ class WorkflowDumpCommand extends Command */ public function handle() { - $workflowName = $this->argument('workflow'); - $format = $this->option('format'); - $class = $this->option('class'); - $config = Config::get('workflow'); + $workflowName = $this->argument('workflow'); + $format = $this->option('format'); + $class = $this->option('class'); + $config = Config::get('workflow'); if (!isset($config[$workflowName])) { throw new Exception("Workflow $workflowName is not configured."); @@ -51,11 +50,11 @@ public function handle() if (false === array_search($class, $config[$workflowName]['supports'])) { throw new Exception("Workflow $workflowName has no support for class $class.". - ' Please specify a valid support class with the --class option.'); + ' Please specify a valid support class with the --class option.'); } - $subject = new $class; - $workflow = Workflow::get($subject, $workflowName); + $subject = new $class(); + $workflow = Workflow::get($subject, $workflowName); $definition = $workflow->getDefinition(); $dumper = new GraphvizDumper(); @@ -63,7 +62,7 @@ public function handle() $dotCommand = "dot -T$format -o $workflowName.$format"; $process = new Process($dotCommand); - $process->setInput($dumper->dump($definition)); + $process->setInput($dumper->dump($definition, null, $config[$workflowName]['options'] ?? [])); $process->mustRun(); } }