From f02bc3515891f8123389299c3578d9b7d923a682 Mon Sep 17 00:00:00 2001 From: mgross Date: Mon, 15 May 2023 16:13:25 +0200 Subject: [PATCH] Fixed settings page --- .../SystemConfigurationSubscriber.php | 72 +++++++++---------- 1 file changed, 33 insertions(+), 39 deletions(-) diff --git a/EventSubscriber/SystemConfigurationSubscriber.php b/EventSubscriber/SystemConfigurationSubscriber.php index 52bb96c..c4bee41 100755 --- a/EventSubscriber/SystemConfigurationSubscriber.php +++ b/EventSubscriber/SystemConfigurationSubscriber.php @@ -11,7 +11,7 @@ use App\Event\SystemConfigurationEvent; use App\Form\Model\Configuration; -use App\Form\Model\SystemConfiguration as SystemConfigurationModel; +use App\Form\Model\SystemConfiguration; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Form\Extension\Core\Type\IntegerType; use Symfony\Component\Form\Extension\Core\Type\TextareaType; @@ -21,7 +21,7 @@ class SystemConfigurationSubscriber implements EventSubscriberInterface { - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ SystemConfigurationEvent::class => ['onSystemConfiguration', 100], @@ -31,43 +31,37 @@ public static function getSubscribedEvents() public function onSystemConfiguration(SystemConfigurationEvent $event): void { $event->addConfiguration( - (new SystemConfigurationModel()) - ->setSection('easy_backup_config') - ->setConfiguration([ - (new Configuration()) - ->setName('easy_backup.setting_mysqldump_command') - ->setLabel('easy_backup.setting_mysqldump_command') - ->setTranslationDomain('system-configuration') - ->setRequired(false) - ->setType(TextType::class), - (new Configuration()) - ->setName('easy_backup.setting_mysql_restore_command') - ->setLabel('easy_backup.setting_mysql_restore_command') - ->setTranslationDomain('system-configuration') - ->setRequired(false) - ->setType(TextType::class), - (new Configuration()) - ->setName('easy_backup.setting_backup_dir') - ->setLabel('easy_backup.setting_backup_dir') - ->setTranslationDomain('system-configuration') - ->setRequired(false) - ->setType(TextType::class), - (new Configuration()) - ->setName('easy_backup.setting_paths_to_backup') - ->setLabel('easy_backup.setting_paths_to_backup') - ->setTranslationDomain('system-configuration') - ->setRequired(false) - ->setType(TextareaType::class), - (new Configuration()) - ->setName('easy_backup.setting_backup_amount_max') - ->setLabel('easy_backup.setting_backup_amount_max') - ->setTranslationDomain('system-configuration') - ->setRequired(false) - ->setConstraints([new NotNull(), new GreaterThanOrEqual(['value' => -1])]) - ->setType(IntegerType::class) - ->setValue(-1) - ->setOptions(['help' => 'help.easy_backup.setting_backup_amount_max']), - ]) + (new SystemConfiguration('easy_backup_config')) + ->setConfiguration([ + (new Configuration('easy_backup.setting_mysqldump_command')) + ->setLabel('easy_backup.setting_mysqldump_command') + ->setTranslationDomain('system-configuration') + ->setRequired(false) + ->setType(TextType::class), + (new Configuration('easy_backup.setting_mysql_restore_command')) + ->setLabel('easy_backup.setting_mysql_restore_command') + ->setTranslationDomain('system-configuration') + ->setRequired(false) + ->setType(TextType::class), + (new Configuration('easy_backup.setting_backup_dir')) + ->setLabel('easy_backup.setting_backup_dir') + ->setTranslationDomain('system-configuration') + ->setRequired(false) + ->setType(TextType::class), + (new Configuration('easy_backup.setting_paths_to_backup')) + ->setLabel('easy_backup.setting_paths_to_backup') + ->setTranslationDomain('system-configuration') + ->setRequired(false) + ->setType(TextareaType::class), + (new Configuration('easy_backup.setting_backup_amount_max')) + ->setLabel('easy_backup.setting_backup_amount_max') + ->setTranslationDomain('system-configuration') + ->setRequired(false) + ->setConstraints([new NotNull(), new GreaterThanOrEqual(['value' => -1])]) + ->setType(IntegerType::class) + ->setValue(-1) + ->setOptions(['help' => 'help.easy_backup.setting_backup_amount_max']), + ]) ); } }