diff --git a/.gitignore b/.gitignore index af41f6cf..bb1fd8c0 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ /composer-install.bat /composer-update.bat /composer.lock -.DS_Store /git.bat /phpunit-tests-run-with-coverage.bat /phpunit-tests-run.bat @@ -14,3 +13,4 @@ /vendors-install.bat /vendors-update.bat /vendors-whatsnew.bat +.DS_Store diff --git a/CraueFormFlowBundle.php b/CraueFormFlowBundle.php index 6ea820b5..f771a296 100644 --- a/CraueFormFlowBundle.php +++ b/CraueFormFlowBundle.php @@ -2,7 +2,9 @@ namespace Craue\FormFlowBundle; -use Craue\FormFlowBundle\Util\TempFileUtil; +use Craue\FormFlowBundle\DependencyInjection\Compiler\LoadTranslationsCompilerPass; +use Craue\FormFlowBundle\FormFlow\Util\TempFileUtil; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; /** @@ -25,4 +27,12 @@ public function boot() { }); } + /** + * {@inheritDoc} + */ + public function build(ContainerBuilder $container) { + parent::build($container); + $container->addCompilerPass(new LoadTranslationsCompilerPass()); + } + } diff --git a/DependencyInjection/Compiler/LoadTranslationsCompilerPass.php b/DependencyInjection/Compiler/LoadTranslationsCompilerPass.php new file mode 100644 index 00000000..48c53026 --- /dev/null +++ b/DependencyInjection/Compiler/LoadTranslationsCompilerPass.php @@ -0,0 +1,45 @@ + + * @copyright 2011-2015 Christian Raue + * @license http://opensource.org/licenses/mit-license.php MIT License + */ +class LoadTranslationsCompilerPass implements CompilerPassInterface { + + /** + * {@inheritDoc} + */ + public function process(ContainerBuilder $container) { + $dir = __DIR__ . '/../../FormFlow/Resources/translations'; + + // taken roughly from https://github.com/symfony/symfony/blob/ce15db564736d7a0cf02a0db688a0ee101959cb5/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php#L650 + $container->addResource(new DirectoryResource($dir)); + + $finder = Finder::create() + ->files() + ->in($dir) + ->filter(function (\SplFileInfo $file) { + $basename = $file->getBasename(); + return substr_count($basename, '.') === 2 && preg_match('/\.\w+$/', $basename); + }) + ; + + $translator = $container->findDefinition('translator'); + + foreach ($finder as $file) { + list($domain, $locale, $format) = explode('.', $file->getBasename(), 3); + $translator->addMethodCall('addResource', array($format, (string) $file, $locale, $domain)); + } + } + +} diff --git a/FormFlow/.gitignore b/FormFlow/.gitignore new file mode 100644 index 00000000..3f9236b3 --- /dev/null +++ b/FormFlow/.gitignore @@ -0,0 +1,6 @@ +/.buildpath +/.project +/.settings +/git-subtree-split.bat +/git.bat +.DS_Store diff --git a/Event/FormFlowEvent.php b/FormFlow/Event/FormFlowEvent.php similarity index 84% rename from Event/FormFlowEvent.php rename to FormFlow/Event/FormFlowEvent.php index 669a6ba0..bbc0ab5c 100644 --- a/Event/FormFlowEvent.php +++ b/FormFlow/Event/FormFlowEvent.php @@ -1,8 +1,8 @@ diff --git a/Form/Extension/FormFlowFormExtension.php b/FormFlow/Extension/FormFlowFormExtension.php similarity index 97% rename from Form/Extension/FormFlowFormExtension.php rename to FormFlow/Extension/FormFlowFormExtension.php index e7f99188..28e5c6fe 100644 --- a/Form/Extension/FormFlowFormExtension.php +++ b/FormFlow/Extension/FormFlowFormExtension.php @@ -1,6 +1,6 @@ diff --git a/Form/FormFlowInterface.php b/FormFlow/FormFlowInterface.php similarity index 95% rename from Form/FormFlowInterface.php rename to FormFlow/FormFlowInterface.php index 17b8c61e..5404a3c9 100644 --- a/Form/FormFlowInterface.php +++ b/FormFlow/FormFlowInterface.php @@ -1,9 +1,9 @@ +Licensed under the MIT License: http://opensource.org/licenses/mit-license.php diff --git a/FormFlow/README.md b/FormFlow/README.md new file mode 100644 index 00000000..1a036e09 --- /dev/null +++ b/FormFlow/README.md @@ -0,0 +1 @@ +For further information refer to https://github.com/craue/CraueFormFlowBundle. diff --git a/Resources/translations/CraueFormFlowBundle.cs.yml b/FormFlow/Resources/translations/CraueFormFlowBundle.cs.yml similarity index 100% rename from Resources/translations/CraueFormFlowBundle.cs.yml rename to FormFlow/Resources/translations/CraueFormFlowBundle.cs.yml diff --git a/Resources/translations/CraueFormFlowBundle.de.yml b/FormFlow/Resources/translations/CraueFormFlowBundle.de.yml similarity index 100% rename from Resources/translations/CraueFormFlowBundle.de.yml rename to FormFlow/Resources/translations/CraueFormFlowBundle.de.yml diff --git a/Resources/translations/CraueFormFlowBundle.en.yml b/FormFlow/Resources/translations/CraueFormFlowBundle.en.yml similarity index 100% rename from Resources/translations/CraueFormFlowBundle.en.yml rename to FormFlow/Resources/translations/CraueFormFlowBundle.en.yml diff --git a/Resources/translations/CraueFormFlowBundle.es.yml b/FormFlow/Resources/translations/CraueFormFlowBundle.es.yml similarity index 100% rename from Resources/translations/CraueFormFlowBundle.es.yml rename to FormFlow/Resources/translations/CraueFormFlowBundle.es.yml diff --git a/Resources/translations/CraueFormFlowBundle.fa.yml b/FormFlow/Resources/translations/CraueFormFlowBundle.fa.yml similarity index 100% rename from Resources/translations/CraueFormFlowBundle.fa.yml rename to FormFlow/Resources/translations/CraueFormFlowBundle.fa.yml diff --git a/Resources/translations/CraueFormFlowBundle.fr.yml b/FormFlow/Resources/translations/CraueFormFlowBundle.fr.yml similarity index 100% rename from Resources/translations/CraueFormFlowBundle.fr.yml rename to FormFlow/Resources/translations/CraueFormFlowBundle.fr.yml diff --git a/Resources/translations/CraueFormFlowBundle.nl.yml b/FormFlow/Resources/translations/CraueFormFlowBundle.nl.yml similarity index 100% rename from Resources/translations/CraueFormFlowBundle.nl.yml rename to FormFlow/Resources/translations/CraueFormFlowBundle.nl.yml diff --git a/Resources/translations/CraueFormFlowBundle.pl.yml b/FormFlow/Resources/translations/CraueFormFlowBundle.pl.yml similarity index 100% rename from Resources/translations/CraueFormFlowBundle.pl.yml rename to FormFlow/Resources/translations/CraueFormFlowBundle.pl.yml diff --git a/Resources/translations/CraueFormFlowBundle.pt_BR.yml b/FormFlow/Resources/translations/CraueFormFlowBundle.pt_BR.yml similarity index 100% rename from Resources/translations/CraueFormFlowBundle.pt_BR.yml rename to FormFlow/Resources/translations/CraueFormFlowBundle.pt_BR.yml diff --git a/Resources/translations/CraueFormFlowBundle.ru.yml b/FormFlow/Resources/translations/CraueFormFlowBundle.ru.yml similarity index 100% rename from Resources/translations/CraueFormFlowBundle.ru.yml rename to FormFlow/Resources/translations/CraueFormFlowBundle.ru.yml diff --git a/Resources/translations/CraueFormFlowBundle.uk.yml b/FormFlow/Resources/translations/CraueFormFlowBundle.uk.yml similarity index 100% rename from Resources/translations/CraueFormFlowBundle.uk.yml rename to FormFlow/Resources/translations/CraueFormFlowBundle.uk.yml diff --git a/Resources/translations/CraueFormFlowBundle.zh.yml b/FormFlow/Resources/translations/CraueFormFlowBundle.zh.yml similarity index 100% rename from Resources/translations/CraueFormFlowBundle.zh.yml rename to FormFlow/Resources/translations/CraueFormFlowBundle.zh.yml diff --git a/Resources/translations/validators.cs.yml b/FormFlow/Resources/translations/validators.cs.yml similarity index 100% rename from Resources/translations/validators.cs.yml rename to FormFlow/Resources/translations/validators.cs.yml diff --git a/Resources/translations/validators.de.yml b/FormFlow/Resources/translations/validators.de.yml similarity index 100% rename from Resources/translations/validators.de.yml rename to FormFlow/Resources/translations/validators.de.yml diff --git a/Resources/translations/validators.en.yml b/FormFlow/Resources/translations/validators.en.yml similarity index 100% rename from Resources/translations/validators.en.yml rename to FormFlow/Resources/translations/validators.en.yml diff --git a/Resources/translations/validators.es.yml b/FormFlow/Resources/translations/validators.es.yml similarity index 100% rename from Resources/translations/validators.es.yml rename to FormFlow/Resources/translations/validators.es.yml diff --git a/Resources/translations/validators.fa.yml b/FormFlow/Resources/translations/validators.fa.yml similarity index 100% rename from Resources/translations/validators.fa.yml rename to FormFlow/Resources/translations/validators.fa.yml diff --git a/Resources/translations/validators.fr.yml b/FormFlow/Resources/translations/validators.fr.yml similarity index 100% rename from Resources/translations/validators.fr.yml rename to FormFlow/Resources/translations/validators.fr.yml diff --git a/Resources/translations/validators.nl.yml b/FormFlow/Resources/translations/validators.nl.yml similarity index 100% rename from Resources/translations/validators.nl.yml rename to FormFlow/Resources/translations/validators.nl.yml diff --git a/Resources/translations/validators.pl.yml b/FormFlow/Resources/translations/validators.pl.yml similarity index 100% rename from Resources/translations/validators.pl.yml rename to FormFlow/Resources/translations/validators.pl.yml diff --git a/Resources/translations/validators.pt_BR.yml b/FormFlow/Resources/translations/validators.pt_BR.yml similarity index 100% rename from Resources/translations/validators.pt_BR.yml rename to FormFlow/Resources/translations/validators.pt_BR.yml diff --git a/Resources/translations/validators.ru.yml b/FormFlow/Resources/translations/validators.ru.yml similarity index 100% rename from Resources/translations/validators.ru.yml rename to FormFlow/Resources/translations/validators.ru.yml diff --git a/Resources/translations/validators.uk.yml b/FormFlow/Resources/translations/validators.uk.yml similarity index 100% rename from Resources/translations/validators.uk.yml rename to FormFlow/Resources/translations/validators.uk.yml diff --git a/Resources/translations/validators.zh.yml b/FormFlow/Resources/translations/validators.zh.yml similarity index 100% rename from Resources/translations/validators.zh.yml rename to FormFlow/Resources/translations/validators.zh.yml diff --git a/Form/Step.php b/FormFlow/Step.php similarity index 97% rename from Form/Step.php rename to FormFlow/Step.php index 07541fa1..d24d6292 100644 --- a/Form/Step.php +++ b/FormFlow/Step.php @@ -1,8 +1,8 @@ diff --git a/Storage/ExtendedDataManagerInterface.php b/FormFlow/Storage/ExtendedDataManagerInterface.php similarity index 94% rename from Storage/ExtendedDataManagerInterface.php rename to FormFlow/Storage/ExtendedDataManagerInterface.php index bf898e61..e271f02b 100644 --- a/Storage/ExtendedDataManagerInterface.php +++ b/FormFlow/Storage/ExtendedDataManagerInterface.php @@ -1,6 +1,6 @@ diff --git a/Util/StringUtil.php b/FormFlow/Util/StringUtil.php similarity index 92% rename from Util/StringUtil.php rename to FormFlow/Util/StringUtil.php index 576f5e31..f9517683 100644 --- a/Util/StringUtil.php +++ b/FormFlow/Util/StringUtil.php @@ -1,8 +1,8 @@ diff --git a/Util/TempFileUtil.php b/FormFlow/Util/TempFileUtil.php similarity index 94% rename from Util/TempFileUtil.php rename to FormFlow/Util/TempFileUtil.php index 0940e9db..4b5903cb 100644 --- a/Util/TempFileUtil.php +++ b/FormFlow/Util/TempFileUtil.php @@ -1,6 +1,6 @@ =5.3.2", + "symfony/form": "~2.3", + "symfony/http-kernel": "~2.3", + "symfony/translation": "~2.3", + "symfony/yaml": "~2.3" + }, + "minimum-stability": "stable", + "prefer-stable": true, + "autoload": { + "psr-4": { + "Craue\\FormFlowBundle\\FormFlow\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + } +} diff --git a/README.md b/README.md index 44a4269b..c7aa644b 100644 --- a/README.md +++ b/README.md @@ -54,8 +54,8 @@ This approach makes it easy to turn an existing (usual) form into a form flow. ```php // src/MyCompany/MyBundle/Form/CreateVehicleFlow.php -use Craue\FormFlowBundle\Form\FormFlow; -use Craue\FormFlowBundle\Form\FormFlowInterface; +use Craue\FormFlowBundle\FormFlow\FormFlow; +use Craue\FormFlowBundle\FormFlow\FormFlowInterface; use Symfony\Component\Form\FormTypeInterface; class CreateVehicleFlow extends FormFlow { @@ -176,8 +176,8 @@ This approach makes it easy to reuse the form types to compose other forms. ```php // src/MyCompany/MyBundle/Form/CreateVehicleFlow.php -use Craue\FormFlowBundle\Form\FormFlow; -use Craue\FormFlowBundle\Form\FormFlowInterface; +use Craue\FormFlowBundle\FormFlow\FormFlow; +use Craue\FormFlowBundle\FormFlow\FormFlowInterface; class CreateVehicleFlow extends FormFlow { @@ -625,13 +625,13 @@ There are some events which you can subscribe to. Using all of them right inside ```php // in src/MyCompany/MyBundle/Form/CreateVehicleFlow.php -use Craue\FormFlowBundle\Event\GetStepsEvent; -use Craue\FormFlowBundle\Event\PostBindFlowEvent; -use Craue\FormFlowBundle\Event\PostBindRequestEvent; -use Craue\FormFlowBundle\Event\PostBindSavedDataEvent; -use Craue\FormFlowBundle\Event\PostValidateEvent; -use Craue\FormFlowBundle\Event\PreBindEvent; -use Craue\FormFlowBundle\Form\FormFlowEvents; +use Craue\FormFlowBundle\FormFlow\Event\GetStepsEvent; +use Craue\FormFlowBundle\FormFlow\Event\PostBindFlowEvent; +use Craue\FormFlowBundle\FormFlow\Event\PostBindRequestEvent; +use Craue\FormFlowBundle\FormFlow\Event\PostBindSavedDataEvent; +use Craue\FormFlowBundle\FormFlow\Event\PostValidateEvent; +use Craue\FormFlowBundle\FormFlow\Event\PreBindEvent; +use Craue\FormFlowBundle\FormFlow\FormFlowEvents; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; diff --git a/Resources/config/form_flow.xml b/Resources/config/form_flow.xml index 3943b045..895b2f6a 100644 --- a/Resources/config/form_flow.xml +++ b/Resources/config/form_flow.xml @@ -10,10 +10,10 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - Craue\FormFlowBundle\Form\FormFlow - Craue\FormFlowBundle\Storage\SessionStorage - Craue\FormFlowBundle\EventListener\PreviousStepInvalidEventListener - Craue\FormFlowBundle\Form\FormFlowEvents::PREVIOUS_STEP_INVALID + Craue\FormFlowBundle\FormFlow\FormFlow + Craue\FormFlowBundle\FormFlow\Storage\SessionStorage + Craue\FormFlowBundle\FormFlow\EventListener\PreviousStepInvalidEventListener + Craue\FormFlowBundle\FormFlow\FormFlowEvents::PREVIOUS_STEP_INVALID @@ -23,7 +23,7 @@ - + @@ -44,11 +44,11 @@ - + - + diff --git a/Tests/Event/PostBindFlowEventTest.php b/Tests/FormFlow/Event/PostBindFlowEventTest.php similarity index 81% rename from Tests/Event/PostBindFlowEventTest.php rename to Tests/FormFlow/Event/PostBindFlowEventTest.php index 2ee078ae..89af42c4 100644 --- a/Tests/Event/PostBindFlowEventTest.php +++ b/Tests/FormFlow/Event/PostBindFlowEventTest.php @@ -1,8 +1,8 @@ diff --git a/Tests/Form/Extension/FormFlowFormExtensionTest.php b/Tests/FormFlow/Extension/FormFlowFormExtensionTest.php similarity index 77% rename from Tests/Form/Extension/FormFlowFormExtensionTest.php rename to Tests/FormFlow/Extension/FormFlowFormExtensionTest.php index d1ef25be..e71d5d40 100644 --- a/Tests/Form/Extension/FormFlowFormExtensionTest.php +++ b/Tests/FormFlow/Extension/FormFlowFormExtensionTest.php @@ -1,8 +1,8 @@ getFlowWithMockedMethods(array('getName', 'getCurrentStepNumber')); diff --git a/Tests/Form/FormFlowTest.php b/Tests/FormFlow/FormFlowTest.php similarity index 98% rename from Tests/Form/FormFlowTest.php rename to Tests/FormFlow/FormFlowTest.php index 2ee60555..c7e0a605 100644 --- a/Tests/Form/FormFlowTest.php +++ b/Tests/FormFlow/FormFlowTest.php @@ -1,9 +1,9 @@ getMockedFlow()->getStep($stepNumber); diff --git a/Tests/Form/StepBcTest.php b/Tests/FormFlow/StepBcTest.php similarity index 88% rename from Tests/Form/StepBcTest.php rename to Tests/FormFlow/StepBcTest.php index 0f262e13..37595d74 100644 --- a/Tests/Form/StepBcTest.php +++ b/Tests/FormFlow/StepBcTest.php @@ -1,8 +1,8 @@ diff --git a/Tests/IntegrationTestBundle/Form/Demo1Flow.php b/Tests/IntegrationTestBundle/Form/Demo1Flow.php index c9c2627c..1a8b90a7 100644 --- a/Tests/IntegrationTestBundle/Form/Demo1Flow.php +++ b/Tests/IntegrationTestBundle/Form/Demo1Flow.php @@ -2,14 +2,14 @@ namespace Craue\FormFlowBundle\Tests\IntegrationTestBundle\Form; -use Craue\FormFlowBundle\Event\GetStepsEvent; -use Craue\FormFlowBundle\Event\PostBindFlowEvent; -use Craue\FormFlowBundle\Event\PostBindRequestEvent; -use Craue\FormFlowBundle\Event\PostBindSavedDataEvent; -use Craue\FormFlowBundle\Event\PostValidateEvent; -use Craue\FormFlowBundle\Event\PreBindEvent; -use Craue\FormFlowBundle\Form\FormFlow; -use Craue\FormFlowBundle\Form\FormFlowEvents; +use Craue\FormFlowBundle\FormFlow\Event\GetStepsEvent; +use Craue\FormFlowBundle\FormFlow\Event\PostBindFlowEvent; +use Craue\FormFlowBundle\FormFlow\Event\PostBindRequestEvent; +use Craue\FormFlowBundle\FormFlow\Event\PostBindSavedDataEvent; +use Craue\FormFlowBundle\FormFlow\Event\PostValidateEvent; +use Craue\FormFlowBundle\FormFlow\Event\PreBindEvent; +use Craue\FormFlowBundle\FormFlow\FormFlow; +use Craue\FormFlowBundle\FormFlow\FormFlowEvents; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; diff --git a/Tests/IntegrationTestBundle/Form/Issue149Flow.php b/Tests/IntegrationTestBundle/Form/Issue149Flow.php index f7911c25..8407dd49 100644 --- a/Tests/IntegrationTestBundle/Form/Issue149Flow.php +++ b/Tests/IntegrationTestBundle/Form/Issue149Flow.php @@ -2,7 +2,7 @@ namespace Craue\FormFlowBundle\Tests\IntegrationTestBundle\Form; -use Craue\FormFlowBundle\Form\FormFlow; +use Craue\FormFlowBundle\FormFlow\FormFlow; /** * @author Christian Raue diff --git a/Tests/IntegrationTestBundle/Form/Issue64Flow.php b/Tests/IntegrationTestBundle/Form/Issue64Flow.php index 5744773b..a33821fe 100644 --- a/Tests/IntegrationTestBundle/Form/Issue64Flow.php +++ b/Tests/IntegrationTestBundle/Form/Issue64Flow.php @@ -2,7 +2,7 @@ namespace Craue\FormFlowBundle\Tests\IntegrationTestBundle\Form; -use Craue\FormFlowBundle\Form\FormFlow; +use Craue\FormFlowBundle\FormFlow\FormFlow; /** * @author Christian Raue diff --git a/Tests/IntegrationTestBundle/Form/Issue87Flow.php b/Tests/IntegrationTestBundle/Form/Issue87Flow.php index 605f6318..29f4b799 100644 --- a/Tests/IntegrationTestBundle/Form/Issue87Flow.php +++ b/Tests/IntegrationTestBundle/Form/Issue87Flow.php @@ -2,7 +2,7 @@ namespace Craue\FormFlowBundle\Tests\IntegrationTestBundle\Form; -use Craue\FormFlowBundle\Form\FormFlow; +use Craue\FormFlowBundle\FormFlow\FormFlow; /** * @author Christian Raue diff --git a/Tests/IntegrationTestBundle/Form/OnlyOneStepFlow.php b/Tests/IntegrationTestBundle/Form/OnlyOneStepFlow.php index 334921c0..4999718d 100644 --- a/Tests/IntegrationTestBundle/Form/OnlyOneStepFlow.php +++ b/Tests/IntegrationTestBundle/Form/OnlyOneStepFlow.php @@ -2,7 +2,7 @@ namespace Craue\FormFlowBundle\Tests\IntegrationTestBundle\Form; -use Craue\FormFlowBundle\Form\FormFlow; +use Craue\FormFlowBundle\FormFlow\FormFlow; /** * @author Christian Raue diff --git a/Tests/IntegrationTestBundle/Form/PhotoUploadFlow.php b/Tests/IntegrationTestBundle/Form/PhotoUploadFlow.php index 2ad7b925..4cc17598 100644 --- a/Tests/IntegrationTestBundle/Form/PhotoUploadFlow.php +++ b/Tests/IntegrationTestBundle/Form/PhotoUploadFlow.php @@ -2,7 +2,7 @@ namespace Craue\FormFlowBundle\Tests\IntegrationTestBundle\Form; -use Craue\FormFlowBundle\Form\FormFlow; +use Craue\FormFlowBundle\FormFlow\FormFlow; /** * @author Christian Raue diff --git a/Tests/IntegrationTestBundle/Form/RemoveSecondStepSkipMarkOnResetFlow.php b/Tests/IntegrationTestBundle/Form/RemoveSecondStepSkipMarkOnResetFlow.php index 3609624e..f3a66d83 100644 --- a/Tests/IntegrationTestBundle/Form/RemoveSecondStepSkipMarkOnResetFlow.php +++ b/Tests/IntegrationTestBundle/Form/RemoveSecondStepSkipMarkOnResetFlow.php @@ -2,8 +2,8 @@ namespace Craue\FormFlowBundle\Tests\IntegrationTestBundle\Form; -use Craue\FormFlowBundle\Form\FormFlow; -use Craue\FormFlowBundle\Form\FormFlowInterface; +use Craue\FormFlowBundle\FormFlow\FormFlow; +use Craue\FormFlowBundle\FormFlow\FormFlowInterface; /** * @author Christian Raue diff --git a/Tests/IntegrationTestBundle/Form/RevalidatePreviousStepsFlow.php b/Tests/IntegrationTestBundle/Form/RevalidatePreviousStepsFlow.php index 06ea40cf..f9b86c18 100644 --- a/Tests/IntegrationTestBundle/Form/RevalidatePreviousStepsFlow.php +++ b/Tests/IntegrationTestBundle/Form/RevalidatePreviousStepsFlow.php @@ -2,9 +2,9 @@ namespace Craue\FormFlowBundle\Tests\IntegrationTestBundle\Form; -use Craue\FormFlowBundle\Event\PreviousStepInvalidEvent; -use Craue\FormFlowBundle\Form\FormFlow; -use Craue\FormFlowBundle\Form\FormFlowEvents; +use Craue\FormFlowBundle\FormFlow\Event\PreviousStepInvalidEvent; +use Craue\FormFlowBundle\FormFlow\FormFlow; +use Craue\FormFlowBundle\FormFlow\FormFlowEvents; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; diff --git a/Tests/IntegrationTestBundle/Form/SkipFirstStepUsingClosureFlow.php b/Tests/IntegrationTestBundle/Form/SkipFirstStepUsingClosureFlow.php index 9f187efb..913a6d47 100644 --- a/Tests/IntegrationTestBundle/Form/SkipFirstStepUsingClosureFlow.php +++ b/Tests/IntegrationTestBundle/Form/SkipFirstStepUsingClosureFlow.php @@ -2,8 +2,8 @@ namespace Craue\FormFlowBundle\Tests\IntegrationTestBundle\Form; -use Craue\FormFlowBundle\Form\FormFlow; -use Craue\FormFlowBundle\Form\FormFlowInterface; +use Craue\FormFlowBundle\FormFlow\FormFlow; +use Craue\FormFlowBundle\FormFlow\FormFlowInterface; /** * @author Christian Raue diff --git a/Tests/Resources/TemplateRenderingTest.php b/Tests/Resources/TemplateRenderingTest.php index 5e517bb3..7ed3e2ea 100644 --- a/Tests/Resources/TemplateRenderingTest.php +++ b/Tests/Resources/TemplateRenderingTest.php @@ -2,9 +2,9 @@ namespace Craue\FormFlowBundle\Tests\Form; -use Craue\FormFlowBundle\Form\FormFlow; -use Craue\FormFlowBundle\Storage\DataManager; -use Craue\FormFlowBundle\Storage\SessionStorage; +use Craue\FormFlowBundle\FormFlow\FormFlow; +use Craue\FormFlowBundle\FormFlow\Storage\DataManager; +use Craue\FormFlowBundle\FormFlow\Storage\SessionStorage; use Craue\FormFlowBundle\Tests\IntegrationTestCase; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; @@ -274,7 +274,7 @@ public function testStepList_stepSkipped() { */ protected function getFlowStub(array $stubbedMethods = array(), array $stepsConfig = null) { /* @var $flow \PHPUnit_Framework_MockObject_MockObject|FormFlow */ - $flow = $this->getMock('\Craue\FormFlowBundle\Form\FormFlow', array_merge(array('getName', 'loadStepsConfig'), $stubbedMethods)); + $flow = $this->getMock('\Craue\FormFlowBundle\FormFlow\FormFlow', array_merge(array('getName', 'loadStepsConfig'), $stubbedMethods)); $flow->setDataManager(new DataManager(new SessionStorage(new Session(new MockArraySessionStorage())))); diff --git a/Tests/UnitTestCase.php b/Tests/UnitTestCase.php index 56849ca3..25197e61 100644 --- a/Tests/UnitTestCase.php +++ b/Tests/UnitTestCase.php @@ -2,10 +2,10 @@ namespace Craue\FormFlowBundle\Tests; -use Craue\FormFlowBundle\Form\FormFlow; -use Craue\FormFlowBundle\Form\FormFlowInterface; -use Craue\FormFlowBundle\Form\StepInterface; -use Craue\FormFlowBundle\Storage\DataManagerInterface; +use Craue\FormFlowBundle\FormFlow\FormFlow; +use Craue\FormFlowBundle\FormFlow\FormFlowInterface; +use Craue\FormFlowBundle\FormFlow\StepInterface; +use Craue\FormFlowBundle\FormFlow\Storage\DataManagerInterface; /** * @author Christian Raue @@ -56,14 +56,14 @@ protected function getDeprecationNotices() { * @return \PHPUnit_Framework_MockObject_MockObject|FormFlow */ protected function getMockedFlow() { - return $this->getMockForAbstractClass('\Craue\FormFlowBundle\Form\FormFlow'); + return $this->getMockForAbstractClass('\Craue\FormFlowBundle\FormFlow\FormFlow'); } /** * @return \PHPUnit_Framework_MockObject_MockObject|FormFlowInterface */ protected function getMockedFlowInterface() { - return $this->getMock('\Craue\FormFlowBundle\Form\FormFlowInterface'); + return $this->getMock('\Craue\FormFlowBundle\FormFlow\FormFlowInterface'); } /** @@ -71,21 +71,21 @@ protected function getMockedFlowInterface() { * @return PHPUnit_Framework_MockObject_MockObject|FormFlow */ protected function getFlowWithMockedMethods(array $methodNames) { - return $this->getMock('\Craue\FormFlowBundle\Form\FormFlow', $methodNames); + return $this->getMock('\Craue\FormFlowBundle\FormFlow\FormFlow', $methodNames); } /** * @return \PHPUnit_Framework_MockObject_MockObject|StepInterface */ protected function getMockedStepInterface() { - return $this->getMock('\Craue\FormFlowBundle\Form\StepInterface'); + return $this->getMock('\Craue\FormFlowBundle\FormFlow\StepInterface'); } /** * @return \PHPUnit_Framework_MockObject_MockObject|DataManagerInterface */ protected function getMockedDataManagerInterface() { - return $this->getMock('\Craue\FormFlowBundle\Storage\DataManagerInterface'); + return $this->getMock('\Craue\FormFlowBundle\FormFlow\Storage\DataManagerInterface'); } } diff --git a/Twig/Extension/FormFlowExtension.php b/Twig/Extension/FormFlowExtension.php index 5f246c19..82e32b77 100644 --- a/Twig/Extension/FormFlowExtension.php +++ b/Twig/Extension/FormFlowExtension.php @@ -2,7 +2,7 @@ namespace Craue\FormFlowBundle\Twig\Extension; -use Craue\FormFlowBundle\Form\FormFlow; +use Craue\FormFlowBundle\FormFlow\FormFlow; use Craue\FormFlowBundle\Util\FormFlowUtil; /** diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 4f46e476..91221ccc 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -1,5 +1,15 @@ # Upgrade from 2.1.x to 3.0 +## Namespace changes + +In order to make the core features also available as a standalone library, most files had to be moved into a subfolder. +Thus, the namespace for those files has changed. Just perform a search & replace in your project to adapt these changes. + +- `Craue\FormFlowBundle\Event` to `Craue\FormFlowBundle\FormFlow\Event` +- `Craue\FormFlowBundle\Exception` to `Craue\FormFlowBundle\FormFlow\Exception` +- `Craue\FormFlowBundle\Form` to `Craue\FormFlowBundle\FormFlow` +- `Craue\FormFlowBundle\Storage` to `Craue\FormFlowBundle\FormFlow\Storage` + ## Renaming step config option `type` to `form_type` The step config option to specify the form type for each step within the `loadStepsConfig` method has been renamed from diff --git a/Util/FormFlowUtil.php b/Util/FormFlowUtil.php index 8918a64b..ea0ab925 100644 --- a/Util/FormFlowUtil.php +++ b/Util/FormFlowUtil.php @@ -2,7 +2,7 @@ namespace Craue\FormFlowBundle\Util; -use Craue\FormFlowBundle\Form\FormFlow; +use Craue\FormFlowBundle\FormFlow\FormFlow; /** * @author Christian Raue diff --git a/composer.json b/composer.json index 53374ab9..8c1d68b6 100644 --- a/composer.json +++ b/composer.json @@ -28,6 +28,9 @@ "sensio/framework-extra-bundle": "~2.1|~3.0", "symfony/symfony": "~2.3" }, + "replace": { + "craue/formflow": "self.version" + }, "minimum-stability": "stable", "prefer-stable": true, "autoload": {