private function processVisitsFrom($tableIndex) { $this->updateRowsToBeProcessed($tableIndex); $selectBuilder = new Gpf_SqlBuilder_SelectBuilder(); $selectBuilder->select->addAll(Pap_Db_Table_Visits::getInstance($tableIndex)); $selectBuilder->from->add(Pap_Db_Table_Visits::getName($tableIndex)); $selectBuilder->where->add(Pap_Db_Table_Visits::RSTATUS, '=', Pap_Db_Visit::INPROCESSING); $this->initVisitsWhere($selectBuilder->where); foreach ($selectBuilder->getAllRowsIterator() as $visitRecord) { $visit = new Pap_Db_Visit($tableIndex); $visit->fillFromRecord($visitRecord); $this->processAndUpdateVisit($visit); } }
/** * @return Pap_Db_Visit */ protected function getNextVisit($processedTableIndex) { $this->debug('Loading next unprocessed visit from database.'); $selectBuilder = new Gpf_SqlBuilder_SelectBuilder(); $selectBuilder->from->add(Pap_Db_Table_Visits::getName($processedTableIndex)); $selectBuilder->select->addAll(Pap_Db_Table_Visits::getInstance($processedTableIndex)); $selectBuilder->where->add(Pap_Db_Table_Visits::RSTATUS, '=', Pap_Db_Visit::UNPROCESSED); $selectBuilder->where->add(Pap_Db_Table_Visits::VISITORID_HASH, '=', $this->task->getWorkingAreaFrom()); $selectBuilder->limit->set(0, 1); $visit = new Pap_Db_Visit($processedTableIndex); try { $visit->fillFromSelect($selectBuilder); return $visit; } catch (Gpf_Exception $e) { return false; } }