2
2
3
3
declare (strict_types=1 );
4
4
5
+ /*
6
+ * This file is part of the CleverAge/UiProcessBundle package.
7
+ *
8
+ * Copyright (c) Clever-Age
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
5
14
namespace CleverAge \ProcessUiBundle \Controller \Admin \Process ;
6
15
7
16
use CleverAge \ProcessBundle \Configuration \ProcessConfiguration ;
20
29
use Symfony \Component \HttpFoundation \Response ;
21
30
use Symfony \Component \HttpKernel \Attribute \ValueResolver ;
22
31
use Symfony \Component \Messenger \MessageBusInterface ;
23
- use Symfony \Component \Routing \Annotation \Route ;
24
32
use Symfony \Component \Security \Http \Attribute \IsGranted ;
25
33
use Symfony \Component \Uid \Uuid ;
26
34
27
- #[Route(
35
+ #[\ Symfony \ Component \ Routing \ Attribute \ Route(
28
36
'/process/launch ' ,
29
37
name: 'process_launch ' ,
30
38
requirements: ['process ' => '\w+ ' ],
@@ -41,17 +49,17 @@ public function __invoke(
41
49
ProcessConfigurationsManager $ configurationsManager ,
42
50
AdminContext $ context ,
43
51
): Response {
44
- $ uiOptions = $ configurationsManager ->getUiOptions ($ requestStack ->getMainRequest ()->get ('process ' ));
52
+ $ uiOptions = $ configurationsManager ->getUiOptions ($ requestStack ->getMainRequest ()? ->get('process ' ) ?? '' );
45
53
$ form = $ this ->createForm (
46
54
LaunchType::class,
47
55
null ,
48
56
[
49
- 'constraints ' => $ uiOptions ['constraints ' ],
57
+ 'constraints ' => $ uiOptions ['constraints ' ] ?? [] ,
50
58
'process_code ' => $ requestStack ->getMainRequest ()?->get('process ' ),
51
59
]
52
60
);
53
61
if (false === $ form ->isSubmitted ()) {
54
- $ default = $ uiOptions ['default ' ];
62
+ $ default = $ uiOptions ['default ' ] ?? [] ;
55
63
if (false === $ form ->get ('input ' )->getConfig ()->getType ()->getInnerType () instanceof TextType
56
64
&& isset ($ default ['input ' ])
57
65
) {
@@ -61,10 +69,9 @@ public function __invoke(
61
69
}
62
70
$ form ->handleRequest ($ requestStack ->getMainRequest ());
63
71
if ($ form ->isSubmitted () && $ form ->isValid ()) {
64
- /** @var mixed|UploadedFile $file */
65
72
$ input = $ form ->get ('input ' )->getData ();
66
73
if ($ input instanceof UploadedFile) {
67
- $ filename = sprintf ('%s/%s.%s ' , $ uploadDirectory , Uuid::v4 (), $ input ->getClientOriginalExtension ());
74
+ $ filename = \ sprintf ('%s/%s.%s ' , $ uploadDirectory , Uuid::v4 (), $ input ->getClientOriginalExtension ());
68
75
(new Filesystem ())->dumpFile ($ filename , $ input ->getContent ());
69
76
$ input = $ filename ;
70
77
}
0 commit comments