Example #1
0
 /**
  * {@inheritDoc}
  */
 protected function build($builder)
 {
     $durations = \Service::getParameter('bzion.league.duration');
     foreach ($durations as $duration => &$value) {
         $durations[$duration] = $duration;
     }
     return $builder->add('first_team', new MatchTeamType())->add('second_team', new MatchTeamType())->add('duration', 'choice', array('choices' => $durations, 'constraints' => new NotBlank(), 'expanded' => true))->add('server_address', 'text', array('required' => false, 'attr' => array('placeholder' => 'brad.guleague.org:5100')))->add('time', new DatetimeWithTimezoneType(), array('constraints' => array(new NotBlank(), new LessThan(array('value' => \TimeDate::now()->addMinutes(10), 'message' => 'The timestamp of the match must not be in the future'))), 'data' => \TimeDate::now(\Controller::getMe()->getTimezone())))->add('enter', 'submit');
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 protected function build($builder)
 {
     $durations = \Service::getParameter('bzion.league.duration');
     foreach ($durations as $duration => &$value) {
         $durations[$duration] = $duration;
     }
     return $builder->add('first_team', new MatchTeamType(), array('disableTeam' => $this->isEdit() && $this->editing->isOfficial()))->add('second_team', new MatchTeamType(), array('disableTeam' => $this->isEdit() && $this->editing->isOfficial()))->add('duration', 'choice', array('choices' => $durations, 'constraints' => new NotBlank(), 'expanded' => true))->add('server_address', 'text', array('required' => false, 'attr' => array('placeholder' => 'brad.guleague.org:5100')))->add('time', new DatetimeWithTimezoneType(), array('constraints' => array(new NotBlank(), new LessThan(array('value' => \TimeDate::now()->addMinutes(10), 'message' => 'The timestamp of the match must not be in the future'))), 'data' => $this->isEdit() ? $this->editing->getTimestamp()->setTimezone(\Controller::getMe()->getTimezone()) : \TimeDate::now(\Controller::getMe()->getTimezone()), 'with_seconds' => $this->isEdit()))->add('map', new ModelType('Map'), array('required' => false))->add('type', 'choice', array('choices' => array(\Match::OFFICIAL => 'Official', \Match::FUN => 'Fun match', \Match::SPECIAL => 'Special event match'), 'disabled' => $this->editing && $this->editing->isOfficial(), 'label' => 'Match Type'))->add('enter', 'submit');
 }