Skip to content

Commit

Permalink
bumped Symfony dependency to 2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
craue committed Aug 19, 2014
1 parent 1b5a46f commit 538f419
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 30 deletions.
6 changes: 0 additions & 6 deletions .travis.yml
Expand Up @@ -15,12 +15,6 @@ matrix:
- php: hhvm
- env: SYMFONY_VERSION="dev-master" MIN_STABILITY="dev"
include:
- php: 5.3
env: SYMFONY_VERSION="2.1.*"
- php: 5.5
env: SYMFONY_VERSION="2.1.*"
- php: 5.5
env: SYMFONY_VERSION="2.2.*"
- php: 5.5
env: SYMFONY_VERSION="2.4.*" SENSIO_FRAMEWORK_EXTRA_BUNDLE_VERSION="3.*"
- php: 5.5
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,7 @@
- BC breaks (follow `UPGRADE-3.0.md` to upgrade):
- [#101]: support for concurrent instances of the same flow
- [#104]: removed options from method `createForm`
- [#145]: bumped Symfony dependency to 2.3
- removed the step field template
- renamed property `step` to `stepNumber` and method `getStep` to `getStepNumber` within event classes
- [#98]+[#143]: add a validation error to the current form if a form of a previous step became invalid
Expand All @@ -28,6 +29,7 @@
[#133]: https://github.com/craue/CraueFormFlowBundle/issues/133
[#134]: https://github.com/craue/CraueFormFlowBundle/issues/134
[#143]: https://github.com/craue/CraueFormFlowBundle/issues/143
[#145]: https://github.com/craue/CraueFormFlowBundle/issues/145

## 2.1.5 (2014-06-13)

Expand Down
8 changes: 1 addition & 7 deletions EventListener/PreviousStepInvalidEventListener.php
Expand Up @@ -4,7 +4,6 @@

use Craue\FormFlowBundle\Event\PreviousStepInvalidEvent;
use Symfony\Component\Form\FormError;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Translation\TranslatorInterface;

/**
Expand Down Expand Up @@ -37,12 +36,7 @@ protected function getPreviousStepInvalidFormError($stepNumber) {
$messageId = 'craueFormFlow.previousStepInvalid';
$messageParameters = array('%stepNumber%' => $stepNumber);

if (version_compare(Kernel::VERSION, '2.2', '>=')) {
return new FormError($this->translator->trans($messageId, $messageParameters, 'validators'));
}

// TODO remove as soon as Symfony >= 2.2 is required
return new FormError($messageId, $messageParameters);
return new FormError($this->translator->trans($messageId, $messageParameters, 'validators'));
}

}
9 changes: 3 additions & 6 deletions Form/FormFlow.php
Expand Up @@ -16,7 +16,6 @@
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Kernel;

/**
* @author Christian Raue <christian.raue@gmail.com>
Expand Down Expand Up @@ -646,7 +645,7 @@ protected function applyDataFromSavedSteps() {

if (array_key_exists($stepNumber, $stepData)) {
$stepForm = $this->createFormForStep($stepNumber, $options);
$stepForm->bind($stepData[$stepNumber]); // the form is validated here
$stepForm->submit($stepData[$stepNumber]); // the form is validated here

if ($this->revalidatePreviousSteps) {
$this->stepForms[$stepNumber] = $stepForm;
Expand Down Expand Up @@ -767,7 +766,7 @@ public function isValid(FormInterface $form) {
self::TRANSITION_BACK,
self::TRANSITION_RESET,
))) {
$form->bind($request);
$form->submit($request);

if ($this->hasListeners(FormFlowEvents::POST_BIND_REQUEST)) {
$event = new PostBindRequestEvent($this, $form->getData(), $this->currentStepNumber);
Expand Down Expand Up @@ -904,9 +903,7 @@ public function hasSkipStep($stepNumber) {
}

protected function triggerDeprecationError($message) {
if (version_compare(Kernel::VERSION, '2.2', '>=')) {
trigger_error($message, E_USER_DEPRECATED);
}
trigger_error($message, E_USER_DEPRECATED);
}

}
2 changes: 0 additions & 2 deletions README.md
Expand Up @@ -16,8 +16,6 @@ A live demo showcasing these features is available at http://craue.de/sf2playgro

# Installation

Please use tag 1.0.0 of this bundle if you need Symfony 2.0.x compatibility.

## Get the bundle

Let Composer download and install the bundle by running
Expand Down
Expand Up @@ -2,7 +2,8 @@

namespace Craue\FormFlowBundle\Tests\IntegrationTestBundle\Entity;

use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\ExecutionContextInterface;

/**
* @author Christian Raue <christian.raue@gmail.com>
Expand All @@ -19,8 +20,7 @@ public static function resetValidationCalls() {
self::$validationCalls = 0;
}

// TODO add Symfony\Component\Validator\ExecutionContextInterface type hint as soon as Symfony >= 2.2 is required
public function isDataValid($context) {
public function isDataValid(ExecutionContextInterface $context) {
// valid only on first call
if (++self::$validationCalls > 1) {
$context->addViolation('Take this!');
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Expand Up @@ -17,16 +17,16 @@
],
"require": {
"php": ">=5.3.2",
"symfony/form": "~2.1",
"symfony/http-kernel": "~2.1",
"symfony/translation": "~2.1",
"symfony/yaml": "~2.1"
"symfony/form": "~2.3",
"symfony/http-kernel": "~2.3",
"symfony/translation": "~2.3",
"symfony/yaml": "~2.3"
},
"require-dev": {
"doctrine/common": "~2.3",
"phpunit/phpunit": "~4.1",
"sensio/framework-extra-bundle": ">=2.1",
"symfony/symfony": "~2.1"
"sensio/framework-extra-bundle": ">=2.3",
"symfony/symfony": "~2.3"
},
"minimum-stability": "stable",
"prefer-stable": true,
Expand Down

0 comments on commit 538f419

Please sign in to comment.