Add followingStep

@param \Amulen\ShopBundle\Entity\ProductOrderStatus $followingStep
@return ProductOrderStatus
421372
public function addFollowingStep(\Amulen\ShopBundle\Entity\ProductOrderStatus $followingStep = null)
    {
        $followingStep->addPreviousStep($this);
        $this->followingSteps[] = $followingStep;

        return $this;
    }
967917
public function run($step = 'add')
    {
        $this->setLogs($step, 'step');
        switch ($step) {
            // Step 1: Validate and add a contact to a queue for the next file for the client.
            case 'add':
                $this->getFieldValues();
                $this->fileEntitySelect(true);
                $this->fileEntityRefreshSettings();
                $this->addContactToQueue();
                break;

            // Step 3: Build the file (if a good time), performing a second validation on each contact.
            case 'build':
                if ($this->test) {
                    $this->getFieldValues();
                }
                $this->fileEntitySelect();
                $this->evaluateSchedule(true);
                $this->fileEntityRefreshSettings();
                $this->fileBuild();
                break;

            // Step 4: Perform file send operations, if any are configured.
            case 'send':
                $this->fileEntitySelect(false, File::STATUS_READY);
                $this->evaluateSchedule(true);
                $this->fileSend();
                break;
        }

        return $this;
    }
1145911
protected function setCurrentStep($step)
    {
        $this->session->CurrentStepID = $step->ID;
        $step->setForm($this);

        return $this->session->write();
    }
480767
private function redirectToNextStep($currentStep, $parameters = array())
    {
        $steps = array_keys($this->steps);
        $nextStep = $steps[1 + array_search($currentStep, $steps)];
        Piwik::redirectToModule('Installation', $nextStep, $parameters);
    }
8354
public function addStep(Step $step)
    {
        if (!$this->steps->contains($step)) {
            $step->setOrder($this->steps->count());
            $this->steps->add($step);
            $step->setExercise($this);
        }

        return $this;
    }
95977
protected function addStepElementsFor(\MUtil_Model_Bridge_FormBridgeInterface $bridge, \MUtil_Model_ModelAbstract $model, $step)
    {
        $this->displayHeader($bridge, $this->getFormTitle($step), 'h2');

        switch ($step) {
            case 2:
                $this->addStepFileCheck($bridge, $model);
                break;

            case 3:
                $this->addStepChangeTrack($bridge, $model);
                break;

            case 4:
                if ($this->trackEngine) {
                    $this->addStepRoundMatch($bridge, $model);
                } else {
                    $this->addStepCreateTrack($bridge, $model);
                }
                break;

            case 5:
                if ($this->trackEngine) {
                    $this->addStepMergeTrack($bridge, $model);
                    break;
                }
                // Intentional faal through

            default:
                $this->addStepFileImport($bridge, $model);
                break;

        }
    }
993103
protected function AllowAccessToStep($bRedirectToPreviousPermittedStep = false)
    {
        $bAllowAccess = parent::AllowAccessToStep($bRedirectToPreviousPermittedStep);
        $shopService = $this->getShopService();
        $oBasket = $shopService->getActiveBasket();
        // validate previous steps...
        $oActiveBasketPaymentMethod = $oBasket->GetActivePaymentMethod();
        $oActiveBasketShippingGroup = $oBasket->GetActiveShippingGroup();
        $bShippingCompleted = (array_key_exists('shipping', $oBasket->aCompletedOrderStepList) && true == $oBasket->aCompletedOrderStepList['shipping']);
        $bShippingCompleted = ($bShippingCompleted && !is_null($oActiveBasketPaymentMethod));
        $bShippingCompleted = ($bShippingCompleted && !is_null($oActiveBasketShippingGroup));
        $bAllowAccess = parent::AllowAccessToStep($bRedirectToPreviousPermittedStep);
        $oBasket = $shopService->getActiveBasket();
        $bUserDataCompleted = (array_key_exists('user', $oBasket->aCompletedOrderStepList) && true == $oBasket->aCompletedOrderStepList['user']);

        if ($oBasket->iTotalNumberOfUniqueArticles <= 0) {
            $bAllowAccess = false;
            if ($bRedirectToPreviousPermittedStep) {
                $oBasketStep = &TdbShopOrderStep::GetStep('basket');
                $this->JumpToStep($oBasketStep);
            }
        }

        $oUser = $this->getExtranetUserProvider()->getActiveUser();

        if (false === $this->getShopService()->getActiveShop()->allowPurchaseAsGuest()) {
            if (false === $oUser->IsLoggedIn()) {
                $bAllowAccess = false;
            }
        }

        if ($bAllowAccess && ($oUser->IsLoggedIn() || $bUserDataCompleted)) {
            // check to make sure we have a billing addres for the user
            $oBillingAdr = $oUser->GetBillingAddress();
            if (is_null($oBillingAdr) || !$oBillingAdr->ContainsData()) {
                $bUserDataCompleted = false;
            } else {
                $bUserDataCompleted = true;
            }

            if (!$bUserDataCompleted) {
                $bAllowAccess = false;
                if ($bRedirectToPreviousPermittedStep) {
                    $oUserStep = &TdbShopOrderStep::GetStep('user');
                    $this->JumpToStep($oUserStep);
                }
            }
        }

        if (!$bShippingCompleted) {
            $bAllowAccess = false;
            if ($bRedirectToPreviousPermittedStep) {
                $oMsgManager = $this->getFlashMessages();
                if (false == $oMsgManager->consumerHasMessages(TCMSMessageManager::GLOBAL_CONSUMER_NAME)) {
                    $oMsgManager->addMessage(TCMSMessageManager::GLOBAL_CONSUMER_NAME, 'ERROR-ORDER-REQUEST-PAYMENT-ERROR', array('errorMsg' => TGlobal::Translate('chameleon_system_shop.error.generic_payment_shipping_error')));
                }
                $oUserStep = &TdbShopOrderStep::GetStep('shipping');
                $this->JumpToStep($oUserStep);
            }
        }

        return $bAllowAccess;
    }
