Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -14,3 +13,4 @@
/vendors-install.bat
/vendors-update.bat
/vendors-whatsnew.bat
.DS_Store
12 changes: 11 additions & 1 deletion CraueFormFlowBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -25,4 +27,12 @@ public function boot() {
});
}

/**
* {@inheritDoc}
*/
public function build(ContainerBuilder $container) {
parent::build($container);
$container->addCompilerPass(new LoadTranslationsCompilerPass());
}

}
45 changes: 45 additions & 0 deletions DependencyInjection/Compiler/LoadTranslationsCompilerPass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace Craue\FormFlowBundle\DependencyInjection\Compiler;

use Symfony\Component\Config\Resource\DirectoryResource;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Finder\Finder;

/**
* Explicitly registers translation files in their uncommon location.
*
* @author Christian Raue <[email protected]>
* @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));
}
}

}
6 changes: 6 additions & 0 deletions FormFlow/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/.buildpath
/.project
/.settings
/git-subtree-split.bat
/git.bat
.DS_Store
4 changes: 2 additions & 2 deletions Event/FormFlowEvent.php → FormFlow/Event/FormFlowEvent.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Craue\FormFlowBundle\Event;
namespace Craue\FormFlowBundle\FormFlow\Event;

use Craue\FormFlowBundle\Form\FormFlowInterface;
use Craue\FormFlowBundle\FormFlow\FormFlowInterface;
use Symfony\Component\EventDispatcher\Event;

/**
Expand Down
4 changes: 2 additions & 2 deletions Event/GetStepsEvent.php → FormFlow/Event/GetStepsEvent.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Craue\FormFlowBundle\Event;
namespace Craue\FormFlowBundle\FormFlow\Event;

use Craue\FormFlowBundle\Form\StepInterface;
use Craue\FormFlowBundle\FormFlow\StepInterface;

/**
* Is called once to define steps for the flow.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Craue\FormFlowBundle\Event;
namespace Craue\FormFlowBundle\FormFlow\Event;

use Craue\FormFlowBundle\Form\FormFlowInterface;
use Craue\FormFlowBundle\FormFlow\FormFlowInterface;

/**
* Is called once after binding all step's saved form data and determining the current step.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Craue\FormFlowBundle\Event;
namespace Craue\FormFlowBundle\FormFlow\Event;

use Craue\FormFlowBundle\Form\FormFlowInterface;
use Craue\FormFlowBundle\FormFlow\FormFlowInterface;

/**
* Is called once for the current step after binding the request.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Craue\FormFlowBundle\Event;
namespace Craue\FormFlowBundle\FormFlow\Event;

use Craue\FormFlowBundle\Form\FormFlowInterface;
use Craue\FormFlowBundle\FormFlow\FormFlowInterface;

/**
* Is called for each step after binding its saved form data.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Craue\FormFlowBundle\Event;
namespace Craue\FormFlowBundle\FormFlow\Event;

use Craue\FormFlowBundle\Form\FormFlowInterface;
use Craue\FormFlowBundle\FormFlow\FormFlowInterface;

/**
* Is called once for the current step after validating the form data.
Expand Down
2 changes: 1 addition & 1 deletion Event/PreBindEvent.php → FormFlow/Event/PreBindEvent.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Craue\FormFlowBundle\Event;
namespace Craue\FormFlowBundle\FormFlow\Event;

/**
* Is called once prior to binding any (neither saved nor request) data.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Craue\FormFlowBundle\Event;
namespace Craue\FormFlowBundle\FormFlow\Event;

use Craue\FormFlowBundle\Form\FormFlowInterface;
use Craue\FormFlowBundle\FormFlow\FormFlowInterface;
use Symfony\Component\Form\FormInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Craue\FormFlowBundle\EventListener;
namespace Craue\FormFlowBundle\FormFlow\EventListener;

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Craue\FormFlowBundle\Exception;
namespace Craue\FormFlowBundle\FormFlow\Exception;

/**
* @author Christian Raue <[email protected]>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Craue\FormFlowBundle\Form\Extension;
namespace Craue\FormFlowBundle\FormFlow\Extension;

use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormBuilderInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Craue\FormFlowBundle\Form\Extension;
namespace Craue\FormFlowBundle\FormFlow\Extension;

use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormInterface;
Expand Down
24 changes: 12 additions & 12 deletions Form/FormFlow.php → FormFlow/FormFlow.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?php

namespace Craue\FormFlowBundle\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\Event\PreviousStepInvalidEvent;
use Craue\FormFlowBundle\Exception\InvalidTypeException;
use Craue\FormFlowBundle\Storage\DataManagerInterface;
use Craue\FormFlowBundle\Util\StringUtil;
namespace Craue\FormFlowBundle\FormFlow;

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\Event\PreviousStepInvalidEvent;
use Craue\FormFlowBundle\FormFlow\Exception\InvalidTypeException;
use Craue\FormFlowBundle\FormFlow\Storage\DataManagerInterface;
use Craue\FormFlowBundle\FormFlow\Util\StringUtil;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
Expand Down
2 changes: 1 addition & 1 deletion Form/FormFlowEvents.php → FormFlow/FormFlowEvents.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Craue\FormFlowBundle\Form;
namespace Craue\FormFlowBundle\FormFlow;

/**
* @author Marcus Stöhr <[email protected]>
Expand Down
6 changes: 3 additions & 3 deletions Form/FormFlowInterface.php → FormFlow/FormFlowInterface.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Craue\FormFlowBundle\Form;
namespace Craue\FormFlowBundle\FormFlow;

use Craue\FormFlowBundle\Exception\InvalidTypeException;
use Craue\FormFlowBundle\Storage\DataManagerInterface;
use Craue\FormFlowBundle\FormFlow\Exception\InvalidTypeException;
use Craue\FormFlowBundle\FormFlow\Storage\DataManagerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
Expand Down
2 changes: 2 additions & 0 deletions FormFlow/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Copyright (c) 2011-2015 Christian Raue <[email protected]>
Licensed under the MIT License: http://opensource.org/licenses/mit-license.php
1 change: 1 addition & 0 deletions FormFlow/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
For further information refer to https://github.com/craue/CraueFormFlowBundle.
4 changes: 2 additions & 2 deletions Form/Step.php → FormFlow/Step.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Craue\FormFlowBundle\Form;
namespace Craue\FormFlowBundle\FormFlow;

use Craue\FormFlowBundle\Exception\InvalidTypeException;
use Craue\FormFlowBundle\FormFlow\Exception\InvalidTypeException;
use Symfony\Component\Form\FormTypeInterface;

/**
Expand Down
2 changes: 1 addition & 1 deletion Form/StepInterface.php → FormFlow/StepInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Craue\FormFlowBundle\Form;
namespace Craue\FormFlowBundle\FormFlow;

use Symfony\Component\Form\FormTypeInterface;

Expand Down
4 changes: 2 additions & 2 deletions Storage/DataManager.php → FormFlow/Storage/DataManager.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Craue\FormFlowBundle\Storage;
namespace Craue\FormFlowBundle\FormFlow\Storage;

use Craue\FormFlowBundle\Form\FormFlowInterface;
use Craue\FormFlowBundle\FormFlow\FormFlowInterface;

/**
* Manages data of flows and their steps.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Craue\FormFlowBundle\Storage;
namespace Craue\FormFlowBundle\FormFlow\Storage;

use Craue\FormFlowBundle\Form\FormFlowInterface;
use Craue\FormFlowBundle\FormFlow\FormFlowInterface;

/**
* @author Christian Raue <[email protected]>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Craue\FormFlowBundle\Storage;
namespace Craue\FormFlowBundle\FormFlow\Storage;

/**
* Extends the base {@link DataManagerInterface} by methods which may be used for custom flow management.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Craue\FormFlowBundle\Storage;
namespace Craue\FormFlowBundle\FormFlow\Storage;

use Craue\FormFlowBundle\Exception\InvalidTypeException;
use Craue\FormFlowBundle\Util\TempFileUtil;
use Craue\FormFlowBundle\FormFlow\Exception\InvalidTypeException;
use Craue\FormFlowBundle\FormFlow\Util\TempFileUtil;
use Symfony\Component\HttpFoundation\File\UploadedFile;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Craue\FormFlowBundle\Storage;
namespace Craue\FormFlowBundle\FormFlow\Storage;

use Symfony\Component\HttpFoundation\Session\SessionInterface;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Craue\FormFlowBundle\Storage;
namespace Craue\FormFlowBundle\FormFlow\Storage;

/**
* @author Toni Uebernickel <[email protected]>
Expand Down
4 changes: 2 additions & 2 deletions Util/StringUtil.php → FormFlow/Util/StringUtil.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Craue\FormFlowBundle\Util;
namespace Craue\FormFlowBundle\FormFlow\Util;

use Craue\FormFlowBundle\Exception\InvalidTypeException;
use Craue\FormFlowBundle\FormFlow\Exception\InvalidTypeException;

/**
* @author Christian Raue <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion Util/TempFileUtil.php → FormFlow/Util/TempFileUtil.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Craue\FormFlowBundle\Util;
namespace Craue\FormFlowBundle\FormFlow\Util;

/**
* Keeps track of temporary files to be able to remove them when no longer needed.
Expand Down
Loading