apply rector rules: symfony **UP TO** 44

This commit is contained in:
Julien Fastré 2023-07-28 01:52:53 +02:00
parent b6a094aeee
commit c20f65eebb
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
88 changed files with 211 additions and 320 deletions

View File

@ -13,7 +13,7 @@ namespace Chill\MyBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class example extends Controller class example extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController
{ {
public function yourAction() public function yourAction()
{ {

View File

@ -16,7 +16,7 @@ use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Security\Core\Role\Role;
class ConsultationController extends Controller class ConsultationController extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController
{ {
/** /**
* @param int $id personId * @param int $id personId

View File

@ -33,8 +33,8 @@ class ChillMainConfiguration implements ConfigurationInterface
public function getConfigTreeBuilder() public function getConfigTreeBuilder()
{ {
$treeBuilder = new TreeBuilder(); $treeBuilder = new TreeBuilder('chill_main');
$rootNode = $treeBuilder->root('chill_main'); $rootNode = $treeBuilder->getRootNode();
$rootNode $rootNode
->children() ->children()

View File

@ -24,7 +24,7 @@ return static function (RectorConfig $rectorConfig): void {
//define sets of rules //define sets of rules
$rectorConfig->sets([ $rectorConfig->sets([
LevelSetList::UP_TO_PHP_82, LevelSetList::UP_TO_PHP_82,
\Rector\Symfony\Set\SymfonySetList::SYMFONY_44, \Rector\Symfony\Set\SymfonyLevelSetList::UP_TO_SYMFONY_44,
]); ]);
// chill rules // chill rules

View File

@ -281,7 +281,7 @@ final class ActivityController extends AbstractController
'element_class' => Activity::class, 'element_class' => Activity::class,
'action' => 'list', 'action' => 'list',
]); ]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); $this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
$view = 'ChillActivityBundle:Activity:listPerson.html.twig'; $view = 'ChillActivityBundle:Activity:listPerson.html.twig';
} elseif ($accompanyingPeriod instanceof AccompanyingPeriod) { } elseif ($accompanyingPeriod instanceof AccompanyingPeriod) {

View File

@ -31,12 +31,12 @@ class ActivityReasonCategoryController extends AbstractController
$form = $this->createCreateForm($entity); $form = $this->createCreateForm($entity);
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->persist($entity); $em->persist($entity);
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl('chill_activity_activityreasoncategory_show', ['id' => $entity->getId()])); return $this->redirectToRoute('chill_activity_activityreasoncategory_show', ['id' => $entity->getId()]);
} }
return $this->render('ChillActivityBundle:ActivityReasonCategory:new.html.twig', [ return $this->render('ChillActivityBundle:ActivityReasonCategory:new.html.twig', [
@ -128,10 +128,10 @@ class ActivityReasonCategoryController extends AbstractController
$editForm = $this->createEditForm($entity); $editForm = $this->createEditForm($entity);
$editForm->handleRequest($request); $editForm->handleRequest($request);
if ($editForm->isValid()) { if ($editForm->isSubmitted() && $editForm->isValid()) {
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl('chill_activity_activityreasoncategory_edit', ['id' => $id])); return $this->redirectToRoute('chill_activity_activityreasoncategory_edit', ['id' => $id]);
} }
return $this->render('ChillActivityBundle:ActivityReasonCategory:edit.html.twig', [ return $this->render('ChillActivityBundle:ActivityReasonCategory:edit.html.twig', [

View File

@ -37,12 +37,12 @@ class ActivityReasonController extends AbstractController
$form = $this->createCreateForm($entity); $form = $this->createCreateForm($entity);
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->persist($entity); $em->persist($entity);
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl('chill_activity_activityreason', ['id' => $entity->getId()])); return $this->redirectToRoute('chill_activity_activityreason', ['id' => $entity->getId()]);
} }
return $this->render('ChillActivityBundle:ActivityReason:new.html.twig', [ return $this->render('ChillActivityBundle:ActivityReason:new.html.twig', [
@ -134,10 +134,10 @@ class ActivityReasonController extends AbstractController
$editForm = $this->createEditForm($entity); $editForm = $this->createEditForm($entity);
$editForm->handleRequest($request); $editForm->handleRequest($request);
if ($editForm->isValid()) { if ($editForm->isSubmitted() && $editForm->isValid()) {
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl('chill_activity_activityreason', ['id' => $id])); return $this->redirectToRoute('chill_activity_activityreason', ['id' => $id]);
} }
return $this->render('ChillActivityBundle:ActivityReason:edit.html.twig', [ return $this->render('ChillActivityBundle:ActivityReason:edit.html.twig', [

View File

@ -38,11 +38,6 @@ class TranslatableActivityReasonCategoryType extends AbstractType
); );
} }
public function getBlockPrefix()
{
return 'translatable_activity_reason_category';
}
public function getParent() public function getParent()
{ {
return EntityType::class; return EntityType::class;

View File

@ -260,7 +260,7 @@ final class ActivityControllerTest extends WebTestCase
} }
/** /**
* @return \Symfony\Component\BrowserKit\Client * @return \Symfony\Component\BrowserKit\AbstractBrowser
*/ */
private function getAuthenticatedClient(mixed $username = 'center a_social') private function getAuthenticatedClient(mixed $username = 'center a_social')
{ {

View File

@ -20,6 +20,6 @@ class ChillBudgetBundle extends Bundle
{ {
parent::build($container); parent::build($container);
$container->addCompilerPass(new CalculatorCompilerPass()); $container->addCompilerPass(new CalculatorCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
} }
} }

View File

@ -55,7 +55,7 @@ abstract class AbstractElementController extends AbstractController
if ($request->getMethod() === Request::METHOD_DELETE) { if ($request->getMethod() === Request::METHOD_DELETE) {
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$this->chillMainLogger->notice('A budget element has been removed', [ $this->chillMainLogger->notice('A budget element has been removed', [
'family_element' => $element::class, 'family_element' => $element::class,
'by_user' => $this->getUser()->getUsername(), 'by_user' => $this->getUser()->getUsername(),

View File

@ -21,6 +21,6 @@ class ChillCalendarBundle extends Bundle
{ {
parent::build($container); parent::build($container);
$container->addCompilerPass(new RemoteCalendarCompilerPass()); $container->addCompilerPass(new RemoteCalendarCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
} }
} }

View File

@ -19,6 +19,6 @@ class ChillCustomFieldsBundle extends Bundle
public function build(\Symfony\Component\DependencyInjection\ContainerBuilder $container) public function build(\Symfony\Component\DependencyInjection\ContainerBuilder $container)
{ {
parent::build($container); parent::build($container);
$container->addCompilerPass(new CustomFieldCompilerPass()); $container->addCompilerPass(new CustomFieldCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
} }
} }

View File

@ -32,7 +32,7 @@ class CustomFieldController extends AbstractController
$form = $this->createCreateForm($entity, $request->query->get('type', null)); $form = $this->createCreateForm($entity, $request->query->get('type', null));
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->persist($entity); $em->persist($entity);
$em->flush(); $em->flush();
@ -40,10 +40,7 @@ class CustomFieldController extends AbstractController
$this->addFlash('success', $this->get('translator') $this->addFlash('success', $this->get('translator')
->trans('The custom field has been created')); ->trans('The custom field has been created'));
return $this->redirect($this->generateUrl( return $this->redirectToRoute('customfieldsgroup_show', ['id' => $entity->getCustomFieldsGroup()->getId()]);
'customfieldsgroup_show',
['id' => $entity->getCustomFieldsGroup()->getId()]
));
} }
$this->addFlash('error', $this->get('translator') $this->addFlash('error', $this->get('translator')
@ -141,13 +138,13 @@ class CustomFieldController extends AbstractController
$editForm = $this->createEditForm($entity, $entity->getType()); $editForm = $this->createEditForm($entity, $entity->getType());
$editForm->handleRequest($request); $editForm->handleRequest($request);
if ($editForm->isValid()) { if ($editForm->isSubmitted() && $editForm->isValid()) {
$em->flush(); $em->flush();
$this->addFlash('success', $this->get('translator') $this->addFlash('success', $this->get('translator')
->trans('The custom field has been updated')); ->trans('The custom field has been updated'));
return $this->redirect($this->generateUrl('customfield_edit', ['id' => $id])); return $this->redirectToRoute('customfield_edit', ['id' => $id]);
} }
$this->addFlash('error', $this->get('translator') $this->addFlash('error', $this->get('translator')

View File

@ -49,7 +49,7 @@ class CustomFieldsGroupController extends AbstractController
$form = $this->createCreateForm($entity); $form = $this->createCreateForm($entity);
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->persist($entity); $em->persist($entity);
$em->flush(); $em->flush();
@ -57,7 +57,7 @@ class CustomFieldsGroupController extends AbstractController
$this->addFlash('success', $this->translator $this->addFlash('success', $this->translator
->trans('The custom fields group has been created')); ->trans('The custom fields group has been created'));
return $this->redirect($this->generateUrl('customfieldsgroup_show', ['id' => $entity->getId()])); return $this->redirectToRoute('customfieldsgroup_show', ['id' => $entity->getId()]);
} }
$this->addFlash('error', $this->translator $this->addFlash('error', $this->translator
@ -157,7 +157,7 @@ class CustomFieldsGroupController extends AbstractController
$this->addFlash('success', $this->translator $this->addFlash('success', $this->translator
->trans('The default custom fields group has been changed')); ->trans('The default custom fields group has been changed'));
return $this->redirect($this->generateUrl('customfieldsgroup')); return $this->redirectToRoute('customfieldsgroup');
} }
/** /**
@ -261,13 +261,13 @@ class CustomFieldsGroupController extends AbstractController
$editForm = $this->createEditForm($entity); $editForm = $this->createEditForm($entity);
$editForm->handleRequest($request); $editForm->handleRequest($request);
if ($editForm->isValid()) { if ($editForm->isSubmitted() && $editForm->isValid()) {
$em->flush(); $em->flush();
$this->addFlash('success', $this->translator $this->addFlash('success', $this->translator
->trans('The custom fields group has been updated')); ->trans('The custom fields group has been updated'));
return $this->redirect($this->generateUrl('customfieldsgroup_edit', ['id' => $id])); return $this->redirectToRoute('customfieldsgroup_edit', ['id' => $id]);
} }
$this->addFlash('error', $this->translator $this->addFlash('error', $this->translator

View File

@ -95,12 +95,4 @@ class CustomFieldsGroupType extends AbstractType
'data_class' => CustomFieldsGroup::class, 'data_class' => CustomFieldsGroup::class,
]); ]);
} }
/**
* @return string
*/
public function getBlockPrefix()
{
return 'custom_fields_group';
}
} }

View File

@ -18,8 +18,8 @@ use Symfony\Component\Form\Extension\Core\Type\IntegerType;
*/ */
class PostTextIntegerExtension extends PostTextExtension class PostTextIntegerExtension extends PostTextExtension
{ {
public function getExtendedType() public function getExtendedTypes(): iterable
{ {
return IntegerType::class; return [IntegerType::class];
} }
} }

View File

@ -18,8 +18,8 @@ use Symfony\Component\Form\Extension\Core\Type\NumberType;
*/ */
class PostTextNumberExtension extends PostTextExtension class PostTextNumberExtension extends PostTextExtension
{ {
public function getExtendedType() public function getExtendedTypes(): iterable
{ {
return NumberType::class; return [NumberType::class];
} }
} }

View File

@ -53,9 +53,4 @@ class ChoiceWithOtherType extends AbstractType
'multiple' => false, 'multiple' => false,
]); ]);
} }
public function getBlockPrefix()
{
return 'choice_with_other';
}
} }

View File

@ -45,9 +45,4 @@ class CustomFieldType extends AbstractType
->setRequired(['group']) ->setRequired(['group'])
->addAllowedTypes('group', [\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class]); ->addAllowedTypes('group', [\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class]);
} }
public function getBlockPrefix()
{
return 'custom_field';
}
} }

