public function setup()
    {
        if (!$this->getRoot()) {
            // we're missing for some reason!
            $this->isComplete = true;
            $this->remainingChildren = array();
            return;
        }
        $remainingChildren = array();
        $remainingChildren[] = $this->getRoot()->ID;
        $this->remainingChildren = $remainingChildren;

        // we reset this to 1; this is because we only know for sure about 1 item remaining
        // as time goes by, this will increase as we discover more items that need processing
        $this->totalSteps = 1;
    }
public function setup()
    {
        if (!$this->getRoot()) {
            // we're missing for some reason!
            $this->isComplete = true;
            $this->remainingChildren = array();
            return;
        }
        $remainingChildren = array();
        $remainingChildren[] = $this->getRoot()->ID;
        $this->remainingChildren = $remainingChildren;

        // we reset this to 1; this is because we only know for sure about 1 item remaining
        // as time goes by, this will increase as we discover more items that need processing
        $this->totalSteps = 1;
    }
public function setup ( ) { if ( ! $ this -> getRoot ( ) ) { // we're missing for some reason! $ this -> isComplete = true ; $ this -> remainingChildren = array ( ) ; return ; } $ remainingChildren = array ( ) ; $ remainingChildren [ ] = $ this -> getRoot ( ) -> ID ; $ this -> remainingChildren = $ remainingChildren ; // we reset this to 1; this is because we only know for sure about 1 item remaining // as time goes by, this will increase as we discover more items that need processing $ this -> totalSteps = 1 ; }
This is called immediately before a job begins - it gives you a chance
to initialise job data and make sure everything's good to go

What we're doing in our case is to queue up the list of items we know we need to
process still (it's not everything - just the ones we know at the moment)

When we go through, we'll constantly add and remove from this queue, meaning
we never overload it with content
This is called immediately before a job begins - it gives you a chance to initialise job data and make sure everything s good to go