mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix logger service dependency injection
This commit is contained in:
parent
84347ec982
commit
b49264aec4
@ -21,6 +21,7 @@ namespace Chill\EventBundle\Controller;
|
||||
|
||||
use ArrayIterator;
|
||||
use Chill\EventBundle\Entity\Event;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@ -39,6 +40,21 @@ use Symfony\Component\Form\Extension\Core\Type\CollectionType;
|
||||
class ParticipationController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var \Psr\Log\LoggerInterface
|
||||
*/
|
||||
private $logger;
|
||||
|
||||
/**
|
||||
* ParticipationController constructor.
|
||||
*
|
||||
* @param LoggerInterface $logger
|
||||
*/
|
||||
public function __construct(LoggerInterface $logger)
|
||||
{
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a form to add a participation
|
||||
*
|
||||
@ -56,7 +72,7 @@ class ParticipationController extends AbstractController
|
||||
try {
|
||||
$this->testRequest($request);
|
||||
} catch (\RuntimeException $ex) {
|
||||
$this->get('logger')->warning($ex->getMessage());
|
||||
$this->logger->warning($ex->getMessage());
|
||||
|
||||
return (new Response())
|
||||
->setStatusCode(Response::HTTP_BAD_REQUEST)
|
||||
@ -234,7 +250,7 @@ class ParticipationController extends AbstractController
|
||||
try {
|
||||
$this->testRequest($request);
|
||||
} catch (\RuntimeException $ex) {
|
||||
$this->get('logger')->warning($ex->getMessage());
|
||||
$this->logger->warning($ex->getMessage());
|
||||
|
||||
return (new Response())
|
||||
->setStatusCode(Response::HTTP_BAD_REQUEST)
|
||||
|
@ -8,4 +8,9 @@ services:
|
||||
$translator: '@Symfony\Component\Translation\TranslatorInterface'
|
||||
$paginator: '@chill_main.paginator_factory'
|
||||
public: true
|
||||
tags: ['controller.service_arguments']
|
||||
|
||||
Chill\EventBundle\Controller\ParticipationController:
|
||||
arguments:
|
||||
$logger: '@Psr\Log\LoggerInterface'
|
||||
tags: ['controller.service_arguments']
|
||||
|
Loading…
x
Reference in New Issue
Block a user