From 85f566ee6765239f7847b78aaeb4d96b2f39294d Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Sat, 7 Feb 2015 01:25:37 +0100 Subject: [PATCH] forms: get backend from process --- application/controllers/NodeController.php | 32 ++++++++++------------ application/forms/ProcessForm.php | 1 + application/forms/SimulationForm.php | 1 + 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/application/controllers/NodeController.php b/application/controllers/NodeController.php index b3e2cf0..1ecb6d6 100644 --- a/application/controllers/NodeController.php +++ b/application/controllers/NodeController.php @@ -13,10 +13,9 @@ class Businessprocess_NodeController extends Controller $node = $bp->getNode($this->getParam('node')); $form = new ProcessForm(); - $form->setBackend($this->backend) - ->setProcess($bp) - ->setNode($node) - ->handleRequest(); + $form->setProcess($bp) + ->setNode($node) + ->handleRequest(); $this->view->form = $form; $this->view->node = $node; @@ -33,19 +32,18 @@ class Businessprocess_NodeController extends Controller ); $form = new SimulationForm(); - $form->setBackend($this->backend) - ->setProcess($bp) - ->setSession($this->session()) - ->setNode($node) - // TODO: find a better way to handle redirects - ->setRedirectUrl( - sprintf( - 'businessprocess/process/show?simulation=1&processName=%s#!%s', - $bp->getName(), - $detail->getAbsoluteUrl() - ) - ) - ->handleRequest(); + $form->setProcess($bp) + ->setSession($this->session()) + ->setNode($node) + // TODO: find a better way to handle redirects + ->setRedirectUrl( + sprintf( + 'businessprocess/process/show?simulation=1&processName=%s#!%s', + $bp->getName(), + $detail->getAbsoluteUrl() + ) + ) + ->handleRequest(); $this->view->form = $form; $this->view->node = $node; diff --git a/application/forms/ProcessForm.php b/application/forms/ProcessForm.php index 31ca7b6..409fba7 100644 --- a/application/forms/ProcessForm.php +++ b/application/forms/ProcessForm.php @@ -72,6 +72,7 @@ class ProcessForm extends Form public function setProcess($process) { $this->process = $process; + $this->setBackend($process->getBackend()); $this->processList = array(); foreach ($process->getNodes() as $node) { if ($node instanceof BpNode) { diff --git a/application/forms/SimulationForm.php b/application/forms/SimulationForm.php index 601024b..61c2ee3 100644 --- a/application/forms/SimulationForm.php +++ b/application/forms/SimulationForm.php @@ -60,6 +60,7 @@ class SimulationForm extends Form public function setProcess($process) { $this->process = $process; + $this->setBackend($process->getBackend()); return $this; }