public function getNewsToActivate()
 {
     $today = gmdate("Y-m-d H:i:s");
     $query = new QueryObject(new News());
     $query->addAndCondition(QueryCriteria::lower('DateEmbargo', $today));
     $query->addAndCondition(QueryCriteria::greater('DateExpire', $today));
     $query->addAndCondition(QueryCriteria::equal('Approved', 0));
     list($activate_articles, $count) = $this->getAll($query, 0, 1000);
     return $activate_articles;
 }
 /**
  * @param string $period
  * @return mixed
  */
 public function makePurge($period = 'P1Y')
 {
     $repository = $this->jobs_repository;
     return $this->tx_manager->transaction(function () use($repository, $period) {
         $query = new QueryObject();
         $now = new DateTime();
         $now = $now->sub(new DateInterval($period));
         $query->addAndCondition(QueryCriteria::lower('JobPostedDate', $now->format('Y-m-d')));
         list($res, $count) = $repository->getAll($query, 0, 50);
         foreach ($res as $job) {
             $repository->delete($job);
         }
     });
 }