-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcessManagerFormType.php
More file actions
83 lines (76 loc) · 2.25 KB
/
ProcessManagerFormType.php
File metadata and controls
83 lines (76 loc) · 2.25 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
namespace SyncEngine\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use SyncEngine\Messenger\MessengerManager;
class ProcessManagerFormType extends AbstractType
{
public function __construct( private readonly MessengerManager $manager ) {}
public function buildForm( FormBuilderInterface $builder, array $options ): void
{
$builder
->add('SYNCENGINE_MESSENGER_MANAGER', ChoiceType::class, [
'label' => 'Manager',
'required' => true,
'row_attr' => [
'class' => 'form-floating mb-3',
],
'choices' => [
'SyncEngine' => MessengerManager::MANAGER_INTERNAL,
'Cron' => MessengerManager::MANAGER_CRON,
'External' => MessengerManager::MANAGER_EXTERNAL,
],
]);
if ( $this->manager->isExternal() ) {
return;
}
$builder
->add('SYNCENGINE_MESSENGER_WORKER_LIMIT', NumberType::class, [
'label' => 'Worker limit',
'required' => false,
'attr' => [
'placeholder' => 'Max workers allowed running at the same time.',
],
'row_attr' => [
'class' => 'form-floating mb-3',
],
])
->add('SYNCENGINE_MESSENGER_WORKER_QUEUE_LIMIT', NumberType::class, [
'label' => 'Worker Queue limit',
'required' => false,
'attr' => [
'placeholder' => 'Max queued items a single worker will handle.',
],
'row_attr' => [
'class' => 'form-floating mb-3',
],
])
->add('SYNCENGINE_MESSENGER_WORKER_TIME_LIMIT', NumberType::class, [
'label' => 'Worker Time limit',
'required' => false,
'attr' => [
'placeholder' => 'Max seconds a single worker will run.',
],
'row_attr' => [
'class' => 'form-floating mb-3',
],
])
->add('SYNCENGINE_MESSENGER_WORKER_MEMORY_LIMIT', NumberType::class, [
'label' => 'Worker Memory limit',
'required' => false,
'attr' => [
'placeholder' => 'Max memory (MB) a single worker is allowed to use.',
],
'row_attr' => [
'class' => 'form-floating mb-3',
],
]);
}
public function configureOptions( OptionsResolver $resolver ): void
{
$resolver->setDefaults( [] );
}
}