/** * @param WorkflowStep $step * @return WorkflowDefinition */ public function removeStep(WorkflowStep $step) { $stepName = $step->getName(); if ($this->hasStepByName($stepName)) { $step = $this->getStepByName($stepName); $this->steps->removeElement($step); } return $this; }
/** * @param WorkflowStep $workflowStep * @return WorkflowStep */ public function import(WorkflowStep $workflowStep) { $this->setName($workflowStep->getName())->setLabel($workflowStep->getLabel())->setStepOrder($workflowStep->getStepOrder())->setFinal($workflowStep->isFinal()); return $this; }
public function testGetAllowedTransitions() { $firstTransition = new Transition(); $firstTransition->setName('first_transition'); $secondTransition = new Transition(); $secondTransition->setName('second_transition'); $workflowStep = new WorkflowStep(); $workflowStep->setName('test_step'); $step = new Step(); $step->setName($workflowStep->getName()); $step->setAllowedTransitions(array($secondTransition->getName())); $workflow = $this->createWorkflow(); $workflow->getStepManager()->setSteps(array($step)); $workflow->getTransitionManager()->setTransitions(array($firstTransition, $secondTransition)); $workflowItem = new WorkflowItem(); $workflowItem->setCurrentStep($workflowStep); $actualTransitions = $workflow->getTransitionsByWorkflowItem($workflowItem); $this->assertEquals(array($secondTransition), $actualTransitions->getValues()); }