/** * Prepare data before saving * * @return \Docoflow\Docoflow */ public function prepare() { if (!$this->step) { throw new Exception('Cannot create workflow, steps are empty.'); } $steps = $this->step->rebuild(); if (!$this->group) { throw new Exception('Cannot create workflow, groups are empty.'); } $this->group->rebuild($steps); if (!$this->verificator) { throw new Exception('Cannot create workflow, verificators are empty.'); } $this->verificator->rebuild($steps); $this->prepared = $steps; return $this; }
/** * Get verificators in certain step. If you have 4 steps in your workflow, and you want to get a list of verificators only in 3rd step: * * ```php * Flo::fetch(1)->verificatorsInStep(3); * ``` * * @param int $step Step you want to return * * @return array|\Docoflow\Entity\Verificator */ public function verificatorsInStep($step) { if (isset($this->groupedVerificators[$step])) { return $this->groupedVerificators[$step]; } if (!$this->bootstrapped->steps) { $this->makeInternalSteps(); } $steps = $this->step($step); if (empty($steps)) { return []; } return $this->groupedVerificators[$step] = Group::make($steps->getRelated('groups'))->gatherVerificators(); }