From 5efb284c5b3f5634701591642aba277d87b4644d Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 12 Feb 2021 16:39:33 +0100 Subject: [PATCH 1/2] fix logger service injection --- Controller/ActivityController.php | 19 ++++++++++++++----- config/services/controller.yaml | 1 + 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Controller/ActivityController.php b/Controller/ActivityController.php index e3ef641c6..60b029de3 100644 --- a/Controller/ActivityController.php +++ b/Controller/ActivityController.php @@ -24,6 +24,7 @@ namespace Chill\ActivityBundle\Controller; use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Chill\PersonBundle\Privacy\PrivacyEvent; +use Psr\Log\LoggerInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -51,16 +52,25 @@ class ActivityController extends AbstractController */ protected $authorizationHelper; + /** + * @var LoggerInterface + */ + protected $logger; + /** * ActivityController constructor. * * @param EventDispatcherInterface $eventDispatcher * @param AuthorizationHelper $authorizationHelper */ - public function __construct(EventDispatcherInterface $eventDispatcher, AuthorizationHelper $authorizationHelper) - { + public function __construct( + EventDispatcherInterface $eventDispatcher, + AuthorizationHelper $authorizationHelper, + LoggerInterface $logger + ) { $this->eventDispatcher = $eventDispatcher; $this->authorizationHelper = $authorizationHelper; + $this->logger = $logger; } /** @@ -390,9 +400,8 @@ class ActivityController extends AbstractController $form->handleRequest($request); if ($form->isValid()) { - $logger = $this->get('chill.main.logger'); - - $logger->notice("An activity has been removed", array( + + $this->logger->notice("An activity has been removed", array( 'by_user' => $this->getUser()->getUsername(), 'activity_id' => $activity->getId(), 'person_id' => $activity->getPerson()->getId(), diff --git a/config/services/controller.yaml b/config/services/controller.yaml index a1930760b..cf36e482d 100644 --- a/config/services/controller.yaml +++ b/config/services/controller.yaml @@ -3,4 +3,5 @@ services: arguments: $eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface' $authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper' + $logger: '@chill.main.logger' tags: ['controller.service_arguments'] From 72c4eec43ff2db12c06165d96f7604a387ed73ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 2 Mar 2021 17:09:13 +0100 Subject: [PATCH 2/2] change migration namespace --- migrations/Version20150701091248.php | 2 +- migrations/Version20150702093317.php | 2 +- migrations/Version20150704091347.php | 2 +- migrations/Version20160222103457.php | 2 +- migrations/Version20161114085659.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/migrations/Version20150701091248.php b/migrations/Version20150701091248.php index 8a99255dc..be0eb7221 100644 --- a/migrations/Version20150701091248.php +++ b/migrations/Version20150701091248.php @@ -20,7 +20,7 @@ * along with this program. If not, see . */ -namespace Application\Migrations; +namespace Chill\Migrations\Activity; use Doctrine\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; diff --git a/migrations/Version20150702093317.php b/migrations/Version20150702093317.php index 25781dc86..0ef11b14f 100644 --- a/migrations/Version20150702093317.php +++ b/migrations/Version20150702093317.php @@ -20,7 +20,7 @@ * along with this program. If not, see . */ -namespace Application\Migrations; +namespace Chill\Migrations\Activity; use Doctrine\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; diff --git a/migrations/Version20150704091347.php b/migrations/Version20150704091347.php index c8738858a..8940b04c3 100644 --- a/migrations/Version20150704091347.php +++ b/migrations/Version20150704091347.php @@ -20,7 +20,7 @@ * along with this program. If not, see . */ -namespace Application\Migrations; +namespace Chill\Migrations\Activity; use Doctrine\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; diff --git a/migrations/Version20160222103457.php b/migrations/Version20160222103457.php index 7bd3c708e..0dbcabbb4 100644 --- a/migrations/Version20160222103457.php +++ b/migrations/Version20160222103457.php @@ -1,6 +1,6 @@