Browse Source

add url to the feed in mailing:list

develop
Simon Vieille 1 week ago
parent
commit
b3eadc5139
Signed by: deblan GPG Key ID: 03383D15A1D31745
5 changed files with 19 additions and 4 deletions
  1. +2
    -0
      .env
  2. +1
    -0
      .gitignore
  3. +3
    -0
      config/packages/framework.yaml
  4. +12
    -3
      src/Command/MailingListCommand.php
  5. +1
    -1
      src/Controller/MailingController.php

+ 2
- 0
.env View File

@ -25,3 +25,5 @@ APP_SECRET=aa708f7c537a5c6d167229524aea0817
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7
###< doctrine/doctrine-bundle ###
APP_DEFAULT_URI=http://127.0.0.1:8000

+ 1
- 0
.gitignore View File

@ -10,4 +10,5 @@
/data/
/var/
/vendor/
/.mage.yml
###< symfony/framework-bundle ###

+ 3
- 0
config/packages/framework.yaml View File

@ -1,6 +1,9 @@
# see https://symfony.com/doc/current/reference/configuration/framework.html
framework:
secret: '%env(APP_SECRET)%'
router:
default_uri: '%env(APP_DEFAULT_URI)%'
#csrf_protection: true
#http_method_override: true

+ 12
- 3
src/Command/MailingListCommand.php View File

@ -9,6 +9,8 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use App\Repository\MailingRepository;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
class MailingListCommand extends Command
{
@ -16,11 +18,14 @@ class MailingListCommand extends Command
protected MailingRepository $repo;
public function __construct(MailingRepository $repo)
protected RouterInterface $router;
public function __construct(MailingRepository $repo, RouterInterface $router)
{
parent::__construct();
$this->repo = $repo;
$this->router = $router;
}
protected function configure()
@ -34,7 +39,7 @@ class MailingListCommand extends Command
{
$io = new SymfonyStyle($input, $output);
$headers = ['Label', 'ID', 'Created at', 'Updated at'];
$headers = ['Label', 'Feed', 'Created at', 'Updated at'];
$rows = [];
$entities = $this->repo->findAll([], ['createdAt' => 'DEC']);
@ -42,7 +47,11 @@ class MailingListCommand extends Command
foreach ($entities as $entity) {
$rows[] = [
$entity->getLabel(),
$entity->getId(),
$this->router->generate(
'mailing_rss',
['id' => $entity->getId()],
UrlGeneratorInterface::ABSOLUTE_URL
),
$entity->getCreatedAt()->format('Y-m-d H:i:s'),
$entity->getUpdatedAt()->format('Y-m-d H:i:s'),
];

+ 1
- 1
src/Controller/MailingController.php View File

@ -16,7 +16,7 @@ class MailingController extends AbstractController
*/
public function rss(Mailing $mailing, MailRepository $mailRepository): Response
{
$mails = $mailRepository->findAll(
$mails = $mailRepository->findBy(
[
'mailing' => $mailing->getId(),
],

Loading…
Cancel
Save