Skip to content

Commit

Permalink
reduce deprecation notices while running tests with Symfony >= 5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
craue committed Aug 30, 2021
1 parent 9f5a220 commit ef6815b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
include:
- stage: smoke test 🕵️
php: 7.3
env: DEPS='lowest' WITH_DOCTRINE_CACHE_BUNDLE='yes' SYMFONY_DEPRECATIONS_HELPER='max[self]=2&max[direct]=286&max[indirect]=753'
env: DEPS='lowest' WITH_DOCTRINE_CACHE_BUNDLE='yes' SYMFONY_DEPRECATIONS_HELPER='max[self]=2&max[direct]=168&max[indirect]=871'
-
php: 8.0
env: DEPS='unmodified' WITH_STATIC_ANALYSIS='yes'
Expand Down
11 changes: 8 additions & 3 deletions Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Twig\Environment;

/**
Expand All @@ -18,7 +20,8 @@
*/
class SettingsController extends AbstractController {

public function modifyAction(Request $request, FormFactoryInterface $formFactory, Environment $twig, CacheAdapterInterface $cache) {
public function modifyAction(CacheAdapterInterface $cache, FormFactoryInterface $formFactory, Request $request,
SessionInterface $session, Environment $twig) {
$em = $this->getDoctrine()->getManager();
$repo = $em->getRepository($this->container->getParameter('craue_config.entity_name'));
$allStoredSettings = $repo->findAll();
Expand All @@ -43,8 +46,10 @@ public function modifyAction(Request $request, FormFactoryInterface $formFactory

$em->flush();

$this->get('session')->getFlashBag()->set('notice',
$this->get('translator')->trans('settings_changed', [], 'CraueConfigBundle'));
if ($session instanceof Session) {
$session->getFlashBag()->set('notice', $this->get('translator')->trans('settings_changed', [], 'CraueConfigBundle'));
}

return $this->redirect($this->generateUrl($this->container->getParameter('craue_config.redirectRouteAfterModify')));
}
}
Expand Down

0 comments on commit ef6815b

Please sign in to comment.