/**
  * @desc Scraping only a partition of articles
  *
  * @param $poolSize
  * @param $laneNumber
  */
 function doScrapeLane($poolSize, $laneNumber)
 {
     $artistCount = $this->getArtistCount();
     $laneSize = ceil($artistCount / $poolSize);
     $laneOffset = $laneSize * ($laneNumber - 1);
     $this->output(sprintf('Scraping lane %d of %d size %d/%d artists' . PHP_EOL, $laneNumber, $poolSize, $laneSize, $artistCount));
     $artists = $this->getArtistPageIds($laneSize, $laneOffset);
     while ($page = $this->db->fetchObject($artists)) {
         $this->setArticleId($page->cl_from);
         $this->doScrapeArtist();
     }
 }
 private function _getData()
 {
     if (is_string($this->dataSource)) {
         $db = new DataBase();
         $db->Query($this->dataSource);
         if ($db->numRows() > 0) {
             while ($data = $db->fetchObject()) {
                 array_push($this->data, $data);
             }
         } else {
             $this->data = NULL;
         }
     }
     if (is_object($this->dataSource) && !is_string($this->dataSource)) {
         $this->data = $this->dataSource;
     }
     if (is_array($this->dataSource)) {
         $this->data = $this->dataSource;
     }
     $this->getDataKeys();
 }
 /**
  * Find the related objects of the model
  * @param $table The name of the table of the objects
  * @param $conditions The relation conditions
  * @return array Array of objects
  */
 public function _findRelations($table, $conditions)
 {
     if (count($conditions) == 0) {
         $query = "SELECT * FROM {$table}";
     } else {
         $query = "SELECT * FROM {$table} WHERE ( {$conditions} )";
     }
     $db2 = new DataBase();
     $db2->query($query);
     $numResults = $db2->numRows();
     $results = array();
     for ($i = 0; $i < $numResults; $i++) {
         $result = $db2->fetchObject();
         $results[] = new $table($result);
     }
     return $results;
 }