repo = $repo; $this->router = $router; } protected function configure() { $this ->setDescription('List mailings') ; } protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $headers = ['Label', 'ID', 'Feed', 'Created at', 'Updated at']; $rows = []; $entities = $this->repo->findAll([], ['createdAt' => 'DEC']); foreach ($entities as $entity) { $rows[] = [ $entity->getLabel(), $entity->getId(), $this->router->generate( 'mailing_rss', ['mailing' => $entity->getId()], UrlGeneratorInterface::ABSOLUTE_URL ), $entity->getCreatedAt()->format('Y-m-d H:i:s'), $entity->getUpdatedAt()->format('Y-m-d H:i:s'), ]; } $io->table($headers, $rows); return Command::SUCCESS; } }