add url to the feed in mailing:list
This commit is contained in:
parent
331a8f8b09
commit
b3eadc5139
2
.env
2
.env
|
@ -25,3 +25,5 @@ APP_SECRET=aa708f7c537a5c6d167229524aea0817
|
||||||
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
|
# 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
|
DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7
|
||||||
###< doctrine/doctrine-bundle ###
|
###< doctrine/doctrine-bundle ###
|
||||||
|
|
||||||
|
APP_DEFAULT_URI=http://127.0.0.1:8000
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -10,4 +10,5 @@
|
||||||
/data/
|
/data/
|
||||||
/var/
|
/var/
|
||||||
/vendor/
|
/vendor/
|
||||||
|
/.mage.yml
|
||||||
###< symfony/framework-bundle ###
|
###< symfony/framework-bundle ###
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
# see https://symfony.com/doc/current/reference/configuration/framework.html
|
# see https://symfony.com/doc/current/reference/configuration/framework.html
|
||||||
framework:
|
framework:
|
||||||
secret: '%env(APP_SECRET)%'
|
secret: '%env(APP_SECRET)%'
|
||||||
|
router:
|
||||||
|
default_uri: '%env(APP_DEFAULT_URI)%'
|
||||||
|
|
||||||
#csrf_protection: true
|
#csrf_protection: true
|
||||||
#http_method_override: true
|
#http_method_override: true
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
use App\Repository\MailingRepository;
|
use App\Repository\MailingRepository;
|
||||||
|
use Symfony\Component\Routing\RouterInterface;
|
||||||
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
|
|
||||||
class MailingListCommand extends Command
|
class MailingListCommand extends Command
|
||||||
{
|
{
|
||||||
|
@ -16,11 +18,14 @@ class MailingListCommand extends Command
|
||||||
|
|
||||||
protected MailingRepository $repo;
|
protected MailingRepository $repo;
|
||||||
|
|
||||||
public function __construct(MailingRepository $repo)
|
protected RouterInterface $router;
|
||||||
|
|
||||||
|
public function __construct(MailingRepository $repo, RouterInterface $router)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->repo = $repo;
|
$this->repo = $repo;
|
||||||
|
$this->router = $router;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function configure()
|
protected function configure()
|
||||||
|
@ -34,7 +39,7 @@ class MailingListCommand extends Command
|
||||||
{
|
{
|
||||||
$io = new SymfonyStyle($input, $output);
|
$io = new SymfonyStyle($input, $output);
|
||||||
|
|
||||||
$headers = ['Label', 'ID', 'Created at', 'Updated at'];
|
$headers = ['Label', 'Feed', 'Created at', 'Updated at'];
|
||||||
$rows = [];
|
$rows = [];
|
||||||
|
|
||||||
$entities = $this->repo->findAll([], ['createdAt' => 'DEC']);
|
$entities = $this->repo->findAll([], ['createdAt' => 'DEC']);
|
||||||
|
@ -42,7 +47,11 @@ class MailingListCommand extends Command
|
||||||
foreach ($entities as $entity) {
|
foreach ($entities as $entity) {
|
||||||
$rows[] = [
|
$rows[] = [
|
||||||
$entity->getLabel(),
|
$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->getCreatedAt()->format('Y-m-d H:i:s'),
|
||||||
$entity->getUpdatedAt()->format('Y-m-d H:i:s'),
|
$entity->getUpdatedAt()->format('Y-m-d H:i:s'),
|
||||||
];
|
];
|
||||||
|
|
|
@ -16,7 +16,7 @@ class MailingController extends AbstractController
|
||||||
*/
|
*/
|
||||||
public function rss(Mailing $mailing, MailRepository $mailRepository): Response
|
public function rss(Mailing $mailing, MailRepository $mailRepository): Response
|
||||||
{
|
{
|
||||||
$mails = $mailRepository->findAll(
|
$mails = $mailRepository->findBy(
|
||||||
[
|
[
|
||||||
'mailing' => $mailing->getId(),
|
'mailing' => $mailing->getId(),
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue