Skip to content

Commit

Permalink
Revert "Fix some Symfony deprecations", since it breaks php 5.4
Browse files Browse the repository at this point in the history
This reverts commit aa7333a.
  • Loading branch information
kongr45gpen committed Jul 14, 2016
1 parent aa7333a commit 2621dc2
Show file tree
Hide file tree
Showing 24 changed files with 454 additions and 603 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"robmorgan/phinx" : "dev-0.4.x-dev",
"select2/select2" : "dev-master",
"sensio/framework-extra-bundle": "~3.0",
"symfony/icu" : "1.0.*",
"symfony/monolog-bundle" : "~2.8",
"symfony/symfony" : "~2.8",
"symfony/swiftmailer-bundle" : ">=2.3.0",
Expand Down Expand Up @@ -57,7 +58,7 @@
"git fetch && latestTag=$(git describe --tags `git rev-list --tags --max-count=1`) && git checkout $latestTag",
"git submodule sync",
"git submodule update --init",
"app/upgrade.sh --ansi --optimize-autoloader install",
"app/upgrade.sh --no-dev --ansi --optimize-autoloader install",
"BZIon\\Composer\\ScriptHandler::buildConfig",
"BZIon\\Composer\\ScriptHandler::migrateDatabase",
"BZIon\\Composer\\ScriptHandler::clearAllCaches",
Expand Down
838 changes: 371 additions & 467 deletions composer.lock

Large diffs are not rendered by default.

19 changes: 7 additions & 12 deletions src/Form/Creator/BanFormCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@

use BZIon\Form\Type\AdvancedModelType;
use BZIon\Form\Type\IpType;
use Ladybug\Plugin\Extra\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;

Expand All @@ -34,35 +29,35 @@ protected function build($builder)
'data' => $this->controller->data->get('player')
))
->add(
$builder->create('automatic_expiration', CheckboxType::class, array(
$builder->create('automatic_expiration', 'checkbox', array(
'data' => true,
'required' => false,
))->setDataLocked(false) // Don't lock the data so we can change
// the default value later if needed
)
->add(
$builder->create('expiration', DateTimeType::class, array(
$builder->create('expiration', 'datetime', array(
'data' => \TimeDate::now(),
))->setDataLocked(false)
)
->add('reason', TextareaType::class, array(
->add('reason', 'textarea', array(
'constraints' => new NotBlank(),
'required' => true
))
->add('server_join_allowed', CheckboxType::class, array(
->add('server_join_allowed', 'checkbox', array(
'data' => true,
'required' => false,
))
->add('server_message', TextType::class, array(
->add('server_message', 'text', array(
'required' => false,
'constraints' => new Length(array(
'max' => 150,
))
))
->add('ip_addresses', IpType::class, array(
->add('ip_addresses', new IpType(), array(
'required' => false,
))
->add('enter', SubmitType::class)
->add('enter', 'submit')
->setDataLocked(false);
}

Expand Down
6 changes: 2 additions & 4 deletions src/Form/Creator/ConfirmationFormCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
*/

namespace BZIon\Form\Creator;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;

/**
* Form creator for confirmation dialogs
Expand Down Expand Up @@ -53,11 +51,11 @@ public function create()
$builder = \Service::getFormFactory()->createNamedBuilder('confirm_form');

return $builder
->add('confirm', SubmitType::class, array(
->add('confirm', 'submit', array(
'label' => $this->action
))
->add(($this->action == 'Yes' || $this->no) ? 'No' : 'Cancel', 'submit')
->add('original_url', HiddenType::class, array(
->add('original_url', 'hidden', array(
'data' => $this->originalUrl
))
->getForm();
Expand Down
9 changes: 3 additions & 6 deletions src/Form/Creator/ConversationFormCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
namespace BZIon\Form\Creator;

use BZIon\Form\Type\AdvancedModelType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Validator\Constraints\Count;
use Symfony\Component\Validator\Constraints\NotBlank;

Expand All @@ -35,9 +32,9 @@ protected function build($builder)
'multiple' => true,
'include' => $this->editing,
))
->add('Subject', TextType::class, $notBlank)
->add('Message', TextareaType::class, $notBlank)
->add('Send', SubmitType::class)
->add('Subject', 'text', $notBlank)
->add('Message', 'textarea', $notBlank)
->add('Send', 'submit')

// Prevents JS from going crazy if we load a page with AJAX
->setAction(\Service::getGenerator()->generate('message_compose'));
Expand Down
3 changes: 1 addition & 2 deletions src/Form/Creator/ConversationInviteFormCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
namespace BZIon\Form\Creator;

use BZIon\Form\Type\AdvancedModelType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Validator\Constraints\NotBlank;

/**
Expand All @@ -26,7 +25,7 @@ protected function build($builder)
'constraints' => new NotBlank(),
'multiple' => true,
))
->add('Invite', SubmitType::class)
->add('Invite', 'submit')
->setAction($this->editing->getUrl());
}

Expand Down
6 changes: 2 additions & 4 deletions src/Form/Creator/ConversationRenameFormCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

namespace BZIon\Form\Creator;

use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;

Expand All @@ -23,13 +21,13 @@ class ConversationRenameFormCreator extends ModelFormCreator
protected function build($builder)
{
return $builder
->add('subject', TextType::class, array(
->add('subject', 'text', array(
'constraints' => array(
new NotBlank(), new Length(array('max' => 50))
),
'data' => $this->editing->getSubject(),
))
->add('Rename', SubmitType::class)
->add('Rename', 'submit')
->setAction($this->editing->getUrl());
}

Expand Down
16 changes: 6 additions & 10 deletions src/Form/Creator/MapFormCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
namespace BZIon\Form\Creator;

use BZIon\Form\Constraint\UniqueAlias;
use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Validator\Constraints\Image;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
Expand All @@ -26,24 +22,24 @@ class MapFormCreator extends ModelFormCreator
*/
protected function build($builder)
{
$builder->add('name', TextType::class, array(
$builder->add('name', 'text', array(
'constraints' => array(
new NotBlank(), new Length(array(
'min' => 2,
'max' => 40,
))
)
))->add('alias', TextType::class, array(
))->add('alias', 'text', array(
'constraints' => array(
new Length(array(
'max' => 40,
)),
new UniqueAlias('Map', $this->editing)
),
'required' => false
))->add('description', TextareaType::class, array(
))->add('description', 'textarea', array(
'required' => false
))->add('avatar', FileType::class, array(
))->add('avatar', 'file', array(
'constraints' => new Image(array(
'minWidth' => 60,
'minHeight' => 60,
Expand All @@ -54,10 +50,10 @@ protected function build($builder)

if ($this->editing && $this->editing->getAvatar() !== null) {
// We are editing the map, not creating it
$builder->add('delete_image', SubmitType::class);
$builder->add('delete_image', 'submit');
}

return $builder->add('submit', SubmitType::class);
return $builder->add('submit', 'submit');
}

/**
Expand Down
15 changes: 6 additions & 9 deletions src/Form/Creator/MatchFormCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
use BZIon\Form\Type\DatetimeWithTimezoneType;
use BZIon\Form\Type\MatchTeamType;
use BZIon\Form\Type\ModelType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Validator\Constraints\LessThan;
use Symfony\Component\Validator\Constraints\NotBlank;
Expand All @@ -33,22 +30,22 @@ protected function build($builder)
}

return $builder
->add('first_team', MatchTeamType::class, array(
->add('first_team', new MatchTeamType(), array(
'disableTeam' => $this->isEdit()
))
->add('second_team', MatchTeamType::class, array(
->add('second_team', new MatchTeamType(), array(
'disableTeam' => $this->isEdit()
))
->add('duration', ChoiceType::class, array(
->add('duration', 'choice', array(
'choices' => $durations,
'constraints' => new NotBlank(),
'expanded' => true
))
->add('server_address', TextType::class, array(
->add('server_address', 'text', array(
'required' => false,
'attr' => array('placeholder' => 'brad.guleague.org:5100'),
))
->add('time', DatetimeWithTimezoneType::class, array(
->add('time', new DatetimeWithTimezoneType(), array(
'constraints' => array(
new NotBlank(),
new LessThan(array(
Expand All @@ -64,7 +61,7 @@ protected function build($builder)
->add('map', new ModelType('Map'), array(
'required' => false
))
->add('enter', SubmitType::class);
->add('enter', 'submit');
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/Form/Creator/MessageFormCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace BZIon\Form\Creator;

use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Validator\Constraints\NotBlank;

/**
Expand All @@ -21,7 +20,7 @@ class MessageFormCreator extends ModelFormCreator
protected function build($builder)
{
return $builder
->add('message', TextareaType::class, array(
->add('message', 'textarea', array(
'constraints' => new NotBlank(
array("message" => "You can't send an empty message!"
))
Expand Down
3 changes: 1 addition & 2 deletions src/Form/Creator/MessageSearchFormCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

namespace BZIon\Form\Creator;
use Symfony\Component\Form\Extension\Core\Type\SearchType;

/**
* Form creator for searching messages
Expand All @@ -19,7 +18,7 @@ class MessageSearchFormCreator extends ModelFormCreator
protected function build($builder)
{
return $builder
->add('q', SearchType::class)
->add('q', 'search')
->setAction(\Service::getGenerator()->generate('message_search'))
->setMethod('GET');
}
Expand Down
7 changes: 3 additions & 4 deletions src/Form/Creator/ModelFormCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace BZIon\Form\Creator;

use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormBuilder;

Expand Down Expand Up @@ -63,7 +62,7 @@ public function create()
{
$builder = \Service::getFormFactory()->createNamedBuilder(
$this->getName(),
FormType::class,
'form',
null,
$this->getFormOptions()
);
Expand Down Expand Up @@ -101,7 +100,7 @@ public function fill($form, $model)
*/
public function update($form, $model)
{
throw new \BadMethodCallException("Please override the update() method in the FormCreator class for the model");
throw new BadMethodCallException("Please override the update() method in the FormCreator class for the model");
}

/**
Expand All @@ -111,7 +110,7 @@ public function update($form, $model)
*/
public function enter($form)
{
throw new \BadMethodCallException("Please override the enter() method in the FormCreator class for the model");
throw new BadMethodCallException("Please override the enter() method in the FormCreator class for the model");
}

/**
Expand Down
12 changes: 4 additions & 8 deletions src/Form/Creator/NewsFormCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
namespace BZIon\Form\Creator;

use BZIon\Form\Type\ModelType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;

Expand All @@ -29,24 +25,24 @@ protected function build($builder)
->add('category', new ModelType('NewsCategory'), array(
'constraints' => new NotBlank()
))
->add('subject', TextType::class, array(
->add('subject', 'text', array(
'constraints' => array(
new NotBlank(), new Length(array(
'max' => 100,
)),
),
))
->add('content', TextareaType::class, array(
->add('content', 'textarea', array(
'constraints' => new NotBlank()
))
->add('status', ChoiceType::class, array(
->add('status', 'choice', array(
'choices' => array(
'published' => 'Public',
'revision' => 'Revision',
'draft' => 'Draft',
),
))
->add('enter', SubmitType::class);
->add('enter', 'submit');
}

/**
Expand Down
Loading

0 comments on commit 2621dc2

Please sign in to comment.