Rector changes

This commit is contained in:
Julie Lenaerts 2025-01-16 10:25:02 +01:00
parent 018f8aef5c
commit a915c35026

View File

@ -31,12 +31,12 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class SocialWorkExportController extends AbstractController class SocialWorkExportController extends AbstractController
{ {
public function __construct( public function __construct(
private SocialIssueRepository $socialIssueRepository, private readonly SocialIssueRepository $socialIssueRepository,
private SocialActionRepository $socialActionRepository, private readonly SocialActionRepository $socialActionRepository,
private Security $security, private readonly Security $security,
private TranslatorInterface $translator, private readonly TranslatorInterface $translator,
private SocialIssueRender $socialIssueRender, private readonly SocialIssueRender $socialIssueRender,
private SocialActionRender $socialActionRender, private readonly SocialActionRender $socialActionRender,
) {} ) {}
/** /**
@ -53,14 +53,12 @@ class SocialWorkExportController extends AbstractController
$socialIssues = $this->socialIssueRepository->findAll(); $socialIssues = $this->socialIssueRepository->findAll();
$socialIssues = array_map(function ($issue) { $socialIssues = array_map(fn($issue) => [
return [
'id' => $issue->getId(), 'id' => $issue->getId(),
'title' => $this->socialIssueRender->renderString($issue, []), 'title' => $this->socialIssueRender->renderString($issue, []),
'ordering' => $issue->getOrdering(), 'ordering' => $issue->getOrdering(),
'desactivationDate' => $issue->getDesactivationDate(), 'desactivationDate' => $issue->getDesactivationDate(),
]; ], $socialIssues);
}, $socialIssues);
$csv = Writer::createFromPath('php://temp', 'r+'); $csv = Writer::createFromPath('php://temp', 'r+');
$csv->insertOne( $csv->insertOne(
@ -108,15 +106,13 @@ class SocialWorkExportController extends AbstractController
$socialActions = $this->socialActionRepository->findAll(); $socialActions = $this->socialActionRepository->findAll();
$socialActions = array_map(function ($action) { $socialActions = array_map(fn($action) => [
return [
'id' => $action->getId(), 'id' => $action->getId(),
'title' => $this->socialActionRender->renderString($action, []), 'title' => $this->socialActionRender->renderString($action, []),
'desactivationDate' => $action->getDesactivationDate(), 'desactivationDate' => $action->getDesactivationDate(),
'socialIssue' => $this->socialIssueRender->renderString($action->getIssue(), []), 'socialIssue' => $this->socialIssueRender->renderString($action->getIssue(), []),
'ordering' => $action->getOrdering(), 'ordering' => $action->getOrdering(),
]; ], $socialActions);
}, $socialActions);
$csv = Writer::createFromPath('php://temp', 'r+'); $csv = Writer::createFromPath('php://temp', 'r+');
$csv->insertOne( $csv->insertOne(