From b983dafe8346925df3c4922c8b56666ea4519b10 Mon Sep 17 00:00:00 2001 From: LVoogd Date: Sun, 31 Dec 2023 16:09:08 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Source=20should=20be=20unique=20?= =?UTF-8?q?for=20each=20feedProvider?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tagged locator uses the source as an index to retrieve the corresponding feedprovider. If there is a source that points to multiple services the locator fetches the first one it encounters. This results in the second feed not being fetched. AFAIK Symfony does not provide a locator that can fetch multiple services by index. There are multiple solutions to this problem: - We could have the php.watch feed provider fetch both feeds. - We could keep both the providers and give them a unique source. In this commit we decided on the latter. We introduce two new sources, php.watch-changes and php.watch-news. --- migrations/Version20231231123959.php | 37 +++++++++++++++++++ .../PhpWatchChangesFeedProvider.php | 2 +- .../FeedProvider/PhpWatchNewsFeedProvider.php | 2 +- 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 migrations/Version20231231123959.php diff --git a/migrations/Version20231231123959.php b/migrations/Version20231231123959.php new file mode 100644 index 0000000..f054481 --- /dev/null +++ b/migrations/Version20231231123959.php @@ -0,0 +1,37 @@ +addSql("DELETE FROM sources WHERE id='9930338f-d07c-4030-ade6-5ac19821e554'"); + + $this->addSql("INSERT INTO sources (id, name) VALUES ('a9ba164c-5a86-43d2-b024-f38e6a227a41', 'php.watch-news')"); + $this->addSql("INSERT INTO sources (id, name) VALUES ('18929b96-79a4-44bf-8d97-f442851b7b44', 'php.watch-changes')"); + + } + + public function down(Schema $schema): void + { + $this->addSql("INSERT INTO sources (id, name) VALUES ('9930338f-d07c-4030-ade6-5ac19821e554','php.watch')"); + + $this->addSql("DELETE FROM sources WHERE id='a9ba164c-5a86-43d2-b024-f38e6a227a41'"); + $this->addSql("DELETE FROM sources WHERE id='18929b96-79a4-44bf-8d97-f442851b7b44'"); + } +} diff --git a/src/Feed/Application/Service/FeedProvider/PhpWatchChangesFeedProvider.php b/src/Feed/Application/Service/FeedProvider/PhpWatchChangesFeedProvider.php index 889e916..d849036 100644 --- a/src/Feed/Application/Service/FeedProvider/PhpWatchChangesFeedProvider.php +++ b/src/Feed/Application/Service/FeedProvider/PhpWatchChangesFeedProvider.php @@ -20,7 +20,7 @@ public function __construct( public static function getSource(): string { - return 'php.watch'; + return 'php.watch-changes'; } public function fetchFeedItems(): array diff --git a/src/Feed/Application/Service/FeedProvider/PhpWatchNewsFeedProvider.php b/src/Feed/Application/Service/FeedProvider/PhpWatchNewsFeedProvider.php index a49e55f..0b0e1d8 100644 --- a/src/Feed/Application/Service/FeedProvider/PhpWatchNewsFeedProvider.php +++ b/src/Feed/Application/Service/FeedProvider/PhpWatchNewsFeedProvider.php @@ -20,7 +20,7 @@ public function __construct( public static function getSource(): string { - return 'php.watch'; + return 'php.watch-news'; } public function fetchFeedItems(): array