public function locateStep(SlameWorkflow $wfen) { // Check for this step if (isset($this->groups[$wfen->getWorkflowGroup()])) { // Isolate step name $step_name = $wfen->getWorkflowStep(); $all_steps = $this->groups[$wfen->getWorkflowGroup()]->getSteps(); // Check for the children if ($step = $this->groups[$wfen->getWorkflowGroup()]->getStep($step_name)) { return $step; } } return false; }
public function addJourney($previous = null, $group, $step, $errors = array(), $data = array(), $reasons = array()) { // Create the first entry $wf = new SlameWorkflow(); $wf->setPrevious($previous); $wf->setWorkflowName($this->namespace); $wf->setWorkflowGroup($group); $wf->setWorkflowStep($step); $wf->setObjectClass($this->object_class); $wf->setForeignKey($this->entity->getId()); $wf->setSuccess(count($errors) === 0 ? true : false); $wf->setData($data); $wf->setReasons($reasons); $wf->setErrors($errors); $wf->setCreated(new \DateTime()); // Persist Journey Object $this->stackEm[] = $wf; // Push Last Step array_unshift($this->journey, $wf); // Add Journey Success if ($wf->getSuccess() === true) { array_unshift($this->journey_success, $wf); } // Return ref return $wf; }