insertOne( array_map( fn (string $e) => $this->translator->trans($e), [ 'Id', 'Label', 'Social issue', 'export.social_action_list.desactivation_date', 'socialIssue.isParent?', 'socialIssue.Parent id', ] ) ); foreach ($issues as $issue) { $csv->insertOne($this->formatRow($issue)); } return $csv; } private function formatRow( SocialIssue $issue, ): array { return [ 'id' => $issue->getId(), 'label' => $this->stringHelper->localize($issue->getTitle()), 'title' => $this->socialIssueRender->renderString($issue, []), 'export.social_action_list.desactivation_date' => $issue->getDesactivationDate()?->format('Y-m-d'), 'isParent' => $issue->hasChildren() ? 'X' : '', 'parent_id' => null !== $issue->getParent() ? $issue->getParent()->getId() : '', ]; } }