Esempio n. 1
0
 public function addStage(Stage $newStage)
 {
     foreach ($this->stages as $stage) {
         if ($stage->getId() == $newStage->getId()) {
             return;
         }
     }
     $this->stages[] = $newStage;
 }
 /**
  * @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');
 }