View File

@ -114,7 +114,7 @@ class DocumentPersonController extends AbstractController
'element_id' => $document->getId(), 'element_id' => $document->getId(),
'action' => 'update', 'action' => 'update',
]); ]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); $this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
return $this->redirectToRoute( return $this->redirectToRoute(
'person_document_edit', 'person_document_edit',
@ -131,7 +131,7 @@ class DocumentPersonController extends AbstractController
'element_id' => $document->getId(), 'element_id' => $document->getId(),
'action' => 'edit', 'action' => 'edit',
]); ]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); $this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
return $this->render( return $this->render(
'ChillDocStoreBundle:PersonDocument:edit.html.twig', 'ChillDocStoreBundle:PersonDocument:edit.html.twig',
@ -204,7 +204,7 @@ class DocumentPersonController extends AbstractController
'element_id' => $document->getId(), 'element_id' => $document->getId(),
'action' => 'show', 'action' => 'show',
]); ]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); $this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
return $this->render( return $this->render(
'ChillDocStoreBundle:PersonDocument:show.html.twig', 'ChillDocStoreBundle:PersonDocument:show.html.twig',

View File

@ -84,11 +84,6 @@ class StoredObjectType extends AbstractType
->setAllowedTypes('has_title', ['bool']); ->setAllowedTypes('has_title', ['bool']);
} }
public function getBlockPrefix()
{
return 'stored_object';
}
public function reverseTransform($value) public function reverseTransform($value)
{ {
if (null === $value) { if (null === $value) {

View File

@ -205,7 +205,7 @@ class EventController extends AbstractController
'element_class' => Participation::class, 'element_class' => Participation::class,
'action' => 'list', 'action' => 'list',
]); ]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $privacyEvent); $this->eventDispatcher->dispatch($privacyEvent, PrivacyEvent::PERSON_PRIVACY_EVENT);
$addEventParticipationByPersonForm = $this->createAddEventParticipationByPersonForm($person); $addEventParticipationByPersonForm = $this->createAddEventParticipationByPersonForm($person);
@ -252,7 +252,7 @@ class EventController extends AbstractController
$this->addFlash('success', $this->get('translator') $this->addFlash('success', $this->get('translator')
->trans('The event was created')); ->trans('The event was created'));
return $this->redirect($this->generateUrl('chill_event__event_show', ['event_id' => $entity->getId()])); return $this->redirectToRoute('chill_event__event_show', ['event_id' => $entity->getId()]);
} }
return $this->render('ChillEventBundle:Event:new.html.twig', [ return $this->render('ChillEventBundle:Event:new.html.twig', [
@ -363,7 +363,7 @@ class EventController extends AbstractController
$this->addFlash('success', $this->get('translator') $this->addFlash('success', $this->get('translator')
->trans('The event was updated')); ->trans('The event was updated'));
return $this->redirect($this->generateUrl('chill_event__event_edit', ['event_id' => $event_id])); return $this->redirectToRoute('chill_event__event_edit', ['event_id' => $event_id]);
} }
return $this->render('ChillEventBundle:Event:edit.html.twig', [ return $this->render('ChillEventBundle:Event:edit.html.twig', [

View File

@ -31,15 +31,12 @@ class EventTypeController extends AbstractController
$form = $this->createCreateForm($entity); $form = $this->createCreateForm($entity);
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->persist($entity); $em->persist($entity);
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl( return $this->redirectToRoute('chill_eventtype_admin', ['id' => $entity->getId()]);
'chill_eventtype_admin',
['id' => $entity->getId()]
));
} }
return $this->render('ChillEventBundle:EventType:new.html.twig', [ return $this->render('ChillEventBundle:EventType:new.html.twig', [
@ -56,7 +53,7 @@ class EventTypeController extends AbstractController
$form = $this->createDeleteForm($id); $form = $this->createDeleteForm($id);
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\EventType::class)->find($id); $entity = $em->getRepository(\Chill\EventBundle\Entity\EventType::class)->find($id);
@ -68,7 +65,7 @@ class EventTypeController extends AbstractController
$em->flush(); $em->flush();
} }
return $this->redirect($this->generateUrl('chill_eventtype_admin')); return $this->redirectToRoute('chill_eventtype_admin');
} }
/** /**
@ -160,13 +157,10 @@ class EventTypeController extends AbstractController
$editForm = $this->createEditForm($entity); $editForm = $this->createEditForm($entity);
$editForm->handleRequest($request); $editForm->handleRequest($request);
if ($editForm->isValid()) { if ($editForm->isSubmitted() && $editForm->isValid()) {
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl( return $this->redirectToRoute('chill_eventtype_admin', ['id' => $id]);
'chill_eventtype_admin',
['id' => $id]
));
} }
return $this->render('ChillEventBundle:EventType:edit.html.twig', [ return $this->render('ChillEventBundle:EventType:edit.html.twig', [

View File

@ -31,15 +31,12 @@ class RoleController extends AbstractController
$form = $this->createCreateForm($entity); $form = $this->createCreateForm($entity);
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->persist($entity); $em->persist($entity);
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl( return $this->redirectToRoute('chill_event_admin_role', ['id' => $entity->getId()]);
'chill_event_admin_role',
['id' => $entity->getId()]
));
} }
return $this->render('ChillEventBundle:Role:new.html.twig', [ return $this->render('ChillEventBundle:Role:new.html.twig', [
@ -56,7 +53,7 @@ class RoleController extends AbstractController
$form = $this->createDeleteForm($id); $form = $this->createDeleteForm($id);
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Role::class)->find($id); $entity = $em->getRepository(\Chill\EventBundle\Entity\Role::class)->find($id);
@ -68,7 +65,7 @@ class RoleController extends AbstractController
$em->flush(); $em->flush();
} }
return $this->redirect($this->generateUrl('chill_event_admin_role')); return $this->redirectToRoute('chill_event_admin_role');
} }
/** /**
@ -160,13 +157,10 @@ class RoleController extends AbstractController
$editForm = $this->createEditForm($entity); $editForm = $this->createEditForm($entity);
$editForm->handleRequest($request); $editForm->handleRequest($request);
if ($editForm->isValid()) { if ($editForm->isSubmitted() && $editForm->isValid()) {
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl( return $this->redirectToRoute('chill_event_admin_role', ['id' => $id]);
'chill_event_admin_role',
['id' => $id]
));
} }
return $this->render('ChillEventBundle:Role:edit.html.twig', [ return $this->render('ChillEventBundle:Role:edit.html.twig', [

View File

@ -31,12 +31,12 @@ class StatusController extends AbstractController
$form = $this->createCreateForm($entity); $form = $this->createCreateForm($entity);
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->persist($entity); $em->persist($entity);
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl('chill_event_admin_status', ['id' => $entity->getId()])); return $this->redirectToRoute('chill_event_admin_status', ['id' => $entity->getId()]);
} }
return $this->render('ChillEventBundle:Status:new.html.twig', [ return $this->render('ChillEventBundle:Status:new.html.twig', [
@ -53,7 +53,7 @@ class StatusController extends AbstractController
$form = $this->createDeleteForm($id); $form = $this->createDeleteForm($id);
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Status::class)->find($id); $entity = $em->getRepository(\Chill\EventBundle\Entity\Status::class)->find($id);
@ -65,7 +65,7 @@ class StatusController extends AbstractController
$em->flush(); $em->flush();
} }
return $this->redirect($this->generateUrl('chill_event_admin_status')); return $this->redirectToRoute('chill_event_admin_status');
} }
/** /**
@ -157,10 +157,10 @@ class StatusController extends AbstractController
$editForm = $this->createEditForm($entity); $editForm = $this->createEditForm($entity);
$editForm->handleRequest($request); $editForm->handleRequest($request);
if ($editForm->isValid()) { if ($editForm->isSubmitted() && $editForm->isValid()) {
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl('chill_event_admin_status', ['id' => $id])); return $this->redirectToRoute('chill_event_admin_status', ['id' => $id]);
} }
return $this->render('ChillEventBundle:Status:edit.html.twig', [ return $this->render('ChillEventBundle:Status:edit.html.twig', [

View File

@ -65,7 +65,7 @@ class EventType extends AbstractType
/** /**
* @return string * @return string
*/ */
public function getName() public function getBlockPrefix()
{ {
return 'chill_eventbundle_event'; return 'chill_eventbundle_event';
} }

View File

@ -28,12 +28,12 @@ class EventTypeType extends AbstractType
/** /**
* @return string * @return string
*/ */
public function getName() public function getBlockPrefix()
{ {
return 'chill_eventbundle_eventtype'; return 'chill_eventbundle_eventtype';
} }
public function setDefaultOptions(OptionsResolverInterface $resolver) public function configureOptions(\Symfony\Component\OptionsResolver\OptionsResolver $resolver)
{ {
$resolver->setDefaults([ $resolver->setDefaults([
'data_class' => \Chill\EventBundle\Entity\EventType::class, 'data_class' => \Chill\EventBundle\Entity\EventType::class,

View File

@ -40,12 +40,12 @@ final class RoleType extends AbstractType
/** /**
* @return string * @return string
*/ */
public function getName() public function getBlockPrefix()
{ {
return 'chill_eventbundle_role'; return 'chill_eventbundle_role';
} }
public function setDefaultOptions(OptionsResolverInterface $resolver) public function configureOptions(\Symfony\Component\OptionsResolver\OptionsResolver $resolver)
{ {
$resolver->setDefaults([ $resolver->setDefaults([
'data_class' => \Chill\EventBundle\Entity\Role::class, 'data_class' => \Chill\EventBundle\Entity\Role::class,

View File

@ -30,12 +30,12 @@ class StatusType extends AbstractType
/** /**
* @return string * @return string
*/ */
public function getName() public function getBlockPrefix()
{ {
return 'chill_eventbundle_status'; return 'chill_eventbundle_status';
} }
public function setDefaultOptions(OptionsResolverInterface $resolver) public function configureOptions(\Symfony\Component\OptionsResolver\OptionsResolver $resolver)
{ {
$resolver->setDefaults([ $resolver->setDefaults([
'data_class' => \Chill\EventBundle\Entity\Status::class, 'data_class' => \Chill\EventBundle\Entity\Status::class,

View File

@ -60,7 +60,7 @@ final class PickRoleType extends AbstractType
$form = $event->getForm(); $form = $event->getForm();
$name = $form->getName(); $name = $form->getName();
$config = $form->getConfig(); $config = $form->getConfig();
$type = $config->getType()->getName(); $type = $config->getType()->getBlockPrefix();
$options = $config->getOptions(); $options = $config->getOptions();
$form->getParent()->add($name, $type, array_replace($options, [ $form->getParent()->add($name, $type, array_replace($options, [

View File

@ -60,7 +60,7 @@ final class PickStatusType extends AbstractType
$form = $event->getForm(); $form = $event->getForm();
$name = $form->getName(); $name = $form->getName();
$config = $form->getConfig(); $config = $form->getConfig();
$type = $config->getType()->getName(); $type = $config->getType()->getBlockPrefix();
$options = $config->getOptions(); $options = $config->getOptions();
$form->getParent()->add($name, $type, array_replace($options, [ $form->getParent()->add($name, $type, array_replace($options, [
'group_by' => fn (Status $s) => $this->translatableStringHelper->localize($s->getType()->getName()), 'group_by' => fn (Status $s) => $this->translatableStringHelper->localize($s->getType()->getName()),

View File

@ -24,7 +24,7 @@ use function in_array;
final class ParticipationControllerTest extends WebTestCase final class ParticipationControllerTest extends WebTestCase
{ {
/** /**
* @var \Symfony\Component\BrowserKit\Client * @var \Symfony\Component\BrowserKit\AbstractBrowser
*/ */
protected $client; protected $client;

View File

@ -33,7 +33,7 @@ final class EventSearchTest extends WebTestCase
protected $centerA; protected $centerA;
/** /**
* @var \Symfony\Component\BrowserKit\Client * @var \Symfony\Component\BrowserKit\AbstractBrowser
*/ */
protected $client; protected $client;

View File

@ -2,7 +2,7 @@ services:
Chill\EventBundle\Controller\EventController: Chill\EventBundle\Controller\EventController:
arguments: arguments:
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface' $eventDispatcher: '@Symfony\Contracts\EventDispatcher\EventDispatcherInterface'
$authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper' $authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
$formFactoryInterface: '@Symfony\Component\Form\FormFactoryInterface' $formFactoryInterface: '@Symfony\Component\Form\FormFactoryInterface'
$translator: '@Symfony\Contracts\Translation\TranslatorInterface' $translator: '@Symfony\Contracts\Translation\TranslatorInterface'

View File

@ -66,16 +66,16 @@ class ChillMainBundle extends Bundle
$container->registerForAutoconfiguration(ViewEntityInfoProviderInterface::class) $container->registerForAutoconfiguration(ViewEntityInfoProviderInterface::class)
->addTag('chill_main.entity_info_provider'); ->addTag('chill_main.entity_info_provider');
$container->addCompilerPass(new SearchableServicesCompilerPass()); $container->addCompilerPass(new SearchableServicesCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
$container->addCompilerPass(new ConfigConsistencyCompilerPass()); $container->addCompilerPass(new ConfigConsistencyCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
$container->addCompilerPass(new TimelineCompilerClass()); $container->addCompilerPass(new TimelineCompilerClass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
$container->addCompilerPass(new RoleProvidersCompilerPass()); $container->addCompilerPass(new RoleProvidersCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
$container->addCompilerPass(new ExportsCompilerPass()); $container->addCompilerPass(new ExportsCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
$container->addCompilerPass(new WidgetsCompilerPass()); $container->addCompilerPass(new WidgetsCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
$container->addCompilerPass(new NotificationCounterCompilerPass()); $container->addCompilerPass(new NotificationCounterCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
$container->addCompilerPass(new MenuCompilerPass()); $container->addCompilerPass(new MenuCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
$container->addCompilerPass(new ACLFlagsCompilerPass()); $container->addCompilerPass(new ACLFlagsCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
$container->addCompilerPass(new CRUDControllerCompilerPass()); $container->addCompilerPass(new CRUDControllerCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
$container->addCompilerPass(new ShortMessageCompilerPass()); $container->addCompilerPass(new ShortMessageCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
} }
} }

View File

@ -88,7 +88,7 @@ class LoadAndUpdateLanguagesCommand extends Command
$languages = []; $languages = [];
foreach ($chillAvailableLanguages as $avLang) { foreach ($chillAvailableLanguages as $avLang) {
$languages[$avLang] = $languageBundle->getLanguageNames($avLang); $languages[$avLang] = \Symfony\Component\Intl\Languages::getNames();
} }
$languageCodes = array_keys($languages[$chillAvailableLanguages[0]]); $languageCodes = array_keys($languages[$chillAvailableLanguages[0]]);
@ -125,7 +125,7 @@ class LoadAndUpdateLanguagesCommand extends Command
if ($langageDB) { if ($langageDB) {
$em->remove($langageDB); $em->remove($langageDB);
} }
echo 'Code excluded : ' . $code . ' - ' . $languageBundle->getLanguageName($code) . "\n"; echo 'Code excluded : ' . $code . ' - ' . \Symfony\Component\Intl\Languages::getName() . "\n";
} }
} }

View File

@ -36,7 +36,7 @@ class LoadCountriesCommand extends Command
$countries = []; $countries = [];
foreach ($languages as $language) { foreach ($languages as $language) {
$countries[$language] = $regionBundle->getCountryNames($language); $countries[$language] = \Symfony\Component\Intl\Currencies::getNames();
} }
$countryEntities = []; $countryEntities = [];

View File

@ -36,7 +36,7 @@ class AbsenceController extends AbstractController
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl('chill_main_user_absence_index')); return $this->redirectToRoute('chill_main_user_absence_index');
} }
return $this->render('@ChillMain/Menu/absence.html.twig', [ return $this->render('@ChillMain/Menu/absence.html.twig', [
@ -60,6 +60,6 @@ class AbsenceController extends AbstractController
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl('chill_main_user_absence_index')); return $this->redirectToRoute('chill_main_user_absence_index');
} }
} }

View File

@ -31,12 +31,12 @@ class CenterController extends AbstractController
$form = $this->createCreateForm($center); $form = $this->createCreateForm($center);
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->persist($center); $em->persist($center);
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl('admin_center')); return $this->redirectToRoute('admin_center');
} }
return $this->render('@ChillMain/Center/new.html.twig', [ return $this->render('@ChillMain/Center/new.html.twig', [
@ -128,10 +128,10 @@ class CenterController extends AbstractController
$editForm = $this->createEditForm($center); $editForm = $this->createEditForm($center);
$editForm->handleRequest($request); $editForm->handleRequest($request);
if ($editForm->isValid()) { if ($editForm->isSubmitted() && $editForm->isValid()) {
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl('admin_center_edit', ['id' => $id])); return $this->redirectToRoute('admin_center_edit', ['id' => $id]);
} }
return $this->render('@ChillMain/Center/edit.html.twig', [ return $this->render('@ChillMain/Center/edit.html.twig', [

View File

@ -29,7 +29,7 @@ class DefaultController extends AbstractController
public function indexWithoutLocaleAction() public function indexWithoutLocaleAction()
{ {
return $this->redirect($this->generateUrl('chill_main_homepage')); return $this->redirectToRoute('chill_main_homepage');
} }
public function testAction() public function testAction()

View File

@ -361,13 +361,11 @@ class ExportController extends AbstractController
$this->session->set('export_step', $data); $this->session->set('export_step', $data);
//redirect to next step //redirect to next step
return $this->redirect( return $this->redirectToRoute('chill_main_export_new', [
$this->generateUrl('chill_main_export_new', [ 'step' => $this->getNextStep('export', $export),
'step' => $this->getNextStep('export', $export), 'alias' => $alias,
'alias' => $alias, 'from_saved' => $request->get('from_saved', '')
'from_saved' => $request->get('from_saved', '') ]);
])
);
} }
$this->logger->debug('form export is invalid', [ $this->logger->debug('form export is invalid', [
'location' => __METHOD__, ]); 'location' => __METHOD__, ]);
@ -413,14 +411,11 @@ class ExportController extends AbstractController
); );
//redirect to next step //redirect to next step
return $this->redirect($this->generateUrl( return $this->redirectToRoute('chill_main_export_new', [
'chill_main_export_new', 'alias' => $alias,
[ 'step' => $this->getNextStep('formatter', $export),
'alias' => $alias, 'from_saved' => $request->get('from_saved', ''),
'step' => $this->getNextStep('formatter', $export), ]);
'from_saved' => $request->get('from_saved', ''),
]
));
} }
} }

View File

@ -114,8 +114,8 @@ class PasswordController extends AbstractController
if (null === $user) { if (null === $user) {
$this->eventDispatcher->dispatch( $this->eventDispatcher->dispatch(
PasswordRecoverEvent::INVALID_TOKEN, new PasswordRecoverEvent($token, null, $request->getClientIp()),
new PasswordRecoverEvent($token, null, $request->getClientIp()) PasswordRecoverEvent::INVALID_TOKEN
); );
throw $this->createNotFoundException(sprintf('User %s not found', $username)); throw $this->createNotFoundException(sprintf('User %s not found', $username));
@ -123,8 +123,8 @@ class PasswordController extends AbstractController
if (true !== $this->tokenManager->verify($hash, $token, $user, $timestamp)) { if (true !== $this->tokenManager->verify($hash, $token, $user, $timestamp)) {
$this->eventDispatcher->dispatch( $this->eventDispatcher->dispatch(
PasswordRecoverEvent::INVALID_TOKEN, new PasswordRecoverEvent($token, $user, $request->getClientIp()),
new PasswordRecoverEvent($token, $user, $request->getClientIp()) PasswordRecoverEvent::INVALID_TOKEN
); );
return new Response('Invalid token', Response::HTTP_FORBIDDEN); return new Response('Invalid token', Response::HTTP_FORBIDDEN);
@ -214,16 +214,16 @@ class PasswordController extends AbstractController
); );
$this->eventDispatcher->dispatch( $this->eventDispatcher->dispatch(
PasswordRecoverEvent::ASK_TOKEN_SUCCESS, new PasswordRecoverEvent(null, $user, $request->getClientIp()),
new PasswordRecoverEvent(null, $user, $request->getClientIp()) PasswordRecoverEvent::ASK_TOKEN_SUCCESS
); );
return $this->redirectToRoute('password_request_recover_confirm'); return $this->redirectToRoute('password_request_recover_confirm');
} }
} elseif ($form->isSubmitted() && false === $form->isValid()) { } elseif ($form->isSubmitted() && false === $form->isValid()) {
$this->eventDispatcher->dispatch( $this->eventDispatcher->dispatch(
PasswordRecoverEvent::ASK_TOKEN_INVALID_FORM, new PasswordRecoverEvent(null, null, $request->getClientIp()),
new PasswordRecoverEvent(null, null, $request->getClientIp()) PasswordRecoverEvent::ASK_TOKEN_INVALID_FORM
); );
} }

View File

@ -83,10 +83,7 @@ final class PermissionsGroupController extends AbstractController
$this->translator->trans('The permissions have been added') $this->translator->trans('The permissions have been added')
); );
return $this->redirect($this->generateUrl( return $this->redirectToRoute('admin_permissionsgroup_edit', ['id' => $id]);
'admin_permissionsgroup_edit',
['id' => $id]
));
} }
foreach ($violations as $error) { foreach ($violations as $error) {
@ -146,10 +143,7 @@ final class PermissionsGroupController extends AbstractController
$this->em->persist($permissionsGroup); $this->em->persist($permissionsGroup);
$this->em->flush(); $this->em->flush();
return $this->redirect($this->generateUrl( return $this->redirectToRoute('admin_permissionsgroup_edit', ['id' => $permissionsGroup->getId()]);
'admin_permissionsgroup_edit',
['id' => $permissionsGroup->getId()]
));
} }
return $this->render('@ChillMain/PermissionsGroup/new.html.twig', [ return $this->render('@ChillMain/PermissionsGroup/new.html.twig', [
@ -187,10 +181,7 @@ final class PermissionsGroupController extends AbstractController
]) ])
); );
return $this->redirect($this->generateUrl( return $this->redirectToRoute('admin_permissionsgroup_edit', ['id' => $pgid]);
'admin_permissionsgroup_edit',
['id' => $pgid]
));
} }
$this->em->flush(); $this->em->flush();
@ -214,10 +205,7 @@ final class PermissionsGroupController extends AbstractController
); );
} }
return $this->redirect($this->generateUrl( return $this->redirectToRoute('admin_permissionsgroup_edit', ['id' => $pgid]);
'admin_permissionsgroup_edit',
['id' => $pgid]
));
} }
/** /**
@ -362,7 +350,7 @@ final class PermissionsGroupController extends AbstractController
if ($editForm->isValid()) { if ($editForm->isValid()) {
$this->em->flush(); $this->em->flush();
return $this->redirect($this->generateUrl('admin_permissionsgroup_edit', ['id' => $id])); return $this->redirectToRoute('admin_permissionsgroup_edit', ['id' => $id]);
} }
$deleteRoleScopesForm = []; $deleteRoleScopesForm = [];

View File

@ -31,12 +31,12 @@ class ScopeController extends AbstractController
$form = $this->createCreateForm($scope); $form = $this->createCreateForm($scope);
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->persist($scope); $em->persist($scope);
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl('admin_scope')); return $this->redirectToRoute('admin_scope');
} }
return $this->render('@ChillMain/Scope/new.html.twig', [ return $this->render('@ChillMain/Scope/new.html.twig', [
@ -128,10 +128,10 @@ class ScopeController extends AbstractController
$editForm = $this->createEditForm($scope); $editForm = $this->createEditForm($scope);
$editForm->handleRequest($request); $editForm->handleRequest($request);
if ($editForm->isValid()) { if ($editForm->isSubmitted() && $editForm->isValid()) {
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl('admin_scope_edit', ['id' => $id])); return $this->redirectToRoute('admin_scope_edit', ['id' => $id]);
} }
return $this->render('@ChillMain/Scope/edit.html.twig', [ return $this->render('@ChillMain/Scope/edit.html.twig', [

View File

@ -74,10 +74,7 @@ class UserController extends CRUDController
$returnPathParams = $request->query->has('returnPath') ? $returnPathParams = $request->query->has('returnPath') ?
['returnPath' => $request->query->get('returnPath')] : []; ['returnPath' => $request->query->get('returnPath')] : [];
return $this->redirect($this->generateUrl( return $this->redirectToRoute('chill_crud_admin_user_edit', array_merge(['id' => $uid], $returnPathParams));
'chill_crud_admin_user_edit',
array_merge(['id' => $uid], $returnPathParams)
));
} }
foreach ($this->validator->validate($user) as $error) { foreach ($this->validator->validate($user) as $error) {
@ -123,7 +120,7 @@ class UserController extends CRUDController
} catch (RuntimeException $ex) { } catch (RuntimeException $ex) {
$this->addFlash('error', $this->get('translator')->trans($ex->getMessage())); $this->addFlash('error', $this->get('translator')->trans($ex->getMessage()));
return $this->redirect($this->generateUrl('chill_crud_admin_user_edit', ['id' => $uid])); return $this->redirectToRoute('chill_crud_admin_user_edit', ['id' => $uid]);
} }
$em->flush(); $em->flush();
@ -131,7 +128,7 @@ class UserController extends CRUDController
$this->addFlash('success', $this->get('translator') $this->addFlash('success', $this->get('translator')
->trans('The permissions where removed.')); ->trans('The permissions where removed.'));
return $this->redirect($this->generateUrl('chill_crud_admin_user_edit', ['id' => $uid])); return $this->redirectToRoute('chill_crud_admin_user_edit', ['id' => $uid]);
} }
public function edit(Request $request, $id): Response public function edit(Request $request, $id): Response

View File

@ -48,7 +48,7 @@ class LoadLanguages extends AbstractFixture implements ContainerAwareInterface,
{ {
echo "loading languages... \n"; echo "loading languages... \n";
foreach (Intl::getLanguageBundle()->getLanguageNames() as $code => $language) { foreach (\Symfony\Component\Intl\Languages::getNames() as $code => $language) {
if ( if (
!in_array($code, $this->regionalVersionToInclude, true) !in_array($code, $this->regionalVersionToInclude, true)
&& !in_array($code, $this->ancientToExclude, true) && !in_array($code, $this->ancientToExclude, true)
@ -78,7 +78,7 @@ class LoadLanguages extends AbstractFixture implements ContainerAwareInterface,
$names = []; $names = [];
foreach ($this->container->getParameter('chill_main.available_languages') as $lang) { foreach ($this->container->getParameter('chill_main.available_languages') as $lang) {
$names[$lang] = Intl::getLanguageBundle()->getLanguageName($languageCode); $names[$lang] = \Symfony\Component\Intl\Languages::getName();
} }
return $names; return $names;

View File

@ -13,7 +13,7 @@ namespace Chill\MainBundle\Form\Event;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
class CustomizeFormEvent extends \Symfony\Component\EventDispatcher\Event class CustomizeFormEvent extends \Symfony\Contracts\EventDispatcher\Event
{ {
final public const NAME = 'chill_main.customize_form'; final public const NAME = 'chill_main.customize_form';

View File

@ -29,11 +29,6 @@ class Select2ChoiceType extends AbstractType
); );
} }
public function getBlockPrefix()
{
return 'select2_choice';
}
public function getParent() public function getParent()
{ {
return ChoiceType::class; return ChoiceType::class;

View File

@ -27,11 +27,6 @@ class Select2EntityType extends AbstractType
); );
} }
public function getBlockPrefix()
{
return 'select2_entity';
}
public function getParent() public function getParent()
{ {
return EntityType::class; return EntityType::class;

View File

@ -14,7 +14,7 @@ namespace Chill\MainBundle\Security\PasswordRecover;
use Chill\MainBundle\Entity\User; use Chill\MainBundle\Entity\User;
use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\Event;
class PasswordRecoverEvent extends Event class PasswordRecoverEvent extends \Symfony\Contracts\EventDispatcher\Event
{ {
final public const ASK_TOKEN_INVALID_FORM = 'chill_main.ask_token_invalid_form'; final public const ASK_TOKEN_INVALID_FORM = 'chill_main.ask_token_invalid_form';

View File

@ -30,7 +30,7 @@ use Symfony\Component\EventDispatcher\Event;
* The keys are read-only: if you try to update the context using array access * The keys are read-only: if you try to update the context using array access
* (example, using `$event['context_key'] = $bar;`, an error will be thrown. * (example, using `$event['context_key'] = $bar;`, an error will be thrown.
*/ */
class DelegatedBlockRenderingEvent extends Event implements ArrayAccess class DelegatedBlockRenderingEvent extends \Symfony\Contracts\EventDispatcher\Event implements ArrayAccess
{ {
/** /**
* The returned content of the event. * The returned content of the event.

View File

@ -128,7 +128,7 @@ class WidgetRenderingTwig extends AbstractExtension
// for old rendering events (deprecated) // for old rendering events (deprecated)
$event = new DelegatedBlockRenderingEvent($context); $event = new DelegatedBlockRenderingEvent($context);
$this->eventDispatcher->dispatch('chill_block.' . $block, $event); $this->eventDispatcher->dispatch($event, 'chill_block.' . $block);
return $content . ' ' . $event->getContent(); return $content . ' ' . $event->getContent();
} }

View File

@ -22,7 +22,7 @@ class TestHelper
* create a client authenticated with an user. * create a client authenticated with an user.
* *
* *
* @return \Symfony\Component\BrowserKit\Client authenticated client * @return \Symfony\Component\BrowserKit\AbstractBrowser authenticated client
*/ */
public static function getAuthenticatedClientOptions( public static function getAuthenticatedClientOptions(
mixed $username = 'center a_social', mixed $username = 'center a_social',

View File

@ -12,7 +12,7 @@ services:
$logger: '@Psr\Log\LoggerInterface' $logger: '@Psr\Log\LoggerInterface'
$em: '@Doctrine\ORM\EntityManagerInterface' $em: '@Doctrine\ORM\EntityManagerInterface'
$recoverPasswordHelper: '@Chill\MainBundle\Security\PasswordRecover\RecoverPasswordHelper' $recoverPasswordHelper: '@Chill\MainBundle\Security\PasswordRecover\RecoverPasswordHelper'
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface' $eventDispatcher: '@Symfony\Contracts\EventDispatcher\EventDispatcherInterface'
tags: tags:
- { name: console.command } - { name: console.command }

View File

@ -33,6 +33,10 @@ class Version20150821105642 extends AbstractMigration implements \Symfony\Compon
* @var ContainerInterface * @var ContainerInterface
*/ */
private $container; private $container;
public function __construct(\Doctrine\DBAL\Connection $connection, \Psr\Log\LoggerInterface $logger, private \Doctrine\ORM\EntityManager $entityManager)
{
parent::__construct($connection, $logger);
}
public function down(Schema $schema): void public function down(Schema $schema): void
{ {
@ -56,7 +60,7 @@ class Version20150821105642 extends AbstractMigration implements \Symfony\Compon
*/ */
return; return;
//transform data from groupcenter_permissionsgroup table //transform data from groupcenter_permissionsgroup table
$em = $this->container->get('doctrine.orm.entity_manager'); $em = $this->entityManager;
//get all existing associations //get all existing associations
$rsm = new ResultSetMapping(); $rsm = new ResultSetMapping();

View File

@ -16,7 +16,7 @@ use Symfony\Component\EventDispatcher\Event;
/** /**
* Event triggered when an entity attached to a person is removed. * Event triggered when an entity attached to a person is removed.
*/ */
class ActionEvent extends Event class ActionEvent extends \Symfony\Contracts\EventDispatcher\Event
{ {
final public const DELETE = 'CHILL_PERSON.DELETE_ASSOCIATED_ENTITY'; final public const DELETE = 'CHILL_PERSON.DELETE_ASSOCIATED_ENTITY';

View File

@ -100,7 +100,7 @@ class PersonMove
$sql, $sql,
['to' => $to->getId(), 'original_action' => 'move'] ['to' => $to->getId(), 'original_action' => 'move']
); );
$this->eventDispatcher->dispatch(ActionEvent::DELETE, $event); $this->eventDispatcher->dispatch($event, ActionEvent::DELETE);
} else { } else {
$sql = $this->createMoveSQL($metadata, $from, $to, $field); $sql = $this->createMoveSQL($metadata, $from, $to, $field);
$event = new ActionEvent( $event = new ActionEvent(
@ -109,7 +109,7 @@ class PersonMove
$sql, $sql,
['to' => $to->getId(), 'original_action' => 'move'] ['to' => $to->getId(), 'original_action' => 'move']
); );
$this->eventDispatcher->dispatch(ActionEvent::MOVE, $event); $this->eventDispatcher->dispatch($event, ActionEvent::MOVE);
} }
$sqls = array_merge($sqls, $event->getPreSql(), [$event->getSqlStatement()], $event->getPostSql()); $sqls = array_merge($sqls, $event->getPreSql(), [$event->getSqlStatement()], $event->getPostSql());

View File

@ -26,7 +26,7 @@ class ChillPersonBundle extends Bundle
$container->getExtension('chill_main') $container->getExtension('chill_main')
->addWidgetFactory(new PersonListWidgetFactory()); ->addWidgetFactory(new PersonListWidgetFactory());
$container->addCompilerPass(new AccompanyingPeriodTimelineCompilerPass()); $container->addCompilerPass(new AccompanyingPeriodTimelineCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
$container->registerForAutoconfiguration(AccompanyingPeriodInfoUnionQueryPartInterface::class) $container->registerForAutoconfiguration(AccompanyingPeriodInfoUnionQueryPartInterface::class)
->addTag('chill_person.accompanying_period_info_part'); ->addTag('chill_person.accompanying_period_info_part');
} }

View File

@ -335,11 +335,11 @@ final class AccompanyingCourseApiController extends ApiController
protected function onPostCheckACL(string $action, Request $request, string $_format, $entity): ?Response protected function onPostCheckACL(string $action, Request $request, string $_format, $entity): ?Response
{ {
$this->eventDispatcher->dispatch( $this->eventDispatcher->dispatch(
AccompanyingPeriodPrivacyEvent::ACCOMPANYING_PERIOD_PRIVACY_EVENT,
new AccompanyingPeriodPrivacyEvent($entity, [ new AccompanyingPeriodPrivacyEvent($entity, [
'action' => $action, 'action' => $action,
'request' => $request->getMethod(), 'request' => $request->getMethod(),
]) ]),
AccompanyingPeriodPrivacyEvent::ACCOMPANYING_PERIOD_PRIVACY_EVENT
); );
return null; return null;

View File

@ -39,7 +39,7 @@ use function is_array;
/** /**
* Class AccompanyingCourseController. * Class AccompanyingCourseController.
*/ */
class AccompanyingCourseController extends Controller class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController
{ {
public function __construct(protected SerializerInterface $serializer, protected EventDispatcherInterface $dispatcher, protected ValidatorInterface $validator, private readonly AccompanyingPeriodWorkRepository $workRepository, private readonly Registry $registry, private readonly TranslatorInterface $translator) public function __construct(protected SerializerInterface $serializer, protected EventDispatcherInterface $dispatcher, protected ValidatorInterface $validator, private readonly AccompanyingPeriodWorkRepository $workRepository, private readonly Registry $registry, private readonly TranslatorInterface $translator)
{ {

View File

@ -72,11 +72,9 @@ class AccompanyingPeriodController extends AbstractController
['%name%' => $person->__toString()] ['%name%' => $person->__toString()]
)); ));
return $this->redirect( return $this->redirectToRoute('chill_person_accompanying_period_list', [
$this->generateUrl('chill_person_accompanying_period_list', [ 'person_id' => $person->getId(),
'person_id' => $person->getId(), ]);
])
);
} }
$current = $person->getCurrentAccompanyingPeriod(); $current = $person->getCurrentAccompanyingPeriod();
@ -102,11 +100,9 @@ class AccompanyingPeriodController extends AbstractController
$this->getDoctrine()->getManager()->flush(); $this->getDoctrine()->getManager()->flush();
return $this->redirect( return $this->redirectToRoute('chill_person_accompanying_period_list', [
$this->generateUrl('chill_person_accompanying_period_list', [ 'person_id' => $person->getId(),
'person_id' => $person->getId(), ]);
])
);
} }
$this->get('session')->getFlashBag() $this->get('session')->getFlashBag()
->add('error', $this->get('translator') ->add('error', $this->get('translator')
@ -182,11 +178,9 @@ class AccompanyingPeriodController extends AbstractController
) )
); );
return $this->redirect( return $this->redirectToRoute('chill_person_accompanying_period_list', [
$this->generateUrl('chill_person_accompanying_period_list', [ 'person_id' => $person->getId(),
'person_id' => $person->getId(), ]);
])
);
} }
$flashBag->add('error', $this->get('translator') $flashBag->add('error', $this->get('translator')
->trans('Error! Period not created!')); ->trans('Error! Period not created!'));
@ -214,7 +208,7 @@ class AccompanyingPeriodController extends AbstractController
'element_class' => AccompanyingPeriod::class, 'element_class' => AccompanyingPeriod::class,
'action' => 'list', 'action' => 'list',
]); ]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); $this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
$accompanyingPeriods = $this->accompanyingPeriodACLAwareRepository $accompanyingPeriods = $this->accompanyingPeriodACLAwareRepository
->findByPerson($person, AccompanyingPeriodVoter::SEE, ["openingDate" => "DESC", "id" => "DESC"]); ->findByPerson($person, AccompanyingPeriodVoter::SEE, ["openingDate" => "DESC", "id" => "DESC"]);
@ -249,11 +243,9 @@ class AccompanyingPeriodController extends AbstractController
['%name%' => $person->__toString()] ['%name%' => $person->__toString()]
)); ));
return $this->redirect( return $this->redirectToRoute('chill_person_accompanying_period_list', [
$this->generateUrl('chill_person_accompanying_period_list', [ 'person_id' => $person->getId(),
'person_id' => $person->getId(), ]);
])
);
} }
$accompanyingPeriod = new AccompanyingPeriod(new DateTime()); $accompanyingPeriod = new AccompanyingPeriod(new DateTime());
@ -285,11 +277,9 @@ class AccompanyingPeriodController extends AbstractController
$this->getDoctrine()->getManager()->flush(); $this->getDoctrine()->getManager()->flush();
return $this->redirect( return $this->redirectToRoute('chill_person_accompanying_period_list', [
$this->generateUrl('chill_person_accompanying_period_list', [ 'person_id' => $person->getId(),
'person_id' => $person->getId(), ]);
])
);
} }
$this->get('session')->getFlashBag() $this->get('session')->getFlashBag()
->add('error', $this->get('translator') ->add('error', $this->get('translator')
@ -414,11 +404,9 @@ class AccompanyingPeriodController extends AbstractController
$this->get('translator')->trans('An accompanying period has been updated.') $this->get('translator')->trans('An accompanying period has been updated.')
); );
return $this->redirect( return $this->redirectToRoute('chill_person_accompanying_period_list', [
$this->generateUrl('chill_person_accompanying_period_list', [ 'person_id' => $person->getId(),
'person_id' => $person->getId(), ]);
])
);
} }
$flashBag->add('error', $this->get('translator') $flashBag->add('error', $this->get('translator')

View File

@ -143,7 +143,7 @@ final class PersonController extends AbstractController
); );
$event = new PrivacyEvent($person); $event = new PrivacyEvent($person);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); $this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
return $this->render( return $this->render(
'@ChillPerson/Person/household_history.html.twig', '@ChillPerson/Person/household_history.html.twig',
@ -272,7 +272,7 @@ final class PersonController extends AbstractController
); );
$event = new PrivacyEvent($person); $event = new PrivacyEvent($person);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); $this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
return $this->render( return $this->render(
'ChillPersonBundle:Person:view.html.twig', 'ChillPersonBundle:Person:view.html.twig',

View File

@ -32,7 +32,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
use function count; use function count;
class PersonDuplicateController extends Controller class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController
{ {
public function __construct(private readonly SimilarPersonMatcher $similarPersonMatcher, private readonly TranslatorInterface $translator, private readonly PersonRepository $personRepository, private readonly PersonMove $personMove, private readonly EventDispatcherInterface $eventDispatcher) public function __construct(private readonly SimilarPersonMatcher $similarPersonMatcher, private readonly TranslatorInterface $translator, private readonly PersonRepository $personRepository, private readonly PersonMove $personMove, private readonly EventDispatcherInterface $eventDispatcher)
{ {
@ -76,7 +76,7 @@ class PersonDuplicateController extends Controller
'action' => 'move', 'action' => 'move',
]); ]);
$event->addPerson($person2); $event->addPerson($person2);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); $this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
$sqls = $this->personMove->getSQL($person2, $person1); $sqls = $this->personMove->getSQL($person2, $person1);

View File

@ -46,7 +46,7 @@ class TimelinePersonController extends AbstractController
$paginator = $this->paginatorFactory->create($nbItems); $paginator = $this->paginatorFactory->create($nbItems);
$event = new PrivacyEvent($person, ['action' => 'timeline']); $event = new PrivacyEvent($person, ['action' => 'timeline']);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); $this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
return $this->render( return $this->render(
'ChillPersonBundle:Timeline:index.html.twig', 'ChillPersonBundle:Timeline:index.html.twig',

View File

@ -34,7 +34,7 @@ namespace Chill\PersonBundle\Privacy;
use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\Event;
class AccompanyingPeriodPrivacyEvent extends Event class AccompanyingPeriodPrivacyEvent extends \Symfony\Contracts\EventDispatcher\Event
{ {
final public const ACCOMPANYING_PERIOD_PRIVACY_EVENT = 'chill_person.accompanying_period_privacy_event'; final public const ACCOMPANYING_PERIOD_PRIVACY_EVENT = 'chill_person.accompanying_period_privacy_event';

View File

@ -42,7 +42,7 @@ use function count;
* Array $args expects arguments with the following keys: 'element_class', 'element_id', 'action' * Array $args expects arguments with the following keys: 'element_class', 'element_id', 'action'
* By default, action is set to 'show' * By default, action is set to 'show'
*/ */
class PrivacyEvent extends Event class PrivacyEvent extends \Symfony\Contracts\EventDispatcher\Event
{ {
final public const PERSON_PRIVACY_EVENT = 'chill_person.privacy_event'; final public const PERSON_PRIVACY_EVENT = 'chill_person.privacy_event';

View File

@ -37,7 +37,7 @@ final class AccompanyingPeriodControllerTest extends WebTestCase
public const OPENING_INPUT = 'chill_personbundle_accompanyingperiod[openingDate]'; public const OPENING_INPUT = 'chill_personbundle_accompanyingperiod[openingDate]';
/** /**
* @var \Symfony\Component\BrowserKit\Client * @var \Symfony\Component\BrowserKit\AbstractBrowser
*/ */
protected $client; protected $client;

View File

@ -21,7 +21,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
final class PersonAddressControllerTest extends WebTestCase final class PersonAddressControllerTest extends WebTestCase
{ {
/** /**
* @var \Symfony\Component\BrowserKit\Client * @var \Symfony\Component\BrowserKit\AbstractBrowser
*/ */
protected $client; protected $client;

View File

@ -225,7 +225,7 @@ final class PersonSearchTest extends WebTestCase
} }
/** /**
* @return \Symfony\Component\BrowserKit\Client * @return \Symfony\Component\BrowserKit\AbstractBrowser
*/ */
private function getAuthenticatedClient(mixed $username = 'center a_social') private function getAuthenticatedClient(mixed $username = 'center a_social')
{ {

View File

@ -2,4 +2,4 @@ services:
Chill\PersonBundle\Actions\Remove\PersonMove: Chill\PersonBundle\Actions\Remove\PersonMove:
arguments: arguments:
$em: '@Doctrine\ORM\EntityManagerInterface' $em: '@Doctrine\ORM\EntityManagerInterface'
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface' $eventDispatcher: '@Symfony\Contracts\EventDispatcher\EventDispatcherInterface'

View File

@ -5,7 +5,7 @@ services:
Chill\PersonBundle\Controller\TimelinePersonController: Chill\PersonBundle\Controller\TimelinePersonController:
arguments: arguments:
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface' $eventDispatcher: '@Symfony\Contracts\EventDispatcher\EventDispatcherInterface'
$timelineBuilder: '@chill_main.timeline_builder' $timelineBuilder: '@chill_main.timeline_builder'
$paginatorFactory: '@chill_main.paginator_factory' $paginatorFactory: '@chill_main.paginator_factory'
tags: ['controller.service_arguments'] tags: ['controller.service_arguments']
@ -28,7 +28,7 @@ services:
$translator: '@Symfony\Contracts\Translation\TranslatorInterface' $translator: '@Symfony\Contracts\Translation\TranslatorInterface'
$personRepository: '@Chill\PersonBundle\Repository\PersonRepository' $personRepository: '@Chill\PersonBundle\Repository\PersonRepository'
$personMove: '@Chill\PersonBundle\Actions\Remove\PersonMove' $personMove: '@Chill\PersonBundle\Actions\Remove\PersonMove'
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface' $eventDispatcher: '@Symfony\Contracts\EventDispatcher\EventDispatcherInterface'
tags: ['controller.service_arguments'] tags: ['controller.service_arguments']
Chill\PersonBundle\Controller\AccompanyingCourseController: Chill\PersonBundle\Controller\AccompanyingCourseController:

View File

@ -8,7 +8,7 @@ services:
# Chill\PersonBundle\Menu\SectionMenuBuilder: # Chill\PersonBundle\Menu\SectionMenuBuilder:
# arguments: # arguments:
# $authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface' # $authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
# $translator: '@Symfony\Component\Translation\TranslatorInterface' # $translator: '@Symfony\Contracts\Translation\TranslatorInterface'
# tags: # tags:
# - { name: 'chill.menu_builder' } # - { name: 'chill.menu_builder' }
# #

View File

@ -90,7 +90,7 @@ class ReportController extends AbstractController
$form = $this->createCreateForm($entity, $person, $cFGroup); $form = $this->createCreateForm($entity, $person, $cFGroup);
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$entity->setCFGroup($cFGroup); $entity->setCFGroup($cFGroup);
$entity->setPerson($person); $entity->setPerson($person);
@ -107,10 +107,7 @@ class ReportController extends AbstractController
->trans('Success : report created!') ->trans('Success : report created!')
); );
return $this->redirect($this->generateUrl( return $this->redirectToRoute('report_view', ['person_id' => $person_id, 'report_id' => $entity->getId()]);
'report_view',
['person_id' => $person_id, 'report_id' => $entity->getId()]
));
} }
$this->get('session') $this->get('session')
@ -166,7 +163,7 @@ class ReportController extends AbstractController
'element_id' => $report->getId(), 'element_id' => $report->getId(),
'action' => 'edit', 'action' => 'edit',
]); ]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); $this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
return $this->render('ChillReportBundle:Report:edit.html.twig', [ return $this->render('ChillReportBundle:Report:edit.html.twig', [
'edit_form' => $editForm->createView(), 'edit_form' => $editForm->createView(),
@ -247,7 +244,7 @@ class ReportController extends AbstractController
'element_class' => Report::class, 'element_class' => Report::class,
'action' => 'list', 'action' => 'list',
]); ]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); $this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
return $this->render('ChillReportBundle:Report:list.html.twig', [ return $this->render('ChillReportBundle:Report:list.html.twig', [
'reports' => $reports, 'reports' => $reports,
@ -335,24 +332,14 @@ class ReportController extends AbstractController
$cFGroupId = $request->query->get('cFGroup'); $cFGroupId = $request->query->get('cFGroup');
if ($request->query->has('cFGroup')) { if ($request->query->has('cFGroup')) {
return $this->redirect( return $this->redirectToRoute('report_new', ['person_id' => $person_id, 'cf_group_id' => $cFGroupId]);
$this->generateUrl(
'report_new',
['person_id' => $person_id, 'cf_group_id' => $cFGroupId]
)
);
} }
$cFGroups = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class) $cFGroups = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)
->findByEntity(\Chill\ReportBundle\Entity\Report::class); ->findByEntity(\Chill\ReportBundle\Entity\Report::class);
if (count($cFGroups) === 1) { if (count($cFGroups) === 1) {
return $this->redirect( return $this->redirectToRoute('report_new', ['person_id' => $person_id, 'cf_group_id' => $cFGroups[0]->getId()]);
$this->generateUrl(
'report_new',
['person_id' => $person_id, 'cf_group_id' => $cFGroups[0]->getId()]
)
);
} }
$cFGroupsChoice = []; $cFGroupsChoice = [];
@ -392,12 +379,7 @@ class ReportController extends AbstractController
$cFGroupId = $request->query->get('cFGroup'); $cFGroupId = $request->query->get('cFGroup');
if ($request->query->has('cFGroup')) { if ($request->query->has('cFGroup')) {
return $this->redirect( return $this->redirectToRoute('report_export_list', ['cf_group_id' => $cFGroupId]);
$this->generateUrl(
'report_export_list',
['cf_group_id' => $cFGroupId]
)
);
} }
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
@ -406,12 +388,7 @@ class ReportController extends AbstractController
->findByEntity(\Chill\ReportBundle\Entity\Report::class); ->findByEntity(\Chill\ReportBundle\Entity\Report::class);
if (count($cFGroups) === 1) { if (count($cFGroups) === 1) {
return $this->redirect( return $this->redirectToRoute('report_export_list', ['cf_group_id' => $cFGroups[0]->getId()]);
$this->generateUrl(
'report_export_list',
['cf_group_id' => $cFGroups[0]->getId()]
)
);
} }
$cFGroupsChoice = []; $cFGroupsChoice = [];
@ -461,7 +438,7 @@ class ReportController extends AbstractController
$editForm = $this->createEditForm($report); $editForm = $this->createEditForm($report);
$editForm->handleRequest($request); $editForm->handleRequest($request);
if ($editForm->isValid()) { if ($editForm->isSubmitted() && $editForm->isValid()) {
$em->flush(); $em->flush();
$this->get('session') $this->get('session')
@ -479,12 +456,9 @@ class ReportController extends AbstractController
'element_id' => $report->getId(), 'element_id' => $report->getId(),
'action' => 'update', 'action' => 'update',
]); ]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); $this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
return $this->redirect($this->generateUrl( return $this->redirectToRoute('report_view', ['person_id' => $report->getPerson()->getId(), 'report_id' => $report_id]);
'report_view',
['person_id' => $report->getPerson()->getId(), 'report_id' => $report_id]
));
} }
$this->get('session') $this->get('session')
@ -530,7 +504,7 @@ class ReportController extends AbstractController
'element_id' => $entity->getId(), 'element_id' => $entity->getId(),
'action' => 'view', 'action' => 'view',
]); ]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); $this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
return $this->render('ChillReportBundle:Report:view.html.twig', [ return $this->render('ChillReportBundle:Report:view.html.twig', [
'entity' => $entity, 'entity' => $entity,

View File

@ -38,7 +38,7 @@ class LoadReports extends AbstractFixture implements ContainerAwareInterface, Or
*/ */
private $faker; private $faker;
public function __construct() public function __construct(private \Doctrine\ORM\EntityManager $entityManager)
{ {
$this->faker = FakerFactory::create('fr_FR'); $this->faker = FakerFactory::create('fr_FR');
} }
@ -61,7 +61,7 @@ class LoadReports extends AbstractFixture implements ContainerAwareInterface, Or
private function createExpected(ObjectManager $manager) private function createExpected(ObjectManager $manager)
{ {
$charline = $this->container->get('doctrine.orm.entity_manager') $charline = $this->entityManager
->getRepository(Person::class) ->getRepository(Person::class)
->findOneBy(['firstName' => 'Charline', 'lastName' => 'DEPARDIEU']); ->findOneBy(['firstName' => 'Charline', 'lastName' => 'DEPARDIEU']);
@ -147,7 +147,7 @@ class LoadReports extends AbstractFixture implements ContainerAwareInterface, Or
private function getPeopleRandom($percentage) private function getPeopleRandom($percentage)
{ {
$people = $this->container->get('doctrine.orm.entity_manager') $people = $this->entityManager
->getRepository(Person::class) ->getRepository(Person::class)
->findAll(); ->findAll();

View File

@ -174,7 +174,7 @@ final class ReportControllerNextTest extends WebTestCase
/** /**
* @return \Symfony\Component\DomCrawler\Form * @return \Symfony\Component\DomCrawler\Form
*/ */
protected function getReportForm(Person $person, CustomFieldsGroup $group, Client $client) protected function getReportForm(Person $person, CustomFieldsGroup $group, \Symfony\Component\BrowserKit\AbstractBrowser $client)
{ {
$url = sprintf( $url = sprintf(
'fr/person/%d/report/cfgroup/%d/new', 'fr/person/%d/report/cfgroup/%d/new',

View File

@ -417,7 +417,7 @@ final class ReportControllerTest extends WebTestCase
protected function getReportForm( protected function getReportForm(
Person $person, Person $person,
CustomFieldsGroup $group, CustomFieldsGroup $group,
\Symfony\Component\BrowserKit\Client $client \Symfony\Component\BrowserKit\AbstractBrowser $client
) { ) {
$url = sprintf( $url = sprintf(
'fr/person/%d/report/cfgroup/%d/new', 'fr/person/%d/report/cfgroup/%d/new',

View File

@ -103,7 +103,7 @@ final class ReportSearchTest extends WebTestCase
} }
/** /**
* @return \Symfony\Component\BrowserKit\Client * @return \Symfony\Component\BrowserKit\AbstractBrowser
*/ */
private function getAuthenticatedClient(mixed $username = 'center a_social') private function getAuthenticatedClient(mixed $username = 'center a_social')
{ {

View File

@ -1,7 +1,7 @@
services: services:
Chill\ReportBundle\Controller\ReportController: Chill\ReportBundle\Controller\ReportController:
arguments: arguments:
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface' $eventDispatcher: '@Symfony\Contracts\EventDispatcher\EventDispatcherInterface'
$authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper' $authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
$paginator: '@Chill\MainBundle\Pagination\PaginatorFactory' $paginator: '@Chill\MainBundle\Pagination\PaginatorFactory'
tags: ['controller.service_arguments'] tags: ['controller.service_arguments']

View File

@ -21,6 +21,6 @@ class ChillTaskBundle extends Bundle
{ {
parent::build($container); parent::build($container);
$container->addCompilerPass(new TaskWorkflowDefinitionCompilerPass()); $container->addCompilerPass(new TaskWorkflowDefinitionCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
} }
} }

View File

@ -135,16 +135,10 @@ final class SingleTaskController extends AbstractController
->trans('The task has been successfully removed.')); ->trans('The task has been successfully removed.'));
if ($task->getContext() instanceof Person) { if ($task->getContext() instanceof Person) {
return $this->redirect($this->generateUrl( return $this->redirectToRoute('chill_task_singletask_by-person_list', ['id' => $task->getPerson()->getId()]);
'chill_task_singletask_by-person_list',
['id' => $task->getPerson()->getId()]
));
} }
return $this->redirect($this->generateUrl( return $this->redirectToRoute('chill_task_singletask_by-course_list', ['id' => $task->getCourse()->getId()]);
'chill_task_singletask_by-course_list',
['id' => $task->getCourse()->getId()]
));
} }
} }
@ -183,7 +177,7 @@ final class SingleTaskController extends AbstractController
$event = (new UIEvent('single-task', $task)) $event = (new UIEvent('single-task', $task))
->setForm($this->setCreateForm($task, TaskVoter::UPDATE)); ->setForm($this->setCreateForm($task, TaskVoter::UPDATE));
$this->eventDispatcher->dispatch(UIEvent::EDIT_FORM, $event); $this->eventDispatcher->dispatch($event, UIEvent::EDIT_FORM);
$form = $event->getForm(); $form = $event->getForm();
@ -205,7 +199,7 @@ final class SingleTaskController extends AbstractController
'element_id' => $task->getId(), 'element_id' => $task->getId(),
'action' => 'update', 'action' => 'update',
]); ]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); $this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
if ($request->query->has('returnPath')) { if ($request->query->has('returnPath')) {
return $this->redirect($request->query->get('returnPath')); return $this->redirect($request->query->get('returnPath'));
@ -228,7 +222,7 @@ final class SingleTaskController extends AbstractController
$this->addFlash('error', $this->translator->trans('This form contains errors')); $this->addFlash('error', $this->translator->trans('This form contains errors'));
} }
$this->eventDispatcher->dispatch(UIEvent::EDIT_PAGE, $event); $this->eventDispatcher->dispatch($event, UIEvent::EDIT_PAGE);
if ($event->hasResponse()) { if ($event->hasResponse()) {
return $event->getResponse(); return $event->getResponse();
@ -240,7 +234,7 @@ final class SingleTaskController extends AbstractController
'element_id' => $task->getId(), 'element_id' => $task->getId(),
'action' => 'edit', 'action' => 'edit',
]); ]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); $this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
return $this->render('@ChillTask/SingleTask/Person/edit.html.twig', [ return $this->render('@ChillTask/SingleTask/Person/edit.html.twig', [
'task' => $task, 'task' => $task,
@ -548,7 +542,7 @@ final class SingleTaskController extends AbstractController
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->persist($task); $em->persist($task);
$this->eventDispatcher->dispatch(TaskEvent::PERSIST, new TaskEvent($task)); $this->eventDispatcher->dispatch(new TaskEvent($task), TaskEvent::PERSIST);
$em->flush(); $em->flush();
@ -605,7 +599,7 @@ final class SingleTaskController extends AbstractController
'element_id' => $task->getId(), 'element_id' => $task->getId(),
'action' => 'show', 'action' => 'show',
]); ]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); $this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
} }
$timeline = $this->timelineBuilder $timeline = $this->timelineBuilder

View File

@ -119,7 +119,7 @@ class TaskController extends AbstractController
->setForm($form) ->setForm($form)
->setTransition($transitionInstance); ->setTransition($transitionInstance);
$eventDispatcher->dispatch(UIEvent::SHOW_TRANSITION_PAGE, $event); $eventDispatcher->dispatch($event, UIEvent::SHOW_TRANSITION_PAGE);
if ($event->hasResponse()) { if ($event->hasResponse()) {
return $event->getResponse(); return $event->getResponse();

View File

@ -14,7 +14,7 @@ namespace Chill\TaskBundle\Event;
use Chill\TaskBundle\Entity\AbstractTask; use Chill\TaskBundle\Entity\AbstractTask;
use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\Event;
class TaskEvent extends Event class TaskEvent extends \Symfony\Contracts\EventDispatcher\Event
{ {
final public const PERSIST = 'chill_task.task_persist'; final public const PERSIST = 'chill_task.task_persist';

View File

@ -17,7 +17,7 @@ use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Workflow\Transition; use Symfony\Component\Workflow\Transition;
class UIEvent extends Event class UIEvent extends \Symfony\Contracts\EventDispatcher\Event
{ {
final public const EDIT_FORM = 'chill_task.edit_form'; final public const EDIT_FORM = 'chill_task.edit_form';

View File

@ -17,7 +17,7 @@ use Chill\TaskBundle\Entity\AbstractTask;
use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
class AuthorizationEvent extends Event class AuthorizationEvent extends \Symfony\Contracts\EventDispatcher\Event
{ {
final public const VOTE = 'chill_task.vote'; final public const VOTE = 'chill_task.vote';

View File

@ -95,7 +95,7 @@ final class TaskVoter extends AbstractChillVoter implements ProvideRoleHierarchy
$event = new AuthorizationEvent($subject, $attribute, $token); $event = new AuthorizationEvent($subject, $attribute, $token);
$this->eventDispatcher->dispatch(AuthorizationEvent::VOTE, $event); $this->eventDispatcher->dispatch($event, AuthorizationEvent::VOTE);
if ($event->hasVote()) { if ($event->hasVote()) {
$this->logger->debug('The TaskVoter is overriding by ' $this->logger->debug('The TaskVoter is overriding by '

View File

@ -22,6 +22,6 @@ class ChillThirdPartyBundle extends Bundle
parent::build($container); parent::build($container);
$container->registerForAutoconfiguration(ThirdPartyTypeProviderInterface::class) $container->registerForAutoconfiguration(ThirdPartyTypeProviderInterface::class)
->addTag('chill_3party.provider'); ->addTag('chill_3party.provider');
$container->addCompilerPass(new ThirdPartyTypeCompilerPass()); $container->addCompilerPass(new ThirdPartyTypeCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
} }
} }

View File

@ -21,6 +21,10 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
final class Version20230215175150 extends AbstractMigration implements ContainerAwareInterface final class Version20230215175150 extends AbstractMigration implements ContainerAwareInterface
{ {
public ContainerInterface $container; public ContainerInterface $container;
public function __construct(\Doctrine\DBAL\Connection $connection, \Psr\Log\LoggerInterface $logger, private \Doctrine\ORM\EntityManager $entityManager)
{
parent::__construct($connection, $logger);
}
public function down(Schema $schema): void public function down(Schema $schema): void
{ {
@ -45,7 +49,7 @@ final class Version20230215175150 extends AbstractMigration implements Container
{ {
$this->addSql('ALTER TABLE chill_3party.third_party ADD profession TEXT DEFAULT \'\' NOT NULL'); $this->addSql('ALTER TABLE chill_3party.third_party ADD profession TEXT DEFAULT \'\' NOT NULL');
$em = $this->container->get('doctrine.orm.entity_manager'); $em = $this->entityManager;
$professions = $em->getRepository(ThirdPartyProfession::class)->findAll(); $professions = $em->getRepository(ThirdPartyProfession::class)->findAll();
foreach ($professions as $p) { foreach ($professions as $p) {