function indexWho(Request $request, Application $app) { $erb = new \com\meetyournextmp\repositories\builders\EventRepositoryBuilder(); $erb->setIncludeNoHumansOnly(true); $erb->setAfterNow(); $erb->setIncludeDeleted(false); $erb->setIncludeCancelled(false); $erb->setLimit(50); $this->parameters['events'] = $erb->fetchAll(); return $app['twig']->render('site/help/who.html.twig', $this->parameters); }
// setup $siteRepo = new \repositories\SiteRepository(); $site = $siteRepo->loadById($CONFIG->singleSiteID); configureAppForSite($site); $innerSQL = "SELECT human_in_area.area_id, COUNT(human_tweet.id) As tweets FROM human_in_area " . " LEFT JOIN human_tweet ON human_tweet.human_id = human_in_area.human_id AND human_in_area.removed_at IS NULL " . "GROUP BY human_in_area.area_id"; // Get area $stat = $DB->prepare("SELECT area_information.* FROM area_information " . " JOIN area_mapit_information ON area_mapit_information.area_id = area_information.id " . " JOIN (" . $innerSQL . ") AS area_tweets ON area_tweets.area_id = area_information.id " . " WHERE area_tweets.tweets = 0 AND area_information.is_deleted = '0' AND area_information.cached_future_events > " . EVENTS_NEEDED_IN_AREA . " ORDER BY area_information.cached_future_events DESC LIMIT 1 "); $stat->execute(); if ($stat->rowCount() == 0) { die("No AREA Data"); } $area = new \models\AreaModel(); $area->setFromDataBaseRow($stat->fetch()); $areaURL = "http://" . $CONFIG->webSiteDomain . "/area/" . $area->getSlugForUrl(); print "Found Area " . $area->getTitle() . "\n"; $erb = new \com\meetyournextmp\repositories\builders\EventRepositoryBuilder(); $erb->setAfterNow(); $erb->setArea($area); $erb->setIncludeCancelled(false); $erb->setIncludeDeleted(false); $events = $erb->fetchCount(); if ($events < EVENTS_NEEDED_IN_AREA) { die("We checked and found less than " . EVENTS_NEEDED_IN_AREA . " events; is cache broken!"); } $hrb = new \com\meetyournextmp\repositories\builders\HumanRepositoryBuilder(); $hrb->setIncludeDeleted(false); $hrb->setArea($area); $humans = $hrb->fetchAll(); $humanTweets = array(); $humanTweetRepo = new \com\meetyournextmp\repositories\HumanTweetRepository(); foreach ($humans as $human) {