This allows sections to specify either that processing should continue when
they??™re finished with the current task (by setting $mContinueNow to true) or that processing should pause (by
setting $mContinueNow to false). This is necessary because we need to wait for external input at certain points
along the pipeline when checking whether the products are in stock and whether the funds are available on the
customer??™s credit card.
CHAPTER 18 ?– IMPLEMENTING THE ORDER PIPELINE: PART 1 582
The pipeline section to process is selected by the private _GetCurrentPipelineSection() method, which
eventually returns a pipeline section class (we??™ll build these classes in the next chapter) corresponding to the current
status of the order. However, at this moment, _GetCurrentPipelineSection() has the job of setting the
process stage and returning an instance of PsDummy. In the next chapter, we??™ll implement classes representing
each pipeline section, and we??™ll return one of those classes instead of PsDummy.
// Gets current pipeline section
private function _GetCurrentPipelineSection()
{
$this->_mOrderProcessStage = 100;
$this->_mCurrentPipelineSection = new PsDummy();
}
Back to Process(), we see this method being called in a try block:
// Process pipeline section
try
{
while ($this->mContinueNow)
{
$this->mContinueNow = false;
$this->_GetCurrentPipelineSection();
$this->_mCurrentPipelineSection->Process($this);
}
}
Note that $mContinueNow is set to false in the while loop??”the default behavior is to stop after each pipeline
section.
Pages:
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700