upgraded FosUserBundle and Symfony 4.3 (#1005)
This commit is contained in:
@@ -114,17 +114,14 @@ class CreateReleaseCommand extends Command
|
||||
$tar .= '.tar.gz';
|
||||
$zip .= '.zip';
|
||||
|
||||
// this removes the current env settings, as they might differ from the release ones
|
||||
// if we don't unset them, the .env file won't be read when executing bin/console commands
|
||||
putenv('DATABASE_URL');
|
||||
putenv('APP_ENV');
|
||||
$prefix = 'APP_ENV=prod DATABASE_URL=sqlite:///%kernel.project_dir%/var/data/kimai.sqlite';
|
||||
|
||||
$commands = [
|
||||
'Clone repository' => $gitCmd . ' ' . $tmpDir,
|
||||
'Install composer dependencies' => 'cd ' . $tmpDir . ' && composer install --no-dev --optimize-autoloader',
|
||||
'Create database' => 'cd ' . $tmpDir . ' && bin/console doctrine:database:create -n',
|
||||
'Create tables' => 'cd ' . $tmpDir . ' && bin/console doctrine:schema:create -n',
|
||||
'Add all migrations' => 'cd ' . $tmpDir . ' && bin/console doctrine:migrations:version --add --all -n',
|
||||
'Create database' => 'cd ' . $tmpDir . ' && ' . $prefix . ' bin/console doctrine:database:create -n',
|
||||
'Create tables' => 'cd ' . $tmpDir . ' && ' . $prefix . ' bin/console doctrine:schema:create -n',
|
||||
'Add all migrations' => 'cd ' . $tmpDir . ' && ' . $prefix . ' bin/console doctrine:migrations:version --add --all -n',
|
||||
];
|
||||
|
||||
$filesToDelete = [
|
||||
|
||||
@@ -106,9 +106,6 @@ class CreateUserCommand extends Command
|
||||
->setRoles(explode(',', $role))
|
||||
;
|
||||
|
||||
$pwd = $this->encoder->encodePassword($user, $user->getPlainPassword());
|
||||
$user->setPassword($pwd);
|
||||
|
||||
$errors = $this->validator->validate($user, null, ['Registration']);
|
||||
if ($errors->count() > 0) {
|
||||
/** @var \Symfony\Component\Validator\ConstraintViolation $error */
|
||||
@@ -126,6 +123,9 @@ class CreateUserCommand extends Command
|
||||
}
|
||||
|
||||
try {
|
||||
$pwd = $this->encoder->encodePassword($user, $user->getPlainPassword());
|
||||
$user->setPassword($pwd);
|
||||
|
||||
$entityManager = $this->doctrine->getManager();
|
||||
$entityManager->persist($user);
|
||||
$entityManager->flush();
|
||||
|
||||
@@ -197,7 +197,7 @@ class ActivityController extends AbstractController
|
||||
protected function renderActivityForm(Activity $activity, Request $request)
|
||||
{
|
||||
$event = new ActivityMetaDefinitionEvent($activity);
|
||||
$this->dispatcher->dispatch(ActivityMetaDefinitionEvent::class, $event);
|
||||
$this->dispatcher->dispatch($event, ActivityMetaDefinitionEvent::class);
|
||||
|
||||
$editForm = $this->createEditForm($activity);
|
||||
$editForm->handleRequest($request);
|
||||
|
||||
@@ -206,7 +206,7 @@ class CustomerController extends AbstractController
|
||||
protected function renderCustomerForm(Customer $customer, Request $request)
|
||||
{
|
||||
$event = new CustomerMetaDefinitionEvent($customer);
|
||||
$this->dispatcher->dispatch(CustomerMetaDefinitionEvent::class, $event);
|
||||
$this->dispatcher->dispatch($event, CustomerMetaDefinitionEvent::class);
|
||||
|
||||
$editForm = $this->createEditForm($customer);
|
||||
|
||||
|
||||
@@ -88,10 +88,7 @@ class DashboardController extends AbstractController
|
||||
$event->addSection($row);
|
||||
}
|
||||
|
||||
$this->eventDispatcher->dispatch(
|
||||
DashboardEvent::DASHBOARD,
|
||||
$event
|
||||
);
|
||||
$this->eventDispatcher->dispatch($event, DashboardEvent::DASHBOARD);
|
||||
|
||||
$sections = $event->getSections();
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ class ProfileController extends AbstractController
|
||||
{
|
||||
// we need to prepare the user preferences, which is done via an EventSubscriber
|
||||
$event = new PrepareUserEvent($profile);
|
||||
$this->dispatcher->dispatch(PrepareUserEvent::PREPARE, $event);
|
||||
$this->dispatcher->dispatch($event, PrepareUserEvent::PREPARE);
|
||||
|
||||
$original = [];
|
||||
foreach ($profile->getPreferences() as $preference) {
|
||||
@@ -288,7 +288,7 @@ class ProfileController extends AbstractController
|
||||
{
|
||||
// we need to prepare the user preferences, which is done via an EventSubscriber
|
||||
$event = new PrepareUserEvent($user);
|
||||
$this->dispatcher->dispatch(PrepareUserEvent::PREPARE, $event);
|
||||
$this->dispatcher->dispatch($event, PrepareUserEvent::PREPARE);
|
||||
|
||||
return $this->createForm(
|
||||
UserPreferencesForm::class,
|
||||
@@ -343,7 +343,7 @@ class ProfileController extends AbstractController
|
||||
UserPasswordType::class,
|
||||
$user,
|
||||
[
|
||||
'validation_groups' => ['passwordUpdate'],
|
||||
'validation_groups' => ['PasswordUpdate'],
|
||||
'action' => $this->generateUrl('user_profile_password', ['username' => $user->getUsername()]),
|
||||
'method' => 'POST'
|
||||
]
|
||||
|
||||
@@ -195,7 +195,7 @@ class ProjectController extends AbstractController
|
||||
protected function renderProjectForm(Project $project, Request $request)
|
||||
{
|
||||
$event = new ProjectMetaDefinitionEvent($project);
|
||||
$this->dispatcher->dispatch(ProjectMetaDefinitionEvent::class, $event);
|
||||
$this->dispatcher->dispatch($event, ProjectMetaDefinitionEvent::class);
|
||||
|
||||
$editForm = $this->createEditForm($project);
|
||||
$editForm->handleRequest($request);
|
||||
|
||||
@@ -169,7 +169,7 @@ class SystemConfigurationController extends AbstractController
|
||||
$types = $this->getConfigurationTypes();
|
||||
|
||||
$event = new SystemConfigurationEvent($types);
|
||||
$this->eventDispatcher->dispatch(SystemConfigurationEvent::CONFIGURE, $event);
|
||||
$this->eventDispatcher->dispatch($event, SystemConfigurationEvent::CONFIGURE);
|
||||
|
||||
foreach ($event->getConfigurations() as $configs) {
|
||||
foreach ($configs->getConfiguration() as $config) {
|
||||
|
||||
@@ -138,7 +138,7 @@ abstract class TimesheetAbstractController extends AbstractController
|
||||
protected function edit(Timesheet $entry, Request $request, string $renderTemplate)
|
||||
{
|
||||
$event = new TimesheetMetaDefinitionEvent($entry);
|
||||
$this->dispatcher->dispatch(TimesheetMetaDefinitionEvent::class, $event);
|
||||
$this->dispatcher->dispatch($event, TimesheetMetaDefinitionEvent::class);
|
||||
|
||||
$editForm = $this->getEditForm($entry, $request->get('page'));
|
||||
$editForm->handleRequest($request);
|
||||
@@ -196,7 +196,7 @@ abstract class TimesheetAbstractController extends AbstractController
|
||||
}
|
||||
|
||||
$event = new TimesheetMetaDefinitionEvent($entry);
|
||||
$this->dispatcher->dispatch(TimesheetMetaDefinitionEvent::class, $event);
|
||||
$this->dispatcher->dispatch($event, TimesheetMetaDefinitionEvent::class);
|
||||
|
||||
$mode = $this->getTrackingMode();
|
||||
$mode->create($entry, $request);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
namespace App\Event;
|
||||
|
||||
use App\Entity\Activity;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* This event can be used, to dynamically add meta fields to activities
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai time-tracking app.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Event;
|
||||
|
||||
use KevinPapst\AdminLTEBundle\Model\MenuItemModel;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* The ConfigureAdminMenuEvent is used for populating the administration navigation.
|
||||
*/
|
||||
final class ConfigureAdminMenuEvent extends Event
|
||||
{
|
||||
public const CONFIGURE = 'app.admin_menu_configure';
|
||||
|
||||
/**
|
||||
* @var Request
|
||||
*/
|
||||
private $request;
|
||||
/**
|
||||
* @var MenuItemModel
|
||||
*/
|
||||
private $menu;
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param MenuItemModel $menu
|
||||
*/
|
||||
public function __construct(Request $request, MenuItemModel $menu)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->menu = $menu;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Request
|
||||
*/
|
||||
public function getRequest()
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MenuItemModel
|
||||
*/
|
||||
public function getAdminMenu()
|
||||
{
|
||||
return $this->menu;
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,8 @@ namespace App\Event;
|
||||
|
||||
use KevinPapst\AdminLTEBundle\Event\SidebarMenuEvent;
|
||||
use KevinPapst\AdminLTEBundle\Model\MenuItemModel;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* The ConfigureMainMenuEvent is used for populating the main navigation.
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
namespace App\Event;
|
||||
|
||||
use App\Entity\Customer;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* This event can be used, to dynamically add meta fields to customers
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace App\Event;
|
||||
|
||||
use App\Entity\User;
|
||||
use App\Widget\WidgetContainerInterface;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
|
||||
final class DashboardEvent extends Event
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
namespace App\Event;
|
||||
|
||||
use App\Entity\User;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* This event should be used, if a user profile is loaded and want to fill the dynamic user preferences
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
namespace App\Event;
|
||||
|
||||
use App\Entity\Project;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* This event can be used, to dynamically add meta fields to projects
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
namespace App\Event;
|
||||
|
||||
use App\Form\Model\SystemConfiguration;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* This event should be used, if system configurations should be changed/added dynamically.
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
namespace App\Event;
|
||||
|
||||
use App\Entity\User;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
|
||||
final class ThemeEvent extends Event
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
namespace App\Event;
|
||||
|
||||
use App\Entity\Timesheet;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* This event can be used, to dynamically add meta fields to timesheets
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace App\Event;
|
||||
|
||||
use App\Entity\User;
|
||||
use App\Entity\UserPreference;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* This event should be used, if further user preferences should added dynamically
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
namespace App\EventSubscriber;
|
||||
|
||||
use App\Event\ConfigureAdminMenuEvent;
|
||||
use App\Event\ConfigureMainMenuEvent;
|
||||
use KevinPapst\AdminLTEBundle\Event\SidebarMenuEvent;
|
||||
use KevinPapst\AdminLTEBundle\Event\ThemeEvents;
|
||||
@@ -73,16 +72,7 @@ class MenuBuilderSubscriber implements EventSubscriberInterface
|
||||
new MenuItemModel('system', 'menu.system', '')
|
||||
);
|
||||
|
||||
$this->eventDispatcher->dispatch(ConfigureMainMenuEvent::CONFIGURE, $menuEvent);
|
||||
|
||||
// @deprecated since 0.9, will be removed with 1.0
|
||||
$this->eventDispatcher->dispatch(
|
||||
ConfigureAdminMenuEvent::CONFIGURE,
|
||||
new ConfigureAdminMenuEvent(
|
||||
$request,
|
||||
$menuEvent->getAdminMenu()
|
||||
)
|
||||
);
|
||||
$this->eventDispatcher->dispatch($menuEvent, ConfigureMainMenuEvent::CONFIGURE);
|
||||
|
||||
if ($menuEvent->getAdminMenu()->hasChildren()) {
|
||||
$event->addItem(new MenuItemModel('admin', 'menu.admin', ''));
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace App\EventSubscriber;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Event\RequestEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
|
||||
@@ -72,9 +72,6 @@ class RedirectToLocaleSubscriber implements EventSubscriberInterface
|
||||
$this->locales = array_unique($this->locales);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
@@ -82,10 +79,7 @@ class RedirectToLocaleSubscriber implements EventSubscriberInterface
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param GetResponseEvent $event
|
||||
*/
|
||||
public function onKernelRequest(GetResponseEvent $event)
|
||||
public function onKernelRequest(RequestEvent $event)
|
||||
{
|
||||
$request = $event->getRequest();
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace App\EventSubscriber;
|
||||
|
||||
use App\Entity\User;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Event\RequestEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
|
||||
@@ -34,7 +34,7 @@ class TimezoneSubscriber implements EventSubscriberInterface
|
||||
];
|
||||
}
|
||||
|
||||
public function setTimezone(GetResponseEvent $event)
|
||||
public function setTimezone(RequestEvent $event)
|
||||
{
|
||||
if (!$this->canHandleEvent()) {
|
||||
return;
|
||||
|
||||
@@ -155,7 +155,7 @@ class UserPreferenceSubscriber implements EventSubscriberInterface
|
||||
}
|
||||
|
||||
$event = new UserPreferenceEvent($user, $this->getDefaultPreferences($user));
|
||||
$this->eventDispatcher->dispatch(UserPreferenceEvent::CONFIGURE, $event);
|
||||
$this->eventDispatcher->dispatch($event, UserPreferenceEvent::CONFIGURE);
|
||||
|
||||
foreach ($event->getPreferences() as $preference) {
|
||||
/* @var UserPreference[] $prefs */
|
||||
|
||||
@@ -62,7 +62,7 @@ class UserProfileSubscriber implements EventSubscriberInterface
|
||||
$user = $this->storage->getToken()->getUser();
|
||||
|
||||
$event = new PrepareUserEvent($user);
|
||||
$this->eventDispatcher->dispatch(PrepareUserEvent::PREPARE, $event);
|
||||
$this->eventDispatcher->dispatch($event, PrepareUserEvent::PREPARE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace App\Form\Type;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Intl\Intl;
|
||||
use Symfony\Component\Intl\Locales;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
/**
|
||||
@@ -43,7 +43,7 @@ class LanguageType extends AbstractType
|
||||
{
|
||||
$choices = [];
|
||||
foreach ($this->locales as $key) {
|
||||
$name = ucfirst(Intl::getLocaleBundle()->getLocaleName($key, $key));
|
||||
$name = ucfirst(Locales::getName($key, $key));
|
||||
$choices[$name] = $key;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class EventExtensions extends AbstractExtension
|
||||
$themeEvent = new ThemeEvent($this->user, $payload);
|
||||
|
||||
if ($this->hasListener($eventName)) {
|
||||
$this->getDispatcher()->dispatch($eventName, $themeEvent);
|
||||
$this->getDispatcher()->dispatch($themeEvent, $eventName);
|
||||
}
|
||||
|
||||
return $themeEvent;
|
||||
|
||||
@@ -14,7 +14,9 @@ use App\Entity\Timesheet;
|
||||
use App\Utils\Duration;
|
||||
use App\Utils\LocaleSettings;
|
||||
use NumberFormatter;
|
||||
use Symfony\Component\Intl\Intl;
|
||||
use Symfony\Component\Intl\Countries;
|
||||
use Symfony\Component\Intl\Currencies;
|
||||
use Symfony\Component\Intl\Locales;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFilter;
|
||||
use Twig\TwigFunction;
|
||||
@@ -136,7 +138,7 @@ class Extensions extends AbstractExtension
|
||||
*/
|
||||
public function currency($currency)
|
||||
{
|
||||
return Intl::getCurrencyBundle()->getCurrencySymbol($currency);
|
||||
return Currencies::getSymbol($currency);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,7 +147,7 @@ class Extensions extends AbstractExtension
|
||||
*/
|
||||
public function country($country)
|
||||
{
|
||||
return Intl::getRegionBundle()->getCountryName($country);
|
||||
return Countries::getName($country);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -190,7 +192,7 @@ class Extensions extends AbstractExtension
|
||||
{
|
||||
$locales = [];
|
||||
foreach ($this->localeSettings->getAvailableLanguages() as $locale) {
|
||||
$locales[] = ['code' => $locale, 'name' => Intl::getLocaleBundle()->getLocaleName($locale, $locale)];
|
||||
$locales[] = ['code' => $locale, 'name' => Locales::getName($locale, $locale)];
|
||||
}
|
||||
|
||||
return $locales;
|
||||
|
||||
Reference in New Issue
Block a user