private function chgMatch(MatchForm $matchForm, Match $match)
 {
     $em = $this->getDoctrine()->getManager();
     $homeRel = $this->get('match')->getQMatchRelationByMatch($match->getId(), false);
     if ($homeRel == null) {
         $homeRel = new QMatchRelation();
         $homeRel->setAwayteam(false);
         $match->addMatchRelation($homeRel);
         $em->persist($homeRel);
     }
     $homeRel->setGroup($this->get('entity')->getGroupById($matchForm->getGroupA()));
     $homeRel->setRank($matchForm->getRankA());
     $awayRel = $this->get('match')->getQMatchRelationByMatch($match->getId(), true);
     if ($awayRel == null) {
         $awayRel = new QMatchRelation();
         $awayRel->setAwayteam(true);
         $match->addMatchRelation($awayRel);
         $em->persist($awayRel);
     }
     $awayRel->setGroup($this->get('entity')->getGroupById($matchForm->getGroupB()));
     $awayRel->setRank($matchForm->getRankB());
     $em->flush();
 }
 private function commitImport($parseObj, $date)
 {
     $matchdate = date_create_from_format($this->get('translator')->trans('FORMAT.DATE'), $date);
     $matchtime = date_create_from_format($this->get('translator')->trans('FORMAT.TIME'), $parseObj['time']);
     if ($matchdate === false || $matchtime === false) {
         throw new ValidationException("BADDATE", "date=" . $date . " time=" . $parseObj['time']);
     }
     $matchrec = new Match();
     $matchrec->setMatchno($parseObj['id']);
     $matchrec->setDate(Date::getDate($matchdate));
     $matchrec->setTime(Date::getTime($matchtime));
     $matchrec->setGroup($parseObj['group']);
     $matchrec->setPlayground($parseObj['playground']);
     $resultreqA = new QMatchRelation();
     $resultreqA->setGroup($parseObj['teamAgroup']);
     $resultreqA->setRank($parseObj['teamA']['rank']);
     $resultreqA->setAwayteam(false);
     $matchrec->addMatchRelation($resultreqA);
     $resultreqB = new QMatchRelation();
     $resultreqB->setGroup($parseObj['teamBgroup']);
     $resultreqB->setRank($parseObj['teamB']['rank']);
     $resultreqB->setAwayteam(true);
     $matchrec->addMatchRelation($resultreqB);
     $em = $this->getDoctrine()->getManager();
     $em->persist($matchrec);
     $em->flush();
 }