private function checkForm($form, ResultForm $resultForm)
 {
     if (!$form->isValid()) {
         return false;
     }
     /*
      * Check for blank fields
      */
     if ($resultForm->getMatchno() == null || trim($resultForm->getMatchno()) == '') {
         $form->addError(new FormError($this->get('translator')->trans('FORM.CHANGEMATCH.NONO', array(), 'admin')));
         return false;
     }
     /*
      * Check for valid contents
      */
     /* @var $match Match */
     $match = $this->get('match')->getMatchByNo($resultForm->getTournament(), $resultForm->getMatchno());
     if ($match == null) {
         $form->addError(new FormError($this->get('translator')->trans('FORM.CHANGEMATCH.INVALIDMATCHNO', array(), 'admin')));
     } else {
         if ($this->get('match')->isMatchResultValid($match->getId())) {
             $form->addError(new FormError($this->get('translator')->trans('FORM.CHANGEMATCH.CANTCHANGE', array(), 'admin')));
         }
     }
     return $form->isValid();
 }
 private function checkForm($form, ResultForm $resultForm)
 {
     if (!$form->isValid()) {
         return false;
     }
     /*
      * Check for blank fields
      */
     if ($resultForm->getMatchno() == null || trim($resultForm->getMatchno()) == '') {
         $form->addError(new FormError($this->get('translator')->trans('FORM.RESULTREPORT.NONO', array(), 'tournament')));
     }
     if ($resultForm->getEvent() == ResultForm::$EVENT_MATCH_PLAYED) {
         if ($resultForm->getScoreA() == null || trim($resultForm->getScoreA()) == '') {
             $form->addError(new FormError($this->get('translator')->trans('FORM.RESULTREPORT.NOHOMESCORE', array(), 'tournament')));
         }
         if ($resultForm->getScoreB() == null || trim($resultForm->getScoreB()) == '') {
             $form->addError(new FormError($this->get('translator')->trans('FORM.RESULTREPORT.NOAWAYSCORE', array(), 'tournament')));
         }
     }
     if (!$form->isValid()) {
         return false;
     }
     /*
      * Check for valid contents
      */
     if ($resultForm->getEvent() == ResultForm::$EVENT_MATCH_PLAYED) {
         if ($resultForm->getScoreA() > 100 || $resultForm->getScoreA() < 0) {
             $form->addError(new FormError($this->get('translator')->trans('FORM.RESULTREPORT.INVALIDHOMESCORE', array(), 'tournament')));
         }
         if ($resultForm->getScoreB() > 100 || $resultForm->getScoreB() < 0) {
             $form->addError(new FormError($this->get('translator')->trans('FORM.RESULTREPORT.INVALIDAWAYSCORE', array(), 'tournament')));
         }
     }
     /* @var $match Match */
     $match = $this->get('match')->getMatchByNo($resultForm->getTournament(), $resultForm->getMatchno());
     if ($match == null) {
         $form->addError(new FormError($this->get('translator')->trans('FORM.RESULTREPORT.INVALIDMATCHNO', array(), 'tournament')));
     } else {
         if (!$this->isMatchValid($match)) {
             $form->addError(new FormError($this->get('translator')->trans('FORM.RESULTREPORT.MATCHNOTREADY', array(), 'tournament')));
         } else {
             if ($this->get('match')->isMatchResultValid($match->getId())) {
                 $form->addError(new FormError($this->get('translator')->trans('FORM.RESULTREPORT.CANTCHANGE', array(), 'tournament')));
             } else {
                 $today = new DateTime();
                 $matchdate = Date::getDateTime($match->getDate(), $match->getTime());
                 if ($matchdate > $today) {
                     $form->addError(new FormError($this->get('translator')->trans('FORM.RESULTREPORT.TOOEARLY', array(), 'tournament')));
                 }
             }
         }
     }
     return $form->isValid();
 }