private function makeUpdMatchForm(MatchForm $matchForm, Match $match) { /* @var $qmh QMatchRelation */ $qmh = $this->get('match')->getQMatchRelationByMatch($match->getId(), false); $teamListA = $this->get('orderTeams')->sortGroup($qmh->getGroup()->getId()); $teamnamesA = array(); foreach ($teamListA as $team) { $teamnamesA[$team->id] = $team->name; } $teamA = $teamListA[$qmh->getRank() - 1]; $matchForm->setTeamA($teamA->id); /* @var $qma QMatchRelation */ $qma = $this->get('match')->getQMatchRelationByMatch($match->getId(), true); $teamListB = $this->get('orderTeams')->sortGroup($qma->getGroup()->getId()); $teamnamesB = array(); foreach ($teamListB as $team) { $teamnamesB[$team->id] = $team->name; } $teamB = $teamListB[$qma->getRank() - 1]; $matchForm->setTeamB($teamB->id); $show = true; $extshow = $show && !$this->get('match')->isMatchResultValid($matchForm->getId()); $formDef = $this->createFormBuilder($matchForm); $formDef->add('teamA', 'choice', array('label' => 'FORM.MATCH.HOME', 'choices' => $teamnamesA, 'empty_value' => 'FORM.MATCH.DEFAULT', 'required' => false, 'disabled' => !$extshow, 'translation_domain' => 'admin')); $formDef->add('teamB', 'choice', array('label' => 'FORM.MATCH.AWAY', 'choices' => $teamnamesB, 'empty_value' => 'FORM.MATCH.DEFAULT', 'required' => false, 'disabled' => !$extshow, 'translation_domain' => 'admin')); $formDef->add('cancel', 'submit', array('label' => 'FORM.MATCH.CANCEL.CHG', 'translation_domain' => 'admin', 'buttontype' => 'btn btn-default', 'icon' => 'fa fa-times')); $formDef->add('save', 'submit', array('label' => 'FORM.MATCH.SUBMIT.CHG', 'translation_domain' => 'admin', 'icon' => 'fa fa-check')); return $formDef->getForm(); }