-
Notifications
You must be signed in to change notification settings - Fork 118
/
CraueFormFlowBundle.php
42 lines (35 loc) · 1.07 KB
/
CraueFormFlowBundle.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace Craue\FormFlowBundle;
use Craue\FormFlowBundle\DependencyInjection\Compiler\LegacySessionCompilerPass;
use Craue\FormFlowBundle\Util\TempFileUtil;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* @author Christian Raue <[email protected]>
* @copyright 2011-2024 Christian Raue
* @license http://opensource.org/licenses/mit-license.php MIT License
*/
class CraueFormFlowBundle extends Bundle {
/**
* @return void
*/
public function boot() {
/*
* Removes all temporary files created while handling file uploads.
* Use a shutdown function to clean up even in case of a fatal error.
*/
register_shutdown_function(function() : void {
TempFileUtil::removeTempFiles();
});
}
/**
* {@inheritDoc}
*/
public function build(ContainerBuilder $container) : void {
parent::build($container);
if (!\method_exists(RequestStack::class, 'getSession')) {
$container->addCompilerPass(new LegacySessionCompilerPass());
}
}
}