1202668
public function call_moveAfter(\Asgard\Entity\Entity $entity, $after_id) {
		$orm = $entity::orm();
		if($this->category)
			$orm->where($this->category, $entity->get($this->category));

		if($after_id == 0) {
			$min = $orm::min('position');
			$entity->save(['position' => $min-1]);
		}
		else {
			$i = 0;
			foreach($orm as $one) {
				if($one->id === $entity->id)
					continue;

				$one->save(['position' => $i++]);
				if($one->id == $after_id)
					$entity->save(['position' => $i++]);
			}
		}
	}
1163011
function nextStep( $step )
    {
        foreach ( $this->StepTable as $key => $tableStep )
        {
            if ( $step['class'] == $tableStep['class'] )
            {
                return $this->StepTable[++$key];
            }
        }
        $retValue = null;
        return $retValue;
    }
138331
public function removePreviousStep(\Amulen\ShopBundle\Entity\ProductOrderStatus $previousStep = null)
    {
        $this->previousSteps->removeElement($previousStep);
    }
628515
public function notifyPaymentOrderSuccess(
        PaymentBridgeInterface $paymentBridge,
        PaymentMethodInterface $paymentMethod
    ) {
        $paymentOrderSuccessEvent = new PaymentOrderSuccessEvent(
            $paymentBridge,
            $paymentMethod
        );

        $this
            ->eventDispatcher
            ->dispatch(
                PaymentCoreEvents::PAYMENT_ORDER_SUCCESS,
                $paymentOrderSuccessEvent
            );

        return $this;
    }
1227347
public void addStep(DeploymentOperationStep step) {
    if(currentStep != null) {
      steps.add(steps.indexOf(currentStep)+1, step);
    } else {
      steps.add(step);
    }
  }
300725
public function addStep($name, $callback)
    {
        $step = $this->factory([
            'Step',
            'wizard'  => $this,
            'template'=> clone $this->stepTemplate,
            'sequence'=> count($this->steps),
        ], $name);

        // add tabs menu item
        $this->steps[] = $this->add($step, 'Step');

        if (!$this->stepCallback->triggered()) {
            $_GET[$this->stepCallback->urlTrigger] = 0;
        }

        if ($step->sequence == $this->currentStep) {
            $step->addClass('active');

            $this->stepCallback->set($callback, [$this]);
        } elseif ($step->sequence < $this->currentStep) {
            $step->addClass('completed');
        }

        if ($step->icon == null) {
            $step->icon = $this->defaultIcon;
        }

        return $step;
    }
226002
public function after()
    {
        $this->importNodes(\func_get_args(), function ($node, $imported_node) {
            if ($node->nextSibling) {
                $node->parentNode->insertBefore($imported_node, $node->nextSibling);
            } else { // node is last, so there is no next sibling to insert before
                $node->parentNode->appendChild($imported_node);
            }
        });

        return $this;
    }
253765
public function nth($step, $offset = 0)
    {
        $new = [];

        $position = 0;

        foreach ($this->items as $item) {
            if ($position % $step === $offset) {
                $new[] = $item;
            }

            $position++;
        }

        return new static($new);
    }
1119263
public function addToRunSteps(string $name, $runStepsToAdd): self
    {
        $this->runSteps[$name] = $runStepsToAdd;
        return $this;
    }
131215
private function addAftersToDirectedGraph(StepRegistration $currentStep)
    {
        foreach ($currentStep->getAfters() as $after) {
            if (!isset($this->idToStep[$after->getDependsOnId()]) && $after->isEnforced()) {
                $allStepIds = implode(',', array_keys($this->idToStep));
                throw new PipelineBuildingException(
                    "Registration '{$after->getDependsOnId()}' specified in the insertafter of the '{$currentStep->getStepId()}' step does not exist. Current step ids: $allStepIds."
                );
            }

            if (isset($this->idToStep[$after->getDependsOnId()])) {
                $this->idDirectedGraph[$after->getDependsOnId()][] = $after->getDependantId();
            }
        }
    }