Moved default language, default timezone and base currency settings to new settings system

This commit is contained in:
Jan Böhmer 2024-08-03 23:14:29 +02:00
parent 463812fb3d
commit 2ab2b7f77d
27 changed files with 211 additions and 83 deletions

View file

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace App\EventSubscriber\UserSystem;
use App\Entity\UserSystem\User;
use App\Settings\SystemSettings\LocalizationSettings;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\ControllerEvent;
@ -33,7 +34,7 @@ use Symfony\Component\HttpKernel\KernelEvents;
*/
final class SetUserTimezoneSubscriber implements EventSubscriberInterface
{
public function __construct(private readonly string $default_timezone, private readonly Security $security)
public function __construct(private readonly LocalizationSettings $localizationSettings, private readonly Security $security)
{
}
@ -48,8 +49,8 @@ final class SetUserTimezoneSubscriber implements EventSubscriberInterface
}
//Fill with default value if needed
if (null === $timezone && $this->default_timezone !== '') {
$timezone = $this->default_timezone;
if (null === $timezone && $this->localizationSettings !== '') {
$timezone = $this->localizationSettings->timezone;
}
//If timezone was configured anywhere set it, otherwise just use the one from php.ini