/**
  * @Route("/regions/{id}/get-teams", name="region_teams")
  */
 public function getRegionTeamsAction(Region $region)
 {
     $sm = new SubscriptionManager($this->get('app.whoscored'), $this->getDoctrine()->getManager());
     $sm->getRegionTeams($region);
     $this->addFlash('notice', 'Downloaded teams from region ' . $region->getName());
     return $this->redirectToRoute('homepage');
 }
 /**
  * @Route("/{id}/update-db", name="update-db")
  */
 public function updateDb(Stage $stage)
 {
     $em = $this->getDoctrine()->getManager();
     $query = $em->createQuery('SELECT m FROM AppBundle:Match m WHERE m.status = 2 AND m.stage = :stage')->setParameter('stage', $stage->getId());
     $results = $query->getResult();
     foreach ($results as $match) {
         $sm = new SubscriptionManager($this->get('app.whoscored'), $this->get('doctrine.orm.entity_manager'));
         $sm->getMatchData($match);
     }
     $this->addFlash('notice', 'Flushed match data for stage ' . $stage->getName() . '. ' . count($results) . ' matches flushed.');
     return $this->redirectToRoute('homepage');
 }