/**
  * Update the crawler status
  *
  * @param \Cx\Core_Modules\LinkManager\Model\Entity\Crawler $crawler Crawler instance
  * @param string                                            $status  Crawler status
  */
 public function updateCrawlerStatus(\Cx\Core_Modules\LinkManager\Model\Entity\Crawler $crawler, $status)
 {
     $crawlerStartTime = $crawler->getStartTime()->format(ASCMS_DATE_FORMAT_INTERNATIONAL_DATETIME);
     //Update the crawler's totalLinks, totalBrokenLinks and status
     $totalLinks = $this->linkRepo->getLinksCountByLang($crawlerStartTime, $this->langId);
     $totalBrokenLinks = $this->linkRepo->getDetectedBrokenLinksCount($crawlerStartTime, $this->langId);
     $crawler->updateEndTime();
     $crawler->setRunStatus($status);
     $crawler->setTotalLinks($totalLinks);
     $crawler->setTotalBrokenLinks($totalBrokenLinks);
     $this->em->flush();
 }
 /**
  * update the crawler status
  * 
  * @param integer $id     current crawler run id
  * @param string  $status current crawler run status
  * 
  * @return boolean
  */
 public function updateCrawlerStatus($id, $status)
 {
     if (empty($id)) {
         $objCrawler = $this->crawlerRepo->getLastRunByLang($this->langId);
     } else {
         $objCrawler = $this->crawlerRepo->findOneBy(array('id' => $id));
     }
     if ($objCrawler) {
         $totalLinks = $this->linkRepo->getLinksCountByLang($objCrawler->getStartTime()->format(ASCMS_DATE_FORMAT_INTERNATIONAL_DATETIME), $this->langId);
         $totalBrokenLinks = $this->linkRepo->getDetectedBrokenLinksCount($objCrawler->getStartTime()->format(ASCMS_DATE_FORMAT_INTERNATIONAL_DATETIME), $this->langId);
         $objCrawler->updateEndTime();
         $objCrawler->setRunStatus($status);
         $objCrawler->setTotalLinks($totalLinks);
         $objCrawler->setTotalBrokenLinks($totalBrokenLinks);
         $this->em->persist($objCrawler);
         $this->em->flush();
         return true;
     }
 }