예제 #1
0
 private function checkForm($form, Group $group)
 {
     if ($form->isValid()) {
         if ($group->getName() == null || trim($group->getName()) == '') {
             $form->addError(new FormError($this->get('translator')->trans('FORM.GROUP.NONAME', array(), 'admin')));
             return false;
         }
         if ($group->getClassification() === null) {
             $form->addError(new FormError($this->get('translator')->trans('FORM.GROUP.NOCLASSIFICATION', array(), 'admin')));
             return false;
         }
         return true;
     }
     return false;
 }
 /**
  * Build the elimination pyramid top-down
  * Groups are expected to be populated in descending classification order:
  *     final, 3/4 final, semifinals, 1/4 finals, ...
  * @param $pyramid The elimination pyramid
  * @param $group The new group to attach to the pyramid
  * @param $matchList Matches for the new group to attach
  */
 private function buildPyramid(&$pyramid, Group $group, $matchList)
 {
     foreach ($matchList as &$match) {
         $match['group'] = $group;
         switch ($group->getClassification()) {
             case Group::$FINAL:
                 $pyramid['F'] = $match;
                 break;
             case Group::$BRONZE:
                 $pyramid['B'] = $match;
                 break;
             default:
                 $this->crawl($pyramid['F'], Group::$SEMIFINAL - $group->getClassification(), $match);
                 break;
         }
     }
